[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/input.output/file.streams/c.files/cinttypes.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,929 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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 <cinttypes>
+
+#include <cinttypes>
+#include <type_traits>
+
+#ifndef INT8_MIN
+#error INT8_MIN not defined
+#endif
+
+#ifndef INT16_MIN
+#error INT16_MIN not defined
+#endif
+
+#ifndef INT32_MIN
+#error INT32_MIN not defined
+#endif
+
+#ifndef INT64_MIN
+#error INT64_MIN not defined
+#endif
+
+#ifndef INT8_MAX
+#error INT8_MAX not defined
+#endif
+
+#ifndef INT16_MAX
+#error INT16_MAX not defined
+#endif
+
+#ifndef INT32_MAX
+#error INT32_MAX not defined
+#endif
+
+#ifndef INT64_MAX
+#error INT64_MAX not defined
+#endif
+
+#ifndef UINT8_MAX
+#error UINT8_MAX not defined
+#endif
+
+#ifndef UINT16_MAX
+#error UINT16_MAX not defined
+#endif
+
+#ifndef UINT32_MAX
+#error UINT32_MAX not defined
+#endif
+
+#ifndef UINT64_MAX
+#error UINT64_MAX not defined
+#endif
+
+#ifndef INT_LEAST8_MIN
+#error INT_LEAST8_MIN not defined
+#endif
+
+#ifndef INT_LEAST16_MIN
+#error INT_LEAST16_MIN not defined
+#endif
+
+#ifndef INT_LEAST32_MIN
+#error INT_LEAST32_MIN not defined
+#endif
+
+#ifndef INT_LEAST64_MIN
+#error INT_LEAST64_MIN not defined
+#endif
+
+#ifndef INT_LEAST8_MAX
+#error INT_LEAST8_MAX not defined
+#endif
+
+#ifndef INT_LEAST16_MAX
+#error INT_LEAST16_MAX not defined
+#endif
+
+#ifndef INT_LEAST32_MAX
+#error INT_LEAST32_MAX not defined
+#endif
+
+#ifndef INT_LEAST64_MAX
+#error INT_LEAST64_MAX not defined
+#endif
+
+#ifndef UINT_LEAST8_MAX
+#error UINT_LEAST8_MAX not defined
+#endif
+
+#ifndef UINT_LEAST16_MAX
+#error UINT_LEAST16_MAX not defined
+#endif
+
+#ifndef UINT_LEAST32_MAX
+#error UINT_LEAST32_MAX not defined
+#endif
+
+#ifndef UINT_LEAST64_MAX
+#error UINT_LEAST64_MAX not defined
+#endif
+
+#ifndef INT_FAST8_MIN
+#error INT_FAST8_MIN not defined
+#endif
+
+#ifndef INT_FAST16_MIN
+#error INT_FAST16_MIN not defined
+#endif
+
+#ifndef INT_FAST32_MIN
+#error INT_FAST32_MIN not defined
+#endif
+
+#ifndef INT_FAST64_MIN
+#error INT_FAST64_MIN not defined
+#endif
+
+#ifndef INT_FAST8_MAX
+#error INT_FAST8_MAX not defined
+#endif
+
+#ifndef INT_FAST16_MAX
+#error INT_FAST16_MAX not defined
+#endif
+
+#ifndef INT_FAST32_MAX
+#error INT_FAST32_MAX not defined
+#endif
+
+#ifndef INT_FAST64_MAX
+#error INT_FAST64_MAX not defined
+#endif
+
+#ifndef UINT_FAST8_MAX
+#error UINT_FAST8_MAX not defined
+#endif
+
+#ifndef UINT_FAST16_MAX
+#error UINT_FAST16_MAX not defined
+#endif
+
+#ifndef UINT_FAST32_MAX
+#error UINT_FAST32_MAX not defined
+#endif
+
+#ifndef UINT_FAST64_MAX
+#error UINT_FAST64_MAX not defined
+#endif
+
+#ifndef INTPTR_MIN
+#error INTPTR_MIN not defined
+#endif
+
+#ifndef INTPTR_MAX
+#error INTPTR_MAX not defined
+#endif
+
+#ifndef UINTPTR_MAX
+#error UINTPTR_MAX not defined
+#endif
+
+#ifndef INTMAX_MIN
+#error INTMAX_MIN not defined
+#endif
+
+#ifndef INTMAX_MAX
+#error INTMAX_MAX not defined
+#endif
+
+#ifndef UINTMAX_MAX
+#error UINTMAX_MAX not defined
+#endif
+
+#ifndef PTRDIFF_MIN
+#error PTRDIFF_MIN not defined
+#endif
+
+#ifndef PTRDIFF_MAX
+#error PTRDIFF_MAX not defined
+#endif
+
+#ifndef SIG_ATOMIC_MIN
+#error SIG_ATOMIC_MIN not defined
+#endif
+
+#ifndef SIG_ATOMIC_MAX
+#error SIG_ATOMIC_MAX not defined
+#endif
+
+#ifndef SIZE_MAX
+#error SIZE_MAX not defined
+#endif
+
+#ifndef WCHAR_MIN
+#error WCHAR_MIN not defined
+#endif
+
+#ifndef WCHAR_MAX
+#error WCHAR_MAX not defined
+#endif
+
+#ifndef WINT_MIN
+#error WINT_MIN not defined
+#endif
+
+#ifndef WINT_MAX
+#error WINT_MAX not defined
+#endif
+
+#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
+
+#ifndef PRId8
+#error PRId8 not defined
+#endif
+
+#ifndef PRId16
+#error PRId16 not defined
+#endif
+
+#ifndef PRId32
+#error PRId32 not defined
+#endif
+
+#ifndef PRId64
+#error PRId64 not defined
+#endif
+
+#ifndef PRIdLEAST8
+#error PRIdLEAST8 not defined
+#endif
+
+#ifndef PRIdLEAST16
+#error PRIdLEAST16 not defined
+#endif
+
+#ifndef PRIdLEAST32
+#error PRIdLEAST32 not defined
+#endif
+
+#ifndef PRIdLEAST64
+#error PRIdLEAST64 not defined
+#endif
+
+#ifndef PRIdFAST8
+#error PRIdFAST8 not defined
+#endif
+
+#ifndef PRIdFAST16
+#error PRIdFAST16 not defined
+#endif
+
+#ifndef PRIdFAST32
+#error PRIdFAST32 not defined
+#endif
+
+#ifndef PRIdFAST64
+#error PRIdFAST64 not defined
+#endif
+
+#ifndef PRIdMAX
+#error PRIdMAX not defined
+#endif
+
+#ifndef PRIdPTR
+#error PRIdPTR not defined
+#endif
+
+#ifndef PRIi8
+#error PRIi8 not defined
+#endif
+
+#ifndef PRIi16
+#error PRIi16 not defined
+#endif
+
+#ifndef PRIi32
+#error PRIi32 not defined
+#endif
+
+#ifndef PRIi64
+#error PRIi64 not defined
+#endif
+
+#ifndef PRIiLEAST8
+#error PRIiLEAST8 not defined
+#endif
+
+#ifndef PRIiLEAST16
+#error PRIiLEAST16 not defined
+#endif
+
+#ifndef PRIiLEAST32
+#error PRIiLEAST32 not defined
+#endif
+
+#ifndef PRIiLEAST64
+#error PRIiLEAST64 not defined
+#endif
+
+#ifndef PRIiFAST8
+#error PRIiFAST8 not defined
+#endif
+
+#ifndef PRIiFAST16
+#error PRIiFAST16 not defined
+#endif
+
+#ifndef PRIiFAST32
+#error PRIiFAST32 not defined
+#endif
+
+#ifndef PRIiFAST64
+#error PRIiFAST64 not defined
+#endif
+
+#ifndef PRIiMAX
+#error PRIiMAX not defined
+#endif
+
+#ifndef PRIiPTR
+#error PRIiPTR not defined
+#endif
+
+#ifndef PRIo8
+#error PRIo8 not defined
+#endif
+
+#ifndef PRIo16
+#error PRIo16 not defined
+#endif
+
+#ifndef PRIo32
+#error PRIo32 not defined
+#endif
+
+#ifndef PRIo64
+#error PRIo64 not defined
+#endif
+
+#ifndef PRIoLEAST8
+#error PRIoLEAST8 not defined
+#endif
+
+#ifndef PRIoLEAST16
+#error PRIoLEAST16 not defined
+#endif
+
+#ifndef PRIoLEAST32
+#error PRIoLEAST32 not defined
+#endif
+
+#ifndef PRIoLEAST64
+#error PRIoLEAST64 not defined
+#endif
+
+#ifndef PRIoFAST8
+#error PRIoFAST8 not defined
+#endif
+
+#ifndef PRIoFAST16
+#error PRIoFAST16 not defined
+#endif
+
+#ifndef PRIoFAST32
+#error PRIoFAST32 not defined
+#endif
+
+#ifndef PRIoFAST64
+#error PRIoFAST64 not defined
+#endif
+
+#ifndef PRIoMAX
+#error PRIoMAX not defined
+#endif
+
+#ifndef PRIoPTR
+#error PRIoPTR not defined
+#endif
+
+#ifndef PRIu8
+#error PRIu8 not defined
+#endif
+
+#ifndef PRIu16
+#error PRIu16 not defined
+#endif
+
+#ifndef PRIu32
+#error PRIu32 not defined
+#endif
+
+#ifndef PRIu64
+#error PRIu64 not defined
+#endif
+
+#ifndef PRIuLEAST8
+#error PRIuLEAST8 not defined
+#endif
+
+#ifndef PRIuLEAST16
+#error PRIuLEAST16 not defined
+#endif
+
+#ifndef PRIuLEAST32
+#error PRIuLEAST32 not defined
+#endif
+
+#ifndef PRIuLEAST64
+#error PRIuLEAST64 not defined
+#endif
+
+#ifndef PRIuFAST8
+#error PRIuFAST8 not defined
+#endif
+
+#ifndef PRIuFAST16
+#error PRIuFAST16 not defined
+#endif
+
+#ifndef PRIuFAST32
+#error PRIuFAST32 not defined
+#endif
+
+#ifndef PRIuFAST64
+#error PRIuFAST64 not defined
+#endif
+
+#ifndef PRIuMAX
+#error PRIuMAX not defined
+#endif
+
+#ifndef PRIuPTR
+#error PRIuPTR not defined
+#endif
+
+#ifndef PRIx8
+#error PRIx8 not defined
+#endif
+
+#ifndef PRIx16
+#error PRIx16 not defined
+#endif
+
+#ifndef PRIx32
+#error PRIx32 not defined
+#endif
+
+#ifndef PRIx64
+#error PRIx64 not defined
+#endif
+
+#ifndef PRIxLEAST8
+#error PRIxLEAST8 not defined
+#endif
+
+#ifndef PRIxLEAST16
+#error PRIxLEAST16 not defined
+#endif
+
+#ifndef PRIxLEAST32
+#error PRIxLEAST32 not defined
+#endif
+
+#ifndef PRIxLEAST64
+#error PRIxLEAST64 not defined
+#endif
+
+#ifndef PRIxFAST8
+#error PRIxFAST8 not defined
+#endif
+
+#ifndef PRIxFAST16
+#error PRIxFAST16 not defined
+#endif
+
+#ifndef PRIxFAST32
+#error PRIxFAST32 not defined
+#endif
+
+#ifndef PRIxFAST64
+#error PRIxFAST64 not defined
+#endif
+
+#ifndef PRIxMAX
+#error PRIxMAX not defined
+#endif
+
+#ifndef PRIxPTR
+#error PRIxPTR not defined
+#endif
+
+#ifndef PRIX8
+#error PRIX8 not defined
+#endif
+
+#ifndef PRIX16
+#error PRIX16 not defined
+#endif
+
+#ifndef PRIX32
+#error PRIX32 not defined
+#endif
+
+#ifndef PRIX64
+#error PRIX64 not defined
+#endif
+
+#ifndef PRIXLEAST8
+#error PRIXLEAST8 not defined
+#endif
+
+#ifndef PRIXLEAST16
+#error PRIXLEAST16 not defined
+#endif
+
+#ifndef PRIXLEAST32
+#error PRIXLEAST32 not defined
+#endif
+
+#ifndef PRIXLEAST64
+#error PRIXLEAST64 not defined
+#endif
+
+#ifndef PRIXFAST8
+#error PRIXFAST8 not defined
+#endif
+
+#ifndef PRIXFAST16
+#error PRIXFAST16 not defined
+#endif
+
+#ifndef PRIXFAST32
+#error PRIXFAST32 not defined
+#endif
+
+#ifndef PRIXFAST64
+#error PRIXFAST64 not defined
+#endif
+
+#ifndef PRIXMAX
+#error PRIXMAX not defined
+#endif
+
+#ifndef PRIXPTR
+#error PRIXPTR not defined
+#endif
+
+#ifndef SCNd8
+#error SCNd8 not defined
+#endif
+
+#ifndef SCNd16
+#error SCNd16 not defined
+#endif
+
+#ifndef SCNd32
+#error SCNd32 not defined
+#endif
+
+#ifndef SCNd64
+#error SCNd64 not defined
+#endif
+
+#ifndef SCNdLEAST8
+#error SCNdLEAST8 not defined
+#endif
+
+#ifndef SCNdLEAST16
+#error SCNdLEAST16 not defined
+#endif
+
+#ifndef SCNdLEAST32
+#error SCNdLEAST32 not defined
+#endif
+
+#ifndef SCNdLEAST64
+#error SCNdLEAST64 not defined
+#endif
+
+#ifndef SCNdFAST8
+#error SCNdFAST8 not defined
+#endif
+
+#ifndef SCNdFAST16
+#error SCNdFAST16 not defined
+#endif
+
+#ifndef SCNdFAST32
+#error SCNdFAST32 not defined
+#endif
+
+#ifndef SCNdFAST64
+#error SCNdFAST64 not defined
+#endif
+
+#ifndef SCNdMAX
+#error SCNdMAX not defined
+#endif
+
+#ifndef SCNdPTR
+#error SCNdPTR not defined
+#endif
+
+#ifndef SCNi8
+#error SCNi8 not defined
+#endif
+
+#ifndef SCNi16
+#error SCNi16 not defined
+#endif
+
+#ifndef SCNi32
+#error SCNi32 not defined
+#endif
+
+#ifndef SCNi64
+#error SCNi64 not defined
+#endif
+
+#ifndef SCNiLEAST8
+#error SCNiLEAST8 not defined
+#endif
+
+#ifndef SCNiLEAST16
+#error SCNiLEAST16 not defined
+#endif
+
+#ifndef SCNiLEAST32
+#error SCNiLEAST32 not defined
+#endif
+
+#ifndef SCNiLEAST64
+#error SCNiLEAST64 not defined
+#endif
+
+#ifndef SCNiFAST8
+#error SCNiFAST8 not defined
+#endif
+
+#ifndef SCNiFAST16
+#error SCNiFAST16 not defined
+#endif
+
+#ifndef SCNiFAST32
+#error SCNiFAST32 not defined
+#endif
+
+#ifndef SCNiFAST64
+#error SCNiFAST64 not defined
+#endif
+
+#ifndef SCNiMAX
+#error SCNiMAX not defined
+#endif
+
+#ifndef SCNiPTR
+#error SCNiPTR not defined
+#endif
+
+#ifndef SCNo8
+#error SCNo8 not defined
+#endif
+
+#ifndef SCNo16
+#error SCNo16 not defined
+#endif
+
+#ifndef SCNo32
+#error SCNo32 not defined
+#endif
+
+#ifndef SCNo64
+#error SCNo64 not defined
+#endif
+
+#ifndef SCNoLEAST8
+#error SCNoLEAST8 not defined
+#endif
+
+#ifndef SCNoLEAST16
+#error SCNoLEAST16 not defined
+#endif
+
+#ifndef SCNoLEAST32
+#error SCNoLEAST32 not defined
+#endif
+
+#ifndef SCNoLEAST64
+#error SCNoLEAST64 not defined
+#endif
+
+#ifndef SCNoFAST8
+#error SCNoFAST8 not defined
+#endif
+
+#ifndef SCNoFAST16
+#error SCNoFAST16 not defined
+#endif
+
+#ifndef SCNoFAST32
+#error SCNoFAST32 not defined
+#endif
+
+#ifndef SCNoFAST64
+#error SCNoFAST64 not defined
+#endif
+
+#ifndef SCNoMAX
+#error SCNoMAX not defined
+#endif
+
+#ifndef SCNoPTR
+#error SCNoPTR not defined
+#endif
+
+#ifndef SCNu8
+#error SCNu8 not defined
+#endif
+
+#ifndef SCNu16
+#error SCNu16 not defined
+#endif
+
+#ifndef SCNu32
+#error SCNu32 not defined
+#endif
+
+#ifndef SCNu64
+#error SCNu64 not defined
+#endif
+
+#ifndef SCNuLEAST8
+#error SCNuLEAST8 not defined
+#endif
+
+#ifndef SCNuLEAST16
+#error SCNuLEAST16 not defined
+#endif
+
+#ifndef SCNuLEAST32
+#error SCNuLEAST32 not defined
+#endif
+
+#ifndef SCNuLEAST64
+#error SCNuLEAST64 not defined
+#endif
+
+#ifndef SCNuFAST8
+#error SCNuFAST8 not defined
+#endif
+
+#ifndef SCNuFAST16
+#error SCNuFAST16 not defined
+#endif
+
+#ifndef SCNuFAST32
+#error SCNuFAST32 not defined
+#endif
+
+#ifndef SCNuFAST64
+#error SCNuFAST64 not defined
+#endif
+
+#ifndef SCNuMAX
+#error SCNuMAX not defined
+#endif
+
+#ifndef SCNuPTR
+#error SCNuPTR not defined
+#endif
+
+#ifndef SCNx8
+#error SCNx8 not defined
+#endif
+
+#ifndef SCNx16
+#error SCNx16 not defined
+#endif
+
+#ifndef SCNx32
+#error SCNx32 not defined
+#endif
+
+#ifndef SCNx64
+#error SCNx64 not defined
+#endif
+
+#ifndef SCNxLEAST8
+#error SCNxLEAST8 not defined
+#endif
+
+#ifndef SCNxLEAST16
+#error SCNxLEAST16 not defined
+#endif
+
+#ifndef SCNxLEAST32
+#error SCNxLEAST32 not defined
+#endif
+
+#ifndef SCNxLEAST64
+#error SCNxLEAST64 not defined
+#endif
+
+#ifndef SCNxFAST8
+#error SCNxFAST8 not defined
+#endif
+
+#ifndef SCNxFAST16
+#error SCNxFAST16 not defined
+#endif
+
+#ifndef SCNxFAST32
+#error SCNxFAST32 not defined
+#endif
+
+#ifndef SCNxFAST64
+#error SCNxFAST64 not defined
+#endif
+
+#ifndef SCNxMAX
+#error SCNxMAX not defined
+#endif
+
+#ifndef SCNxPTR
+#error SCNxPTR not defined
+#endif
+
+int main()
+{
+    {
+    std::int8_t  i1 = 0;
+    std::int16_t i2 = 0;
+    std::int32_t i3 = 0;
+    std::int64_t i4 = 0;
+    }
+    {
+    std::uint8_t  i1 = 0;
+    std::uint16_t i2 = 0;
+    std::uint32_t i3 = 0;
+    std::uint64_t i4 = 0;
+    }
+    {
+    std::int_least8_t  i1 = 0;
+    std::int_least16_t i2 = 0;
+    std::int_least32_t i3 = 0;
+    std::int_least64_t i4 = 0;
+    }
+    {
+    std::uint_least8_t  i1 = 0;
+    std::uint_least16_t i2 = 0;
+    std::uint_least32_t i3 = 0;
+    std::uint_least64_t i4 = 0;
+    }
+    {
+    std::int_fast8_t  i1 = 0;
+    std::int_fast16_t i2 = 0;
+    std::int_fast32_t i3 = 0;
+    std::int_fast64_t i4 = 0;
+    }
+    {
+    std::uint_fast8_t  i1 = 0;
+    std::uint_fast16_t i2 = 0;
+    std::uint_fast32_t i3 = 0;
+    std::uint_fast64_t i4 = 0;
+    }
+    {
+    std::intptr_t  i1 = 0;
+    std::uintptr_t i2 = 0;
+    std::intmax_t  i3 = 0;
+    std::uintmax_t i4 = 0;
+    }
+    {
+    std::imaxdiv_t  i1 = {0};
+    }
+    std::intmax_t i = 0;
+    static_assert((std::is_same<decltype(std::imaxabs(i)), std::intmax_t>::value), "");
+    static_assert((std::is_same<decltype(std::imaxdiv(i, i)), std::imaxdiv_t>::value), "");
+    static_assert((std::is_same<decltype(std::strtoimax("", (char**)0, 0)), std::intmax_t>::value), "");
+    static_assert((std::is_same<decltype(std::strtoumax("", (char**)0, 0)), std::uintmax_t>::value), "");
+    static_assert((std::is_same<decltype(std::wcstoimax(L"", (wchar_t**)0, 0)), std::intmax_t>::value), "");
+    static_assert((std::is_same<decltype(std::wcstoumax(L"", (wchar_t**)0, 0)), std::uintmax_t>::value), "");
+}

Added: libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,139 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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 <cstdio>
+
+#include <cstdio>
+#include <type_traits>
+
+#ifndef BUFSIZ
+#error BUFSIZ not defined
+#endif
+
+#ifndef EOF
+#error EOF not defined
+#endif
+
+#ifndef FILENAME_MAX
+#error FILENAME_MAX not defined
+#endif
+
+#ifndef FOPEN_MAX
+#error FOPEN_MAX not defined
+#endif
+
+#ifndef L_tmpnam
+#error L_tmpnam not defined
+#endif
+
+#ifndef NULL
+#error NULL not defined
+#endif
+
+#ifndef SEEK_CUR
+#error SEEK_CUR not defined
+#endif
+
+#ifndef SEEK_END
+#error SEEK_END not defined
+#endif
+
+#ifndef SEEK_SET
+#error SEEK_SET not defined
+#endif
+
+#ifndef TMP_MAX
+#error TMP_MAX not defined
+#endif
+
+#ifndef _IOFBF
+#error _IOFBF not defined
+#endif
+
+#ifndef _IOLBF
+#error _IOLBF not defined
+#endif
+
+#ifndef _IONBF
+#error _IONBF not defined
+#endif
+
+#ifndef stderr
+#error stderr not defined
+#endif
+
+#ifndef stdin
+#error stdin not defined
+#endif
+
+#ifndef stdout
+#error stdout not defined
+#endif
+
+#include <cstdarg>
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-zero-length"
+
+int main()
+{
+    std::FILE* fp = 0;
+    std::fpos_t fpos = {0};
+    std::size_t s = 0;
+    char* cp = 0;
+    std::va_list va;
+    static_assert((std::is_same<decltype(std::remove("")), int>::value), "");
+    static_assert((std::is_same<decltype(std::rename("","")), int>::value), "");
+    static_assert((std::is_same<decltype(std::tmpfile()), std::FILE*>::value), "");
+    static_assert((std::is_same<decltype(std::tmpnam(cp)), char*>::value), "");
+    static_assert((std::is_same<decltype(std::fclose(fp)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fflush(fp)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fopen("", "")), std::FILE*>::value), "");
+    static_assert((std::is_same<decltype(std::freopen("", "", fp)), std::FILE*>::value), "");
+    static_assert((std::is_same<decltype(std::setbuf(fp,cp)), void>::value), "");
+    static_assert((std::is_same<decltype(std::vfprintf(fp,"",va)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fprintf(fp," ")), int>::value), "");
+    static_assert((std::is_same<decltype(std::fscanf(fp,"")), int>::value), "");
+    static_assert((std::is_same<decltype(std::printf(" ")), int>::value), "");
+    static_assert((std::is_same<decltype(std::scanf(" ")), int>::value), "");
+    static_assert((std::is_same<decltype(std::snprintf(cp,0," ")), int>::value), "");
+    static_assert((std::is_same<decltype(std::sprintf(cp," ")), int>::value), "");
+    static_assert((std::is_same<decltype(std::sscanf("","")), int>::value), "");
+    static_assert((std::is_same<decltype(std::vfprintf(fp,"",va)), int>::value), "");
+    static_assert((std::is_same<decltype(std::vfscanf(fp,"",va)), int>::value), "");
+    static_assert((std::is_same<decltype(std::vprintf(" ",va)), int>::value), "");
+    static_assert((std::is_same<decltype(std::vscanf("",va)), int>::value), "");
+    static_assert((std::is_same<decltype(std::vsnprintf(cp,0," ",va)), int>::value), "");
+    static_assert((std::is_same<decltype(std::vsprintf(cp," ",va)), int>::value), "");
+    static_assert((std::is_same<decltype(std::vsscanf("","",va)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fgetc(fp)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fgets(cp,0,fp)), char*>::value), "");
+    static_assert((std::is_same<decltype(std::fputc(0,fp)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fputs("",fp)), int>::value), "");
+    static_assert((std::is_same<decltype(std::getc(fp)), int>::value), "");
+    static_assert((std::is_same<decltype(std::getchar()), int>::value), "");
+#if _LIBCPP_STD_VER <= 11
+    static_assert((std::is_same<decltype(std::gets(cp)), char*>::value), "");
+#endif
+    static_assert((std::is_same<decltype(std::putc(0,fp)), int>::value), "");
+    static_assert((std::is_same<decltype(std::putchar(0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::puts("")), int>::value), "");
+    static_assert((std::is_same<decltype(std::ungetc(0,fp)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fread((void*)0,0,0,fp)), std::size_t>::value), "");
+    static_assert((std::is_same<decltype(std::fwrite((const void*)0,0,0,fp)), std::size_t>::value), "");
+    static_assert((std::is_same<decltype(std::fgetpos(fp, &fpos)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fseek(fp, 0,0)), int>::value), "");
+    static_assert((std::is_same<decltype(std::fsetpos(fp, &fpos)), int>::value), "");
+    static_assert((std::is_same<decltype(std::ftell(fp)), long>::value), "");
+    static_assert((std::is_same<decltype(std::rewind(fp)), void>::value), "");
+    static_assert((std::is_same<decltype(std::clearerr(fp)), void>::value), "");
+    static_assert((std::is_same<decltype(std::feof(fp)), int>::value), "");
+    static_assert((std::is_same<decltype(std::ferror(fp)), int>::value), "");
+    static_assert((std::is_same<decltype(std::perror("")), void>::value), "");
+}

Added: libcxx/trunk/test/std/input.output/file.streams/c.files/gets.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/c.files/gets.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/c.files/gets.fail.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/c.files/gets.fail.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 <cstdio>
+
+// gets 
+
+#include <cstdio>
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11
+    (void) std::gets((char *) NULL);
+#else
+#error
+#endif
+}

Added: libcxx/trunk/test/std/input.output/file.streams/c.files/version_ccstdio.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/c.files/version_ccstdio.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/c.files/version_ccstdio.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/c.files/version_ccstdio.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <cstdio>
+
+#include <cstdio>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/input.output/file.streams/c.files/version_cinttypes.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/c.files/version_cinttypes.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/c.files/version_cinttypes.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/c.files/version_cinttypes.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <cinttypes>
+
+#include <cinttypes>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.assign/member_swap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_filebuf
+
+// void swap(basic_filebuf& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp = get_temp_file_name();
+    {
+        std::filebuf f;
+        assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
+                                               | std::ios_base::trunc) != 0);
+        assert(f.is_open());
+        assert(f.sputn("123", 3) == 3);
+        f.pubseekoff(1, std::ios_base::beg);
+        assert(f.sgetc() == '2');
+        std::filebuf f2;
+        f2.swap(f);
+        assert(!f.is_open());
+        assert(f2.is_open());
+        assert(f2.sgetc() == '2');
+    }
+    std::remove(temp.c_str());
+    {
+        std::wfilebuf f;
+        assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
+                                               | std::ios_base::trunc) != 0);
+        assert(f.is_open());
+        assert(f.sputn(L"123", 3) == 3);
+        f.pubseekoff(1, std::ios_base::beg);
+        assert(f.sgetc() == L'2');
+        std::wfilebuf f2;
+        f2.swap(f);
+        assert(!f.is_open());
+        assert(f2.is_open());
+        assert(f2.sgetc() == L'2');
+    }
+    std::remove(temp.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_filebuf
+
+// basic_filebuf& operator=(basic_filebuf&& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::string temp = get_temp_file_name();
+    {
+        std::filebuf f;
+        assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
+                                               | std::ios_base::trunc) != 0);
+        assert(f.is_open());
+        assert(f.sputn("123", 3) == 3);
+        f.pubseekoff(1, std::ios_base::beg);
+        assert(f.sgetc() == '2');
+        std::filebuf f2;
+        f2 = move(f);
+        assert(!f.is_open());
+        assert(f2.is_open());
+        assert(f2.sgetc() == '2');
+    }
+    std::remove(temp.c_str());
+    {
+        std::wfilebuf f;
+        assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
+                                               | std::ios_base::trunc) != 0);
+        assert(f.is_open());
+        assert(f.sputn(L"123", 3) == 3);
+        f.pubseekoff(1, std::ios_base::beg);
+        assert(f.sgetc() == L'2');
+        std::wfilebuf f2;
+        f2 = move(f);
+        assert(!f.is_open());
+        assert(f2.is_open());
+        assert(f2.sgetc() == L'2');
+    }
+    std::remove(temp.c_str());
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_filebuf
+
+// template <class charT, class traits>
+// void
+// swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp = get_temp_file_name();
+    {
+        std::filebuf f;
+        assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
+                                               | std::ios_base::trunc) != 0);
+        assert(f.is_open());
+        assert(f.sputn("123", 3) == 3);
+        f.pubseekoff(1, std::ios_base::beg);
+        assert(f.sgetc() == '2');
+        std::filebuf f2;
+        swap(f2, f);
+        assert(!f.is_open());
+        assert(f2.is_open());
+        assert(f2.sgetc() == '2');
+    }
+    std::remove(temp.c_str());
+    {
+        std::wfilebuf f;
+        assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
+                                               | std::ios_base::trunc) != 0);
+        assert(f.is_open());
+        assert(f.sputn(L"123", 3) == 3);
+        f.pubseekoff(1, std::ios_base::beg);
+        assert(f.sgetc() == L'2');
+        std::wfilebuf f2;
+        swap(f2, f);
+        assert(!f.is_open());
+        assert(f2.is_open());
+        assert(f2.sgetc() == L'2');
+    }
+    std::remove(temp.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.cons/default.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_filebuf
+
+// basic_filebuf();
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::filebuf f;
+        assert(!f.is_open());
+    }
+    {
+        std::wfilebuf f;
+        assert(!f.is_open());
+    }
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.cons/move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_filebuf
+
+// basic_filebuf(basic_filebuf&& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::string temp = get_temp_file_name();
+    {
+        std::filebuf f;
+        assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
+                                               | std::ios_base::trunc) != 0);
+        assert(f.is_open());
+        assert(f.sputn("123", 3) == 3);
+        f.pubseekoff(1, std::ios_base::beg);
+        assert(f.sgetc() == '2');
+        std::filebuf f2(move(f));
+        assert(!f.is_open());
+        assert(f2.is_open());
+        assert(f2.sgetc() == '2');
+    }
+    std::remove(temp.c_str());
+    {
+        std::wfilebuf f;
+        assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
+                                               | std::ios_base::trunc) != 0);
+        assert(f.is_open());
+        assert(f.sputn(L"123", 3) == 3);
+        f.pubseekoff(1, std::ios_base::beg);
+        assert(f.sgetc() == L'2');
+        std::wfilebuf f2(move(f));
+        assert(!f.is_open());
+        assert(f2.is_open());
+        assert(f2.sgetc() == L'2');
+    }
+    std::remove(temp.c_str());
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// basic_filebuf<charT,traits>* open(const char* s, ios_base::openmode mode);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp = get_temp_file_name();
+    {
+        std::filebuf f;
+        assert(f.open(temp.c_str(), std::ios_base::out) != 0);
+        assert(f.is_open());
+        assert(f.sputn("123", 3) == 3);
+    }
+    {
+        std::filebuf f;
+        assert(f.open(temp.c_str(), std::ios_base::in) != 0);
+        assert(f.is_open());
+        assert(f.sbumpc() == '1');
+        assert(f.sbumpc() == '2');
+        assert(f.sbumpc() == '3');
+    }
+    std::remove(temp.c_str());
+    {
+        std::wfilebuf f;
+        assert(f.open(temp.c_str(), std::ios_base::out) != 0);
+        assert(f.is_open());
+        assert(f.sputn(L"123", 3) == 3);
+    }
+    {
+        std::wfilebuf f;
+        assert(f.open(temp.c_str(), std::ios_base::in) != 0);
+        assert(f.is_open());
+        assert(f.sbumpc() == L'1');
+        assert(f.sbumpc() == L'2');
+        assert(f.sbumpc() == L'3');
+    }
+    remove(temp.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,142 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// int_type overflow(int_type c = traits::eof());
+
+// This test is not entirely portable
+
+#include <fstream>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test_buf
+    : public std::basic_filebuf<CharT>
+{
+    typedef std::basic_filebuf<CharT>  base;
+    typedef typename base::char_type   char_type;
+    typedef typename base::int_type    int_type;
+    typedef typename base::traits_type traits_type;
+
+    char_type* pbase() const {return base::pbase();}
+    char_type* pptr()  const {return base::pptr();}
+    char_type* epptr() const {return base::epptr();}
+    void gbump(int n) {base::gbump(n);}
+
+    virtual int_type overflow(int_type c = traits_type::eof()) {return base::overflow(c);}
+};
+
+int main()
+{
+    {
+        test_buf<char> f;
+        assert(f.open("overflow.dat", std::ios_base::out) != 0);
+        assert(f.is_open());
+        assert(f.pbase() == 0);
+        assert(f.pptr() == 0);
+        assert(f.epptr() == 0);
+        assert(f.overflow('a') == 'a');
+        assert(f.pbase() != 0);
+        assert(f.pptr() == f.pbase());
+        assert(f.epptr() - f.pbase() == 4095);
+    }
+    {
+        test_buf<char> f;
+        assert(f.open("overflow.dat", std::ios_base::in) != 0);
+        assert(f.is_open());
+        assert(f.sgetc() == 'a');
+    }
+    std::remove("overflow.dat");
+    {
+        test_buf<char> f;
+        f.pubsetbuf(0, 0);
+        assert(f.open("overflow.dat", std::ios_base::out) != 0);
+        assert(f.is_open());
+        assert(f.pbase() == 0);
+        assert(f.pptr() == 0);
+        assert(f.epptr() == 0);
+        assert(f.overflow('a') == 'a');
+        assert(f.pbase() == 0);
+        assert(f.pptr() == 0);
+        assert(f.epptr() == 0);
+    }
+    {
+        test_buf<char> f;
+        assert(f.open("overflow.dat", std::ios_base::in) != 0);
+        assert(f.is_open());
+        assert(f.sgetc() == 'a');
+    }
+    std::remove("overflow.dat");
+    {
+        test_buf<wchar_t> f;
+        assert(f.open("overflow.dat", std::ios_base::out) != 0);
+        assert(f.is_open());
+        assert(f.pbase() == 0);
+        assert(f.pptr() == 0);
+        assert(f.epptr() == 0);
+        assert(f.overflow(L'a') == L'a');
+        assert(f.pbase() != 0);
+        assert(f.pptr() == f.pbase());
+        assert(f.epptr() - f.pbase() == 4095);
+    }
+    {
+        test_buf<wchar_t> f;
+        assert(f.open("overflow.dat", std::ios_base::in) != 0);
+        assert(f.is_open());
+        assert(f.sgetc() == L'a');
+    }
+    std::remove("overflow.dat");
+    {
+        test_buf<wchar_t> f;
+        f.pubsetbuf(0, 0);
+        assert(f.open("overflow.dat", std::ios_base::out) != 0);
+        assert(f.is_open());
+        assert(f.pbase() == 0);
+        assert(f.pptr() == 0);
+        assert(f.epptr() == 0);
+        assert(f.overflow(L'a') == L'a');
+        assert(f.pbase() == 0);
+        assert(f.pptr() == 0);
+        assert(f.epptr() == 0);
+    }
+    {
+        test_buf<wchar_t> f;
+        assert(f.open("overflow.dat", std::ios_base::in) != 0);
+        assert(f.is_open());
+        assert(f.sgetc() == L'a');
+    }
+    std::remove("overflow.dat");
+    {
+        test_buf<wchar_t> f;
+        f.pubimbue(std::locale(LOCALE_en_US_UTF_8));
+        assert(f.open("overflow.dat", std::ios_base::out) != 0);
+        assert(f.sputc(0x4E51) == 0x4E51);
+        assert(f.sputc(0x4E52) == 0x4E52);
+        assert(f.sputc(0x4E53) == 0x4E53);
+    }
+    {
+        test_buf<char> f;
+        assert(f.open("overflow.dat", std::ios_base::in) != 0);
+        assert(f.is_open());
+        assert(f.sbumpc() == 0xE4);
+        assert(f.sbumpc() == 0xB9);
+        assert(f.sbumpc() == 0x91);
+        assert(f.sbumpc() == 0xE4);
+        assert(f.sbumpc() == 0xB9);
+        assert(f.sbumpc() == 0x92);
+        assert(f.sbumpc() == 0xE4);
+        assert(f.sbumpc() == 0xB9);
+        assert(f.sbumpc() == 0x93);
+        assert(f.sbumpc() == -1);
+    }
+    std::remove("overflow.dat");
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// int_type pbackfail(int_type c = traits::eof());
+
+// This test is not entirely portable
+
+#include <fstream>
+#include <cassert>
+
+template <class CharT>
+struct test_buf
+    : public std::basic_filebuf<CharT>
+{
+    typedef std::basic_filebuf<CharT>  base;
+    typedef typename base::char_type   char_type;
+    typedef typename base::int_type    int_type;
+    typedef typename base::traits_type traits_type;
+
+    char_type* eback() const {return base::eback();}
+    char_type* gptr()  const {return base::gptr();}
+    char_type* egptr() const {return base::egptr();}
+    void gbump(int n) {base::gbump(n);}
+
+    virtual int_type pbackfail(int_type c = traits_type::eof()) {return base::pbackfail(c);}
+};
+
+int main()
+{
+    {
+        test_buf<char> f;
+        assert(f.open("underflow.dat", std::ios_base::in) != 0);
+        assert(f.is_open());
+        assert(f.sbumpc() == '1');
+        assert(f.sgetc() == '2');
+        assert(f.pbackfail('a') == -1);
+    }
+    {
+        test_buf<char> f;
+        assert(f.open("underflow.dat", std::ios_base::in | std::ios_base::out) != 0);
+        assert(f.is_open());
+        assert(f.sbumpc() == '1');
+        assert(f.sgetc() == '2');
+        assert(f.pbackfail('a') == 'a');
+        assert(f.sbumpc() == 'a');
+        assert(f.sgetc() == '2');
+    }
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// pos_type seekoff(off_type off, ios_base::seekdir way,
+//                  ios_base::openmode which = ios_base::in | ios_base::out);
+// pos_type seekpos(pos_type sp,
+//                  ios_base::openmode which = ios_base::in | ios_base::out);
+
+// This test is not entirely portable
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+    {
+        char buf[10];
+        typedef std::filebuf::pos_type pos_type;
+        std::filebuf f;
+        f.pubsetbuf(buf, sizeof(buf));
+        assert(f.open("seekoff.dat", std::ios_base::in | std::ios_base::out
+                                                       | std::ios_base::trunc) != 0);
+        assert(f.is_open());
+        f.sputn("abcdefghijklmnopqrstuvwxyz", 26);
+        assert(buf[0] == 'v');
+        pos_type p = f.pubseekoff(-15, std::ios_base::cur);
+        assert(p == 11);
+        assert(f.sgetc() == 'l');
+        f.pubseekoff(0, std::ios_base::beg);
+        assert(f.sgetc() == 'a');
+        f.pubseekoff(-1, std::ios_base::end);
+        assert(f.sgetc() == 'z');
+        assert(f.pubseekpos(p) == p);
+        assert(f.sgetc() == 'l');
+    }
+    std::remove("seekoff.dat");
+    {
+        wchar_t buf[10];
+        typedef std::filebuf::pos_type pos_type;
+        std::wfilebuf f;
+        f.pubsetbuf(buf, sizeof(buf)/sizeof(buf[0]));
+        assert(f.open("seekoff.dat", std::ios_base::in | std::ios_base::out
+                                                       | std::ios_base::trunc) != 0);
+        assert(f.is_open());
+        f.sputn(L"abcdefghijklmnopqrstuvwxyz", 26);
+        assert(buf[0] == L'v');
+        pos_type p = f.pubseekoff(-15, std::ios_base::cur);
+        assert(p == 11);
+        assert(f.sgetc() == L'l');
+        f.pubseekoff(0, std::ios_base::beg);
+        assert(f.sgetc() == L'a');
+        f.pubseekoff(-1, std::ios_base::end);
+        assert(f.sgetc() == L'z');
+        assert(f.pubseekpos(p) == p);
+        assert(f.sgetc() == L'l');
+    }
+    std::remove("seekoff.dat");
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.dat
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.dat?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.dat (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.dat Fri Dec 19 19:40:03 2014
@@ -0,0 +1 @@
+123456789
\ No newline at end of file

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,121 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// int_type underflow();
+
+// This test is not entirely portable
+
+#include <fstream>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test_buf
+    : public std::basic_filebuf<CharT>
+{
+    typedef std::basic_filebuf<CharT> base;
+    typedef typename base::char_type  char_type;
+    typedef typename base::int_type   int_type;
+
+    char_type* eback() const {return base::eback();}
+    char_type* gptr()  const {return base::gptr();}
+    char_type* egptr() const {return base::egptr();}
+    void gbump(int n) {base::gbump(n);}
+
+    virtual int_type underflow() {return base::underflow();}
+};
+
+int main()
+{
+    {
+        test_buf<char> f;
+        assert(f.open("underflow.dat", std::ios_base::in) != 0);
+        assert(f.is_open());
+        assert(f.eback() == 0);
+        assert(f.gptr() == 0);
+        assert(f.egptr() == 0);
+        assert(f.underflow() == '1');
+        assert(f.eback() != 0);
+        assert(f.eback() == f.gptr());
+        assert(*f.gptr() == '1');
+        assert(f.egptr() - f.eback() == 9);
+    }
+    {
+        test_buf<char> f;
+        assert(f.open("underflow.dat", std::ios_base::in) != 0);
+        assert(f.pubsetbuf(0, 0));
+        assert(f.is_open());
+        assert(f.eback() == 0);
+        assert(f.gptr() == 0);
+        assert(f.egptr() == 0);
+        assert(f.underflow() == '1');
+        assert(f.eback() != 0);
+        assert(f.eback() == f.gptr());
+        assert(*f.gptr() == '1');
+        assert(f.egptr() - f.eback() == 8);
+        f.gbump(8);
+        assert(f.sgetc() == '9');
+        assert(f.eback()[0] == '5');
+        assert(f.eback()[1] == '6');
+        assert(f.eback()[2] == '7');
+        assert(f.eback()[3] == '8');
+        assert(f.gptr() - f.eback() == 4);
+        assert(*f.gptr() == '9');
+        assert(f.egptr() - f.gptr() == 1);
+    }
+    {
+        test_buf<wchar_t> f;
+        assert(f.open("underflow.dat", std::ios_base::in) != 0);
+        assert(f.is_open());
+        assert(f.eback() == 0);
+        assert(f.gptr() == 0);
+        assert(f.egptr() == 0);
+        assert(f.underflow() == L'1');
+        assert(f.eback() != 0);
+        assert(f.eback() == f.gptr());
+        assert(*f.gptr() == L'1');
+        assert(f.egptr() - f.eback() == 9);
+    }
+    {
+        test_buf<wchar_t> f;
+        assert(f.pubsetbuf(0, 0));
+        assert(f.open("underflow.dat", std::ios_base::in) != 0);
+        assert(f.is_open());
+        assert(f.eback() == 0);
+        assert(f.gptr() == 0);
+        assert(f.egptr() == 0);
+        assert(f.underflow() == L'1');
+        assert(f.eback() != 0);
+        assert(f.eback() == f.gptr());
+        assert(*f.gptr() == L'1');
+        assert(f.egptr() - f.eback() == 8);
+        f.gbump(8);
+        assert(f.sgetc() == L'9');
+        assert(f.eback()[0] == L'5');
+        assert(f.eback()[1] == L'6');
+        assert(f.eback()[2] == L'7');
+        assert(f.eback()[3] == L'8');
+        assert(f.gptr() - f.eback() == 4);
+        assert(*f.gptr() == L'9');
+        assert(f.egptr() - f.gptr() == 1);
+    }
+    {
+        test_buf<wchar_t> f;
+        f.pubimbue(std::locale(LOCALE_en_US_UTF_8));
+        assert(f.open("underflow_utf8.dat", std::ios_base::in) != 0);
+        assert(f.is_open());
+        assert(f.sbumpc() == 0x4E51);
+        assert(f.sbumpc() == 0x4E52);
+        assert(f.sbumpc() == 0x4E53);
+        assert(f.sbumpc() == -1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow_utf8.dat
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow_utf8.dat?rev=224658&view=auto
==============================================================================
Binary file - no diff available.

Propchange: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow_utf8.dat
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf/types.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/filebuf/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_filebuf
+//     : public basic_streambuf<charT, traits>
+// {
+// public:
+//     typedef charT                          char_type;
+//     typedef traits                         traits_type;
+//     typedef typename traits_type::int_type int_type;
+//     typedef typename traits_type::pos_type pos_type;
+//     typedef typename traits_type::off_type off_type;
+
+#include <fstream>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::basic_streambuf<char>, std::basic_filebuf<char> >::value), "");
+    static_assert((std::is_same<std::basic_filebuf<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::basic_filebuf<char>::traits_type, std::char_traits<char> >::value), "");
+    static_assert((std::is_same<std::basic_filebuf<char>::int_type, std::char_traits<char>::int_type>::value), "");
+    static_assert((std::is_same<std::basic_filebuf<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+    static_assert((std::is_same<std::basic_filebuf<char>::off_type, std::char_traits<char>::off_type>::value), "");
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.assign/member_swap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// void swap(basic_fstream& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp1 = get_temp_file_name();
+    std::string temp2 = get_temp_file_name();
+    {
+        std::fstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out
+                                                  | std::ios_base::trunc);
+        std::fstream fs2(temp2.c_str(), std::ios_base::in | std::ios_base::out
+                                                  | std::ios_base::trunc);
+        fs1 << 1 << ' ' << 2;
+        fs2 << 2 << ' ' << 1;
+        fs1.seekg(0);
+        fs1.swap(fs2);
+        fs1.seekg(0);
+        int i;
+        fs1 >> i;
+        assert(i == 2);
+        fs1 >> i;
+        assert(i == 1);
+        i = 0;
+        fs2 >> i;
+        assert(i == 1);
+        fs2 >> i;
+        assert(i == 2);
+    }
+    std::remove(temp1.c_str());
+    std::remove(temp2.c_str());
+    {
+        std::wfstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out
+                                                   | std::ios_base::trunc);
+        std::wfstream fs2(temp2.c_str(), std::ios_base::in | std::ios_base::out
+                                                   | std::ios_base::trunc);
+        fs1 << 1 << ' ' << 2;
+        fs2 << 2 << ' ' << 1;
+        fs1.seekg(0);
+        fs1.swap(fs2);
+        fs1.seekg(0);
+        int i;
+        fs1 >> i;
+        assert(i == 2);
+        fs1 >> i;
+        assert(i == 1);
+        i = 0;
+        fs2 >> i;
+        assert(i == 1);
+        fs2 >> i;
+        assert(i == 2);
+    }
+    std::remove(temp1.c_str());
+    std::remove(temp2.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// basic_fstream& operator=(basic_fstream&& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::string temp = get_temp_file_name();
+    {
+        std::fstream fso(temp.c_str(), std::ios_base::in | std::ios_base::out
+                                                 | std::ios_base::trunc);
+        std::fstream fs;
+        fs = move(fso);
+        double x = 0;
+        fs << 3.25;
+        fs.seekg(0);
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+    {
+        std::wfstream fso(temp.c_str(), std::ios_base::in | std::ios_base::out
+                                                  | std::ios_base::trunc);
+        std::wfstream fs;
+        fs = move(fso);
+        double x = 0;
+        fs << 3.25;
+        fs.seekg(0);
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// template <class charT, class traits>
+//   void swap(basic_fstream<charT, traits>& x, basic_fstream<charT, traits>& y);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp1 = get_temp_file_name();
+    std::string temp2 = get_temp_file_name();
+    {
+        std::fstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out
+                                                  | std::ios_base::trunc);
+        std::fstream fs2(temp2.c_str(), std::ios_base::in | std::ios_base::out
+                                                  | std::ios_base::trunc);
+        fs1 << 1 << ' ' << 2;
+        fs2 << 2 << ' ' << 1;
+        fs1.seekg(0);
+        swap(fs1, fs2);
+        fs1.seekg(0);
+        int i;
+        fs1 >> i;
+        assert(i == 2);
+        fs1 >> i;
+        assert(i == 1);
+        i = 0;
+        fs2 >> i;
+        assert(i == 1);
+        fs2 >> i;
+        assert(i == 2);
+    }
+    std::remove(temp1.c_str());
+    std::remove(temp2.c_str());
+    {
+        std::wfstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out
+                                                   | std::ios_base::trunc);
+        std::wfstream fs2(temp2.c_str(), std::ios_base::in | std::ios_base::out
+                                                   | std::ios_base::trunc);
+        fs1 << 1 << ' ' << 2;
+        fs2 << 2 << ' ' << 1;
+        fs1.seekg(0);
+        swap(fs1, fs2);
+        fs1.seekg(0);
+        int i;
+        fs1 >> i;
+        assert(i == 2);
+        fs1 >> i;
+        assert(i == 1);
+        i = 0;
+        fs2 >> i;
+        assert(i == 1);
+        fs2 >> i;
+        assert(i == 2);
+    }
+    std::remove(temp1.c_str());
+    std::remove(temp2.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.cons/default.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// basic_fstream();
+
+#include <fstream>
+#include <type_traits>
+
+int main()
+{
+    {
+        std::fstream fs;
+    }
+    {
+        std::wfstream fs;
+    }
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.cons/move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// basic_fstream(basic_fstream&& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::string temp = get_temp_file_name();
+    {
+        std::fstream fso(temp, std::ios_base::in | std::ios_base::out
+                                                 | std::ios_base::trunc);
+        std::fstream fs = move(fso);
+        double x = 0;
+        fs << 3.25;
+        fs.seekg(0);
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+    {
+        std::wfstream fso(temp, std::ios_base::in | std::ios_base::out
+                                                  | std::ios_base::trunc);
+        std::wfstream fs = move(fso);
+        double x = 0;
+        fs << 3.25;
+        fs.seekg(0);
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// explicit basic_fstream(const char* s, ios_base::openmode mode = ios_base::in | ios_base::out);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp = get_temp_file_name();
+    {
+        std::fstream fs(temp.c_str(), std::ios_base::in | std::ios_base::out
+                                                | std::ios_base::trunc);
+        double x = 0;
+        fs << 3.25;
+        fs.seekg(0);
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+    {
+        std::wfstream fs(temp.c_str(), std::ios_base::in | std::ios_base::out
+                                                 | std::ios_base::trunc);
+        double x = 0;
+        fs << 3.25;
+        fs.seekg(0);
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.cons/string.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// explicit basic_fstream(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp = get_temp_file_name();
+    {
+        std::fstream fs(temp,
+                        std::ios_base::in | std::ios_base::out
+                                          | std::ios_base::trunc);
+        double x = 0;
+        fs << 3.25;
+        fs.seekg(0);
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+    {
+        std::wfstream fs(temp,
+                         std::ios_base::in | std::ios_base::out
+                                           | std::ios_base::trunc);
+        double x = 0;
+        fs << 3.25;
+        fs.seekg(0);
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.members/close.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.members/close.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.members/close.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.members/close.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// void close();
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp = get_temp_file_name();
+    {
+        std::fstream fs;
+        assert(!fs.is_open());
+        fs.open(temp.c_str(), std::ios_base::out);
+        assert(fs.is_open());
+        fs.close();
+        assert(!fs.is_open());
+    }
+    std::remove(temp.c_str());
+    {
+        std::wfstream fs;
+        assert(!fs.is_open());
+        fs.open(temp.c_str(), std::ios_base::out);
+        assert(fs.is_open());
+        fs.close();
+        assert(!fs.is_open());
+    }
+    std::remove(temp.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// void open(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp = get_temp_file_name();
+    {
+        std::fstream fs;
+        assert(!fs.is_open());
+        fs.open(temp.c_str(), std::ios_base::in | std::ios_base::out
+                                        | std::ios_base::trunc);
+        assert(fs.is_open());
+        double x = 0;
+        fs << 3.25;
+        fs.seekg(0);
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+    {
+        std::wfstream fs;
+        assert(!fs.is_open());
+        fs.open(temp.c_str(), std::ios_base::in | std::ios_base::out
+                                        | std::ios_base::trunc);
+        assert(fs.is_open());
+        double x = 0;
+        fs << 3.25;
+        fs.seekg(0);
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.members/open_string.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// void open(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp = get_temp_file_name();
+    {
+        std::fstream fs;
+        assert(!fs.is_open());
+        fs.open(temp, std::ios_base::in | std::ios_base::out
+                                                     | std::ios_base::trunc);
+        assert(fs.is_open());
+        double x = 0;
+        fs << 3.25;
+        fs.seekg(0);
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+    {
+        std::wfstream fs;
+        assert(!fs.is_open());
+        fs.open(temp, std::ios_base::in | std::ios_base::out
+                                                     | std::ios_base::trunc);
+        assert(fs.is_open());
+        double x = 0;
+        fs << 3.25;
+        fs.seekg(0);
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.members/rdbuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.members/rdbuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.members/rdbuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream.members/rdbuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// basic_filebuf<charT,traits>* rdbuf() const;
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::fstream fs;
+        assert(fs.rdbuf());
+    }
+    {
+        std::wfstream fs;
+        assert(fs.rdbuf());
+    }
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream/types.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/fstream/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+//     : public basic_iostream<charT,traits>
+// {
+// public:
+//     typedef charT                          char_type;
+//     typedef traits                         traits_type;
+//     typedef typename traits_type::int_type int_type;
+//     typedef typename traits_type::pos_type pos_type;
+//     typedef typename traits_type::off_type off_type;
+
+#include <fstream>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::basic_iostream<char>, std::basic_fstream<char> >::value), "");
+    static_assert((std::is_same<std::basic_fstream<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::basic_fstream<char>::traits_type, std::char_traits<char> >::value), "");
+    static_assert((std::is_same<std::basic_fstream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+    static_assert((std::is_same<std::basic_fstream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+    static_assert((std::is_same<std::basic_fstream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/member_swap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// void swap(basic_ifstream& rhs);
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ifstream fs1("test.dat");
+        std::ifstream fs2("test2.dat");
+        fs1.swap(fs2);
+        double x = 0;
+        fs1 >> x;
+        assert(x == 4.5);
+        fs2 >> x;
+        assert(x == 3.25);
+    }
+    {
+        std::wifstream fs1("test.dat");
+        std::wifstream fs2("test2.dat");
+        fs1.swap(fs2);
+        double x = 0;
+        fs1 >> x;
+        assert(x == 4.5);
+        fs2 >> x;
+        assert(x == 3.25);
+    }
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// basic_ifstream& operator=(basic_ifstream&& rhs);
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        std::ifstream fso("test.dat");
+        std::ifstream fs;
+        fs = move(fso);
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+    {
+        std::wifstream fso("test.dat");
+        std::wifstream fs;
+        fs = move(fso);
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/nonmember_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/nonmember_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/nonmember_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/nonmember_swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// template <class charT, class traits>
+//   void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ifstream fs1("test.dat");
+        std::ifstream fs2("test2.dat");
+        swap(fs1, fs2);
+        double x = 0;
+        fs1 >> x;
+        assert(x == 4.5);
+        fs2 >> x;
+        assert(x == 3.25);
+    }
+    {
+        std::wifstream fs1("test.dat");
+        std::wifstream fs2("test2.dat");
+        swap(fs1, fs2);
+        double x = 0;
+        fs1 >> x;
+        assert(x == 4.5);
+        fs2 >> x;
+        assert(x == 3.25);
+    }
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/test.dat
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/test.dat?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/test.dat (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/test.dat Fri Dec 19 19:40:03 2014
@@ -0,0 +1 @@
+3.25
\ No newline at end of file

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/test2.dat
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/test2.dat?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/test2.dat (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.assign/test2.dat Fri Dec 19 19:40:03 2014
@@ -0,0 +1 @@
+4.5
\ No newline at end of file

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/default.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// basic_ifstream();
+
+#include <fstream>
+#include <type_traits>
+
+int main()
+{
+    {
+        std::ifstream fs;
+    }
+    {
+        std::wifstream fs;
+    }
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// basic_ifstream(basic_ifstream&& rhs);
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        std::ifstream fso("test.dat");
+        std::ifstream fs = move(fso);
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+    {
+        std::wifstream fso("test.dat");
+        std::wifstream fs = move(fso);
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// explicit basic_ifstream(const char* s, ios_base::openmode mode = ios_base::in);
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ifstream fs("test.dat");
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+    {
+        std::ifstream fs("test.dat", std::ios_base::out);
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+    {
+        std::wifstream fs("test.dat");
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+    {
+        std::wifstream fs("test.dat", std::ios_base::out);
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/string.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// explicit basic_ifstream(const string& s, ios_base::openmode mode = ios_base::in);
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ifstream fs(std::string("test.dat"));
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+    {
+        std::ifstream fs(std::string("test.dat"), std::ios_base::out);
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+    {
+        std::wifstream fs(std::string("test.dat"));
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+    {
+        std::wifstream fs(std::string("test.dat"), std::ios_base::out);
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/test.dat
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/test.dat?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/test.dat (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.cons/test.dat Fri Dec 19 19:40:03 2014
@@ -0,0 +1 @@
+3.25
\ No newline at end of file

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/close.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/close.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/close.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/close.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// void close();
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ifstream fs;
+        assert(!fs.is_open());
+        fs.open("test.dat");
+        assert(fs.is_open());
+        fs.close();
+        assert(!fs.is_open());
+    }
+    {
+        std::wifstream fs;
+        assert(!fs.is_open());
+        fs.open("test.dat");
+        assert(fs.is_open());
+        fs.close();
+        assert(!fs.is_open());
+    }
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/open_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/open_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/open_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/open_pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// void open(const char* s, ios_base::openmode mode = ios_base::in);
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ifstream fs;
+        assert(!fs.is_open());
+        char c = 'a';
+        fs >> c;
+        assert(fs.fail());
+        assert(c == 'a');
+        fs.open("test.dat");
+        assert(fs.is_open());
+        fs >> c;
+        assert(c == 'r');
+    }
+    {
+        std::wifstream fs;
+        assert(!fs.is_open());
+        wchar_t c = L'a';
+        fs >> c;
+        assert(fs.fail());
+        assert(c == L'a');
+        fs.open("test.dat");
+        assert(fs.is_open());
+        fs >> c;
+        assert(c == L'r');
+    }
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/open_string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/open_string.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/open_string.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/open_string.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// void open(const string& s, ios_base::openmode mode = ios_base::in);
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ifstream fs;
+        assert(!fs.is_open());
+        char c = 'a';
+        fs >> c;
+        assert(fs.fail());
+        assert(c == 'a');
+        fs.open(std::string("test.dat"));
+        assert(fs.is_open());
+        fs >> c;
+        assert(c == 'r');
+    }
+    {
+        std::wifstream fs;
+        assert(!fs.is_open());
+        wchar_t c = L'a';
+        fs >> c;
+        assert(fs.fail());
+        assert(c == L'a');
+        fs.open(std::string("test.dat"));
+        assert(fs.is_open());
+        fs >> c;
+        assert(c == L'r');
+    }
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/rdbuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/rdbuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/rdbuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/rdbuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// basic_filebuf<charT,traits>* rdbuf() const;
+
+#include <fstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ifstream fs("test.dat");
+        std::filebuf* fb = fs.rdbuf();
+        assert(fb->sgetc() == 'r');
+    }
+    {
+        std::wifstream fs("test.dat");
+        std::wfilebuf* fb = fs.rdbuf();
+        assert(fb->sgetc() == L'r');
+    }
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/test.dat
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/test.dat?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/test.dat (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream.members/test.dat Fri Dec 19 19:40:03 2014
@@ -0,0 +1 @@
+r
\ No newline at end of file

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream/types.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ifstream/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+//     : public basic_istream<charT,traits>
+// {
+// public:
+//     typedef charT                          char_type;
+//     typedef traits                         traits_type;
+//     typedef typename traits_type::int_type int_type;
+//     typedef typename traits_type::pos_type pos_type;
+//     typedef typename traits_type::off_type off_type;
+
+#include <fstream>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::basic_istream<char>, std::basic_ifstream<char> >::value), "");
+    static_assert((std::is_same<std::basic_ifstream<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::basic_ifstream<char>::traits_type, std::char_traits<char> >::value), "");
+    static_assert((std::is_same<std::basic_ifstream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+    static_assert((std::is_same<std::basic_ifstream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+    static_assert((std::is_same<std::basic_ifstream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.assign/member_swap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// void swap(basic_ofstream& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp1 = get_temp_file_name();
+    std::string temp2 = get_temp_file_name();
+    {
+        std::ofstream fs1(temp1.c_str());
+        std::ofstream fs2(temp2.c_str());
+        fs1 << 3.25;
+        fs2 << 4.5;
+        fs1.swap(fs2);
+        fs1 << ' ' << 3.25;
+        fs2 << ' ' << 4.5;
+    }
+    {
+        std::ifstream fs(temp1.c_str());
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+        fs >> x;
+        assert(x == 4.5);
+    }
+    std::remove(temp1.c_str());
+    {
+        std::ifstream fs(temp2.c_str());
+        double x = 0;
+        fs >> x;
+        assert(x == 4.5);
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp2.c_str());
+    {
+        std::wofstream fs1(temp1.c_str());
+        std::wofstream fs2(temp2.c_str());
+        fs1 << 3.25;
+        fs2 << 4.5;
+        fs1.swap(fs2);
+        fs1 << ' ' << 3.25;
+        fs2 << ' ' << 4.5;
+    }
+    {
+        std::wifstream fs(temp1.c_str());
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+        fs >> x;
+        assert(x == 4.5);
+    }
+    std::remove(temp1.c_str());
+    {
+        std::wifstream fs(temp2.c_str());
+        double x = 0;
+        fs >> x;
+        assert(x == 4.5);
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp2.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// basic_ofstream& operator=(basic_ofstream&& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::string temp = get_temp_file_name();
+    {
+        std::ofstream fso(temp.c_str());
+        std::ofstream fs;
+        fs = move(fso);
+        fs << 3.25;
+    }
+    {
+        std::ifstream fs(temp.c_str());
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+    {
+        std::wofstream fso(temp.c_str());
+        std::wofstream fs;
+        fs = move(fso);
+        fs << 3.25;
+    }
+    {
+        std::wifstream fs(temp.c_str());
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// template <class charT, class traits>
+//   void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp1 = get_temp_file_name();
+    std::string temp2 = get_temp_file_name();
+    {
+        std::ofstream fs1(temp1.c_str());
+        std::ofstream fs2(temp2.c_str());
+        fs1 << 3.25;
+        fs2 << 4.5;
+        swap(fs1, fs2);
+        fs1 << ' ' << 3.25;
+        fs2 << ' ' << 4.5;
+    }
+    {
+        std::ifstream fs(temp1.c_str());
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+        fs >> x;
+        assert(x == 4.5);
+    }
+    std::remove(temp1.c_str());
+    {
+        std::ifstream fs(temp2.c_str());
+        double x = 0;
+        fs >> x;
+        assert(x == 4.5);
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp2.c_str());
+    {
+        std::wofstream fs1(temp1.c_str());
+        std::wofstream fs2(temp2.c_str());
+        fs1 << 3.25;
+        fs2 << 4.5;
+        swap(fs1, fs2);
+        fs1 << ' ' << 3.25;
+        fs2 << ' ' << 4.5;
+    }
+    {
+        std::wifstream fs(temp1.c_str());
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+        fs >> x;
+        assert(x == 4.5);
+    }
+    std::remove(temp1.c_str());
+    {
+        std::wifstream fs(temp2.c_str());
+        double x = 0;
+        fs >> x;
+        assert(x == 4.5);
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp2.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.cons/default.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// basic_ofstream();
+
+#include <fstream>
+#include <type_traits>
+
+int main()
+{
+    {
+        std::ofstream fs;
+    }
+    {
+        std::wofstream fs;
+    }
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.cons/move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// basic_ofstream(basic_ofstream&& rhs);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::string temp = get_temp_file_name();
+    {
+        std::ofstream fso(temp.c_str());
+        std::ofstream fs = move(fso);
+        fs << 3.25;
+    }
+    {
+        std::ifstream fs(temp.c_str());
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+    {
+        std::wofstream fso(temp.c_str());
+        std::wofstream fs = move(fso);
+        fs << 3.25;
+    }
+    {
+        std::wifstream fs(temp.c_str());
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// explicit basic_ofstream(const char* s, ios_base::openmode mode = ios_base::out);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp = get_temp_file_name();
+    {
+        std::ofstream fs(temp.c_str());
+        fs << 3.25;
+    }
+    {
+        std::ifstream fs(temp.c_str());
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+    {
+        std::wofstream fs(temp.c_str());
+        fs << 3.25;
+    }
+    {
+        std::wifstream fs(temp.c_str());
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.cons/string.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// explicit basic_ofstream(const string& s, ios_base::openmode mode = ios_base::out);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp = get_temp_file_name();
+    {
+        std::ofstream fs(temp);
+        fs << 3.25;
+    }
+    {
+        std::ifstream fs(temp);
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+    {
+        std::wofstream fs(temp);
+        fs << 3.25;
+    }
+    {
+        std::wifstream fs(temp);
+        double x = 0;
+        fs >> x;
+        assert(x == 3.25);
+    }
+    std::remove(temp.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.members/close.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// void close();
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp = get_temp_file_name();
+    {
+        std::ofstream fs;
+        assert(!fs.is_open());
+        fs.open(temp.c_str());
+        assert(fs.is_open());
+        fs.close();
+        assert(!fs.is_open());
+    }
+    std::remove(temp.c_str());
+    {
+        std::wofstream fs;
+        assert(!fs.is_open());
+        fs.open(temp.c_str());
+        assert(fs.is_open());
+        fs.close();
+        assert(!fs.is_open());
+    }
+    std::remove(temp.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// void open(const char* s, ios_base::openmode mode = ios_base::out);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp = get_temp_file_name();
+    {
+        std::ofstream fs;
+        assert(!fs.is_open());
+        char c = 'a';
+        fs << c;
+        assert(fs.fail());
+        fs.open(temp.c_str());
+        assert(fs.is_open());
+        fs << c;
+    }
+    {
+        std::ifstream fs(temp.c_str());
+        char c = 0;
+        fs >> c;
+        assert(c == 'a');
+    }
+    std::remove(temp.c_str());
+    {
+        std::wofstream fs;
+        assert(!fs.is_open());
+        wchar_t c = L'a';
+        fs << c;
+        assert(fs.fail());
+        fs.open(temp.c_str());
+        assert(fs.is_open());
+        fs << c;
+    }
+    {
+        std::wifstream fs(temp.c_str());
+        wchar_t c = 0;
+        fs >> c;
+        assert(c == L'a');
+    }
+    std::remove(temp.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.members/open_string.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// void open(const string& s, ios_base::openmode mode = ios_base::out);
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp = get_temp_file_name();
+    {
+        std::ofstream fs;
+        assert(!fs.is_open());
+        char c = 'a';
+        fs << c;
+        assert(fs.fail());
+        fs.open(temp);
+        assert(fs.is_open());
+        fs << c;
+    }
+    {
+        std::ifstream fs(temp.c_str());
+        char c = 0;
+        fs >> c;
+        assert(c == 'a');
+    }
+    std::remove(temp.c_str());
+    {
+        std::wofstream fs;
+        assert(!fs.is_open());
+        wchar_t c = L'a';
+        fs << c;
+        assert(fs.fail());
+        fs.open(temp);
+        assert(fs.is_open());
+        fs << c;
+    }
+    {
+        std::wifstream fs(temp.c_str());
+        wchar_t c = 0;
+        fs >> c;
+        assert(c == L'a');
+    }
+    std::remove(temp.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream.members/rdbuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// basic_filebuf<charT,traits>* rdbuf() const;
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+    std::string temp = get_temp_file_name();
+    {
+        std::ofstream fs(temp.c_str());
+        std::filebuf* fb = fs.rdbuf();
+        assert(fb->sputc('r') == 'r');
+    }
+    std::remove(temp.c_str());
+    {
+        std::wofstream fs(temp.c_str());
+        std::wfilebuf* fb = fs.rdbuf();
+        assert(fb->sputc(L'r') == L'r');
+    }
+    std::remove(temp.c_str());
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream/types.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/ofstream/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+//     : public basic_ostream<charT,traits>
+// {
+// public:
+//     typedef charT                          char_type;
+//     typedef traits                         traits_type;
+//     typedef typename traits_type::int_type int_type;
+//     typedef typename traits_type::pos_type pos_type;
+//     typedef typename traits_type::off_type off_type;
+
+#include <fstream>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::basic_ostream<char>, std::basic_ofstream<char> >::value), "");
+    static_assert((std::is_same<std::basic_ofstream<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::basic_ofstream<char>::traits_type, std::char_traits<char> >::value), "");
+    static_assert((std::is_same<std::basic_ofstream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+    static_assert((std::is_same<std::basic_ofstream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+    static_assert((std::is_same<std::basic_ofstream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+}

Added: libcxx/trunk/test/std/input.output/file.streams/fstreams/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/fstreams/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/fstreams/version.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/fstreams/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+#include <fstream>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/input.output/file.streams/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/file.streams/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/file.streams/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/input.output/input.output.general/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/input.output.general/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/input.output.general/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/input.output.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/input.output/iostream.format/ext.manip/get_money.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_money.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_money.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_money.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// template <class moneyT> T7 get_money(moneyT& mon, bool intl = false);
+
+// REQUIRES: locale.en_US.UTF-8
+
+#include <iomanip>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("  -$1,234,567.89");
+        std::istream is(&sb);
+        is.imbue(std::locale(LOCALE_en_US_UTF_8));
+        long double x = 0;
+        is >> std::get_money(x, false);
+        assert(x == -123456789);
+    }
+    {
+        testbuf<char> sb("  -USD 1,234,567.89");
+        std::istream is(&sb);
+        is.imbue(std::locale(LOCALE_en_US_UTF_8));
+        long double x = 0;
+        is >> std::get_money(x, true);
+        assert(x == -123456789);
+    }
+    {
+        testbuf<wchar_t> sb(L"  -$1,234,567.89");
+        std::wistream is(&sb);
+        is.imbue(std::locale(LOCALE_en_US_UTF_8));
+        long double x = 0;
+        is >> std::get_money(x, false);
+        assert(x == -123456789);
+    }
+    {
+        testbuf<wchar_t> sb(L"  -USD 1,234,567.89");
+        std::wistream is(&sb);
+        is.imbue(std::locale(LOCALE_en_US_UTF_8));
+        long double x = 0;
+        is >> std::get_money(x, true);
+        assert(x == -123456789);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/ext.manip/get_time.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// template <class charT> T9 get_time(struct tm* tmb, const charT* fmt);
+
+#include <iomanip>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("  Sat Dec 31 23:55:59 2061");
+        std::istream is(&sb);
+        is.imbue(std::locale(LOCALE_en_US_UTF_8));
+        std::tm t = {0};
+        is >> std::get_time(&t, "%a %b %d %H:%M:%S %Y");
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(t.tm_mday == 31);
+        assert(t.tm_mon == 11);
+        assert(t.tm_year == 161);
+        assert(t.tm_wday == 6);
+        assert(is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L"  Sat Dec 31 23:55:59 2061");
+        std::wistream is(&sb);
+        is.imbue(std::locale(LOCALE_en_US_UTF_8));
+        std::tm t = {0};
+        is >> std::get_time(&t, L"%a %b %d %H:%M:%S %Y");
+        assert(t.tm_sec == 59);
+        assert(t.tm_min == 55);
+        assert(t.tm_hour == 23);
+        assert(t.tm_mday == 31);
+        assert(t.tm_mon == 11);
+        assert(t.tm_year == 161);
+        assert(t.tm_wday == 6);
+        assert(is.eof());
+        assert(!is.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/ext.manip/put_money.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// template <class charT, class moneyT> T8 put_money(const moneyT& mon, bool intl = false);
+
+// REQUIRES: locale.en_US.UTF-8
+
+#include <iomanip>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os.imbue(std::locale(LOCALE_en_US_UTF_8));
+        showbase(os);
+        long double x = -123456789;
+        os << std::put_money(x, false);
+        assert(sb.str() == "-$1,234,567.89");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os.imbue(std::locale(LOCALE_en_US_UTF_8));
+        showbase(os);
+        long double x = -123456789;
+        os << std::put_money(x, true);
+        assert(sb.str() == "-USD 1,234,567.89");
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        os.imbue(std::locale(LOCALE_en_US_UTF_8));
+        showbase(os);
+        long double x = -123456789;
+        os << std::put_money(x, false);
+        assert(sb.str() == L"-$1,234,567.89");
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        os.imbue(std::locale(LOCALE_en_US_UTF_8));
+        showbase(os);
+        long double x = -123456789;
+        os << std::put_money(x, true);
+        assert(sb.str() == L"-USD 1,234,567.89");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// template <class charT> T10 put_time(const struct tm* tmb, const charT* fmt);
+
+#include <iomanip>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os.imbue(std::locale(LOCALE_en_US_UTF_8));
+        std::tm t = {0};
+        t.tm_sec = 59;
+        t.tm_min = 55;
+        t.tm_hour = 23;
+        t.tm_mday = 31;
+        t.tm_mon = 11;
+        t.tm_year = 161;
+        t.tm_wday = 6;
+        t.tm_isdst = 0;
+        os << std::put_time(&t, "%a %b %d %H:%M:%S %Y");
+        assert(sb.str() == "Sat Dec 31 23:55:59 2061");
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        os.imbue(std::locale(LOCALE_en_US_UTF_8));
+        std::tm t = {0};
+        t.tm_sec = 59;
+        t.tm_min = 55;
+        t.tm_hour = 23;
+        t.tm_mday = 31;
+        t.tm_mon = 11;
+        t.tm_year = 161;
+        t.tm_wday = 6;
+        os << std::put_time(&t, L"%a %b %d %H:%M:%S %Y");
+        assert(sb.str() == L"Sat Dec 31 23:55:59 2061");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/member_swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_iostream;
+
+// void swap(basic_iostream& rhs);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+template <class CharT>
+struct test_iostream
+    : public std::basic_iostream<CharT>
+{
+    typedef std::basic_iostream<CharT> base;
+    test_iostream(testbuf<CharT>* sb) : base(sb) {}
+
+    void swap(test_iostream& s) {base::swap(s);}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb1;
+        testbuf<char> sb2;
+        test_iostream<char> is1(&sb1);
+        test_iostream<char> is2(&sb2);
+        is1.swap(is2);
+        assert(is1.rdbuf() == &sb1);
+        assert(is1.tie() == 0);
+        assert(is1.fill() == ' ');
+        assert(is1.rdstate() == is1.goodbit);
+        assert(is1.exceptions() == is1.goodbit);
+        assert(is1.flags() == (is1.skipws | is1.dec));
+        assert(is1.precision() == 6);
+        assert(is1.getloc().name() == "C");
+        assert(is2.rdbuf() == &sb2);
+        assert(is2.tie() == 0);
+        assert(is2.fill() == ' ');
+        assert(is2.rdstate() == is2.goodbit);
+        assert(is2.exceptions() == is2.goodbit);
+        assert(is2.flags() == (is2.skipws | is2.dec));
+        assert(is2.precision() == 6);
+        assert(is2.getloc().name() == "C");
+    }
+    {
+        testbuf<wchar_t> sb1;
+        testbuf<wchar_t> sb2;
+        test_iostream<wchar_t> is1(&sb1);
+        test_iostream<wchar_t> is2(&sb2);
+        is1.swap(is2);
+        assert(is1.rdbuf() == &sb1);
+        assert(is1.tie() == 0);
+        assert(is1.fill() == ' ');
+        assert(is1.rdstate() == is1.goodbit);
+        assert(is1.exceptions() == is1.goodbit);
+        assert(is1.flags() == (is1.skipws | is1.dec));
+        assert(is1.precision() == 6);
+        assert(is1.getloc().name() == "C");
+        assert(is2.rdbuf() == &sb2);
+        assert(is2.tie() == 0);
+        assert(is2.fill() == ' ');
+        assert(is2.rdstate() == is2.goodbit);
+        assert(is2.exceptions() == is2.goodbit);
+        assert(is2.flags() == (is2.skipws | is2.dec));
+        assert(is2.precision() == 6);
+        assert(is2.getloc().name() == "C");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_iostream;
+
+// basic_iostream& operator=(basic_iostream&& rhs);
+
+#include <istream>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+template <class CharT>
+struct test_iostream
+    : public std::basic_iostream<CharT>
+{
+    typedef std::basic_iostream<CharT> base;
+    test_iostream(testbuf<CharT>* sb) : base(sb) {}
+
+    test_iostream& operator=(test_iostream&& s)
+        {base::operator=(std::move(s)); return *this;}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        testbuf<char> sb1;
+        testbuf<char> sb2;
+        test_iostream<char> is1(&sb1);
+        test_iostream<char> is2(&sb2);
+        is2 = (std::move(is1));
+        assert(is1.rdbuf() == &sb1);
+        assert(is1.tie() == 0);
+        assert(is1.fill() == ' ');
+        assert(is1.rdstate() == is1.goodbit);
+        assert(is1.exceptions() == is1.goodbit);
+        assert(is1.flags() == (is1.skipws | is1.dec));
+        assert(is1.precision() == 6);
+        assert(is1.getloc().name() == "C");
+        assert(is2.rdbuf() == &sb2);
+        assert(is2.tie() == 0);
+        assert(is2.fill() == ' ');
+        assert(is2.rdstate() == is2.goodbit);
+        assert(is2.exceptions() == is2.goodbit);
+        assert(is2.flags() == (is2.skipws | is2.dec));
+        assert(is2.precision() == 6);
+        assert(is2.getloc().name() == "C");
+    }
+    {
+        testbuf<wchar_t> sb1;
+        testbuf<wchar_t> sb2;
+        test_iostream<wchar_t> is1(&sb1);
+        test_iostream<wchar_t> is2(&sb2);
+        is2 = (std::move(is1));
+        assert(is1.rdbuf() == &sb1);
+        assert(is1.tie() == 0);
+        assert(is1.fill() == ' ');
+        assert(is1.rdstate() == is1.goodbit);
+        assert(is1.exceptions() == is1.goodbit);
+        assert(is1.flags() == (is1.skipws | is1.dec));
+        assert(is1.precision() == 6);
+        assert(is1.getloc().name() == "C");
+        assert(is2.rdbuf() == &sb2);
+        assert(is2.tie() == 0);
+        assert(is2.fill() == ' ');
+        assert(is2.rdstate() == is2.goodbit);
+        assert(is2.exceptions() == is2.goodbit);
+        assert(is2.flags() == (is2.skipws | is2.dec));
+        assert(is2.precision() == 6);
+        assert(is2.getloc().name() == "C");
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_iostream;
+
+// basic_iostream(basic_iostream&& rhs);
+
+#include <istream>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+template <class CharT>
+struct test_iostream
+    : public std::basic_iostream<CharT>
+{
+    typedef std::basic_iostream<CharT> base;
+    test_iostream(testbuf<CharT>* sb) : base(sb) {}
+
+    test_iostream(test_iostream&& s)
+        : base(std::move(s)) {}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        testbuf<char> sb;
+        test_iostream<char> is1(&sb);
+        test_iostream<char> is(std::move(is1));
+        assert(is1.rdbuf() == &sb);
+        assert(is1.gcount() == 0);
+        assert(is.gcount() == 0);
+        assert(is.rdbuf() == 0);
+        assert(is.tie() == 0);
+        assert(is.fill() == ' ');
+        assert(is.rdstate() == is.goodbit);
+        assert(is.exceptions() == is.goodbit);
+        assert(is.flags() == (is.skipws | is.dec));
+        assert(is.precision() == 6);
+        assert(is.getloc().name() == "C");
+    }
+    {
+        testbuf<wchar_t> sb;
+        test_iostream<wchar_t> is1(&sb);
+        test_iostream<wchar_t> is(std::move(is1));
+        assert(is1.gcount() == 0);
+        assert(is.gcount() == 0);
+        assert(is1.rdbuf() == &sb);
+        assert(is.rdbuf() == 0);
+        assert(is.tie() == 0);
+        assert(is.fill() == L' ');
+        assert(is.rdstate() == is.goodbit);
+        assert(is.exceptions() == is.goodbit);
+        assert(is.flags() == (is.skipws | is.dec));
+        assert(is.precision() == 6);
+        assert(is.getloc().name() == "C");
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/streambuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/streambuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/streambuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/streambuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_iostream;
+
+// explicit basic_iostream(basic_streambuf<charT,traits>* sb);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::basic_iostream<char> is(&sb);
+        assert(is.rdbuf() == &sb);
+        assert(is.tie() == 0);
+        assert(is.fill() == ' ');
+        assert(is.rdstate() == is.goodbit);
+        assert(is.exceptions() == is.goodbit);
+        assert(is.flags() == (is.skipws | is.dec));
+        assert(is.precision() == 6);
+        assert(is.getloc().name() == "C");
+        assert(is.gcount() == 0);
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::basic_iostream<wchar_t> is(&sb);
+        assert(is.rdbuf() == &sb);
+        assert(is.tie() == 0);
+        assert(is.fill() == L' ');
+        assert(is.rdstate() == is.goodbit);
+        assert(is.exceptions() == is.goodbit);
+        assert(is.flags() == (is.skipws | is.dec));
+        assert(is.precision() == 6);
+        assert(is.getloc().name() == "C");
+        assert(is.gcount() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.dest/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.dest/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.dest/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.dest/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/input.output/iostream.format/input.streams/iostreamclass/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/types.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/iostreamclass/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_iostream :
+//     public basic_istream<charT,traits>,
+//     public basic_ostream<charT,traits>
+// {
+// public:
+//     // types:
+//     typedef charT                          char_type;
+//     typedef traits                         traits_type;
+//     typedef typename traits_type::int_type int_type;
+//     typedef typename traits_type::pos_type pos_type;
+//     typedef typename traits_type::off_type off_type;
+
+#include <istream>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::basic_istream<char>, std::basic_iostream<char> >::value), "");
+    static_assert((std::is_base_of<std::basic_ostream<char>, std::basic_iostream<char> >::value), "");
+    static_assert((std::is_same<std::basic_iostream<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::basic_iostream<char>::traits_type, std::char_traits<char> >::value), "");
+    static_assert((std::is_same<std::basic_iostream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+    static_assert((std::is_same<std::basic_iostream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+    static_assert((std::is_same<std::basic_iostream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// operator>>(bool& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        std::istream is((std::streambuf*)0);
+        bool n = 0;
+        is >> n;
+        assert(is.fail());
+    }
+    {
+        testbuf<char> sb("0");
+        std::istream is(&sb);
+        bool n = true;
+        is >> n;
+        assert(n == false);
+        assert( is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<char> sb(" 1 ");
+        std::istream is(&sb);
+        bool n = 0;
+        is >> n;
+        assert(n == true);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L" 1 ");
+        std::wistream is(&sb);
+        bool n = 0;
+        is >> n;
+        assert(n == true);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// operator>>(double& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        std::istream is((std::streambuf*)0);
+        double n = 0;
+        is >> n;
+        assert(is.fail());
+    }
+    {
+        testbuf<char> sb("0");
+        std::istream is(&sb);
+        double n = 10;
+        is >> n;
+        assert(n == 0);
+        assert( is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<char> sb(" 123 ");
+        std::istream is(&sb);
+        double n = 10;
+        is >> n;
+        assert(n == 123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L" -123.5 ");
+        std::wistream is(&sb);
+        double n = 10;
+        is >> n;
+        assert(n == -123.5);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// operator>>(float& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        std::istream is((std::streambuf*)0);
+        float n = 0;
+        is >> n;
+        assert(is.fail());
+    }
+    {
+        testbuf<char> sb("0");
+        std::istream is(&sb);
+        float n = 10;
+        is >> n;
+        assert(n == 0);
+        assert( is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<char> sb(" 123 ");
+        std::istream is(&sb);
+        float n = 10;
+        is >> n;
+        assert(n == 123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L" -123.5 ");
+        std::wistream is(&sb);
+        float n = 10;
+        is >> n;
+        assert(n == -123.5);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// operator>>(int& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        std::istream is((std::streambuf*)0);
+        int n = 0;
+        is >> n;
+        assert(is.fail());
+    }
+    {
+        testbuf<char> sb("0");
+        std::istream is(&sb);
+        int n = 10;
+        is >> n;
+        assert(n == 0);
+        assert( is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<char> sb(" 123 ");
+        std::istream is(&sb);
+        int n = 10;
+        is >> n;
+        assert(n == 123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L" -1234567890123456 ");
+        std::wistream is(&sb);
+        int n = 10;
+        is >> n;
+        assert(n == std::numeric_limits<int>::min());
+        assert(!is.eof());
+        assert( is.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// operator>>(long& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        std::istream is((std::streambuf*)0);
+        long n = 0;
+        is >> n;
+        assert(is.fail());
+    }
+    {
+        testbuf<char> sb("0");
+        std::istream is(&sb);
+        long n = 10;
+        is >> n;
+        assert(n == 0);
+        assert( is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<char> sb(" 123 ");
+        std::istream is(&sb);
+        long n = 10;
+        is >> n;
+        assert(n == 123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L" -123 ");
+        std::wistream is(&sb);
+        long n = 10;
+        is >> n;
+        assert(n == -123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// operator>>(long double& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        std::istream is((std::streambuf*)0);
+        long double n = 0;
+        is >> n;
+        assert(is.fail());
+    }
+    {
+        testbuf<char> sb("0");
+        std::istream is(&sb);
+        long double n = 10;
+        is >> n;
+        assert(n == 0);
+        assert( is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<char> sb(" 123 ");
+        std::istream is(&sb);
+        long double n = 10;
+        is >> n;
+        assert(n == 123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L" -123.5 ");
+        std::wistream is(&sb);
+        long double n = 10;
+        is >> n;
+        assert(n == -123.5);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// operator>>(long long& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        std::istream is((std::streambuf*)0);
+        long long n = 0;
+        is >> n;
+        assert(is.fail());
+    }
+    {
+        testbuf<char> sb("0");
+        std::istream is(&sb);
+        long long n = 10;
+        is >> n;
+        assert(n == 0);
+        assert( is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<char> sb(" 123 ");
+        std::istream is(&sb);
+        long long n = 10;
+        is >> n;
+        assert(n == 123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L" -123 ");
+        std::wistream is(&sb);
+        long long n = 10;
+        is >> n;
+        assert(n == -123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// operator>>(void*& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        std::istream is((std::streambuf*)0);
+        void* n = 0;
+        is >> n;
+        assert(is.fail());
+    }
+    {
+        testbuf<char> sb("0");
+        std::istream is(&sb);
+        void* n = (void*)1;
+        is >> n;
+        assert(n == 0);
+        assert( is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<char> sb(" 1 ");
+        std::istream is(&sb);
+        void* n = 0;
+        is >> n;
+        assert(n == (void*)1);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L" 1 ");
+        std::wistream is(&sb);
+        void* n = 0;
+        is >> n;
+        assert(n == (void*)1);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<char> sb("12345678");
+        std::istream is(&sb);
+        void* n = 0;
+        is >> n;
+        assert(n == (void*)0x12345678);
+        assert( is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L"12345678");
+        std::wistream is(&sb);
+        void* n = 0;
+        is >> n;
+        assert(n == (void*)0x12345678);
+        assert( is.eof());
+        assert(!is.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// operator>>(short& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        std::istream is((std::streambuf*)0);
+        short n = 0;
+        is >> n;
+        assert(is.fail());
+    }
+    {
+        testbuf<char> sb("0");
+        std::istream is(&sb);
+        short n = 10;
+        is >> n;
+        assert(n == 0);
+        assert( is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<char> sb(" 123 ");
+        std::istream is(&sb);
+        short n = 10;
+        is >> n;
+        assert(n == 123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L" -1234567890 ");
+        std::wistream is(&sb);
+        short n = 10;
+        is >> n;
+        assert(n == std::numeric_limits<short>::min());
+        assert(!is.eof());
+        assert( is.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// operator>>(unsigned int& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        std::istream is((std::streambuf*)0);
+        unsigned int n = 0;
+        is >> n;
+        assert(is.fail());
+    }
+    {
+        testbuf<char> sb("0");
+        std::istream is(&sb);
+        unsigned int n = 10;
+        is >> n;
+        assert(n == 0);
+        assert( is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<char> sb(" 123 ");
+        std::istream is(&sb);
+        unsigned int n = 10;
+        is >> n;
+        assert(n == 123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L" 123 ");
+        std::wistream is(&sb);
+        unsigned int n = 10;
+        is >> n;
+        assert(n == 123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// operator>>(unsigned long& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        std::istream is((std::streambuf*)0);
+        unsigned long n = 0;
+        is >> n;
+        assert(is.fail());
+    }
+    {
+        testbuf<char> sb("0");
+        std::istream is(&sb);
+        unsigned long n = 10;
+        is >> n;
+        assert(n == 0);
+        assert( is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<char> sb(" 123 ");
+        std::istream is(&sb);
+        unsigned long n = 10;
+        is >> n;
+        assert(n == 123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L" 123 ");
+        std::wistream is(&sb);
+        unsigned long n = 10;
+        is >> n;
+        assert(n == 123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// operator>>(unsigned long long& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        std::istream is((std::streambuf*)0);
+        unsigned long long n = 0;
+        is >> n;
+        assert(is.fail());
+    }
+    {
+        testbuf<char> sb("0");
+        std::istream is(&sb);
+        unsigned long long n = 10;
+        is >> n;
+        assert(n == 0);
+        assert( is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<char> sb(" 123 ");
+        std::istream is(&sb);
+        unsigned long long n = 10;
+        is >> n;
+        assert(n == 123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L" 123 ");
+        std::wistream is(&sb);
+        unsigned long long n = 10;
+        is >> n;
+        assert(n == 123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// operator>>(unsigned short& val);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        std::istream is((std::streambuf*)0);
+        unsigned short n = 0;
+        is >> n;
+        assert(is.fail());
+    }
+    {
+        testbuf<char> sb("0");
+        std::istream is(&sb);
+        unsigned short n = 10;
+        is >> n;
+        assert(n == 0);
+        assert( is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<char> sb(" 123 ");
+        std::istream is(&sb);
+        unsigned short n = 10;
+        is >> n;
+        assert(n == 123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L" 123 ");
+        std::wistream is(&sb);
+        unsigned short n = 10;
+        is >> n;
+        assert(n == 123);
+        assert(!is.eof());
+        assert(!is.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.reqmts/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.reqmts/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.reqmts/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.reqmts/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/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/basic_ios.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/basic_ios.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/basic_ios.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/basic_ios.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// basic_istream<charT,traits>& operator>>(basic_ios<charT,traits>&
+//                                         (*pf)(basic_ios<charT,traits>&));
+
+#include <istream>
+#include <cassert>
+
+int f_called = 0;
+
+template <class CharT>
+std::basic_ios<CharT>&
+f(std::basic_ios<CharT>& is)
+{
+    ++f_called;
+    return is;
+}
+
+int main()
+{
+    {
+        std::istream is((std::streambuf*)0);
+        is >> f;
+        assert(f_called == 1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/chart.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/chart.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/chart.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/chart.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template<class charT, class traits>
+//   basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&& in, charT& c);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("          ");
+        std::istream is(&sb);
+        char c = 'z';
+        is >> c;
+        assert( is.eof());
+        assert( is.fail());
+        assert(c == 'z');
+    }
+    {
+        testbuf<char> sb("   abcdefghijk    ");
+        std::istream is(&sb);
+        char c;
+        is >> c;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == 'a');
+        is >> c;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == 'b');
+        is >> c;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == 'c');
+    }
+    {
+        testbuf<wchar_t> sb(L"   abc");
+        std::wistream is(&sb);
+        wchar_t c;
+        is >> c;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == L'a');
+        is >> c;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == L'b');
+        is >> c;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == L'c');
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/ios_base.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/ios_base.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/ios_base.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/ios_base.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// basic_istream<charT,traits>& operator>>(ios_base& (*pf)(ios_base&));
+
+#include <istream>
+#include <cassert>
+
+int f_called = 0;
+
+std::ios_base&
+f(std::ios_base& is)
+{
+    ++f_called;
+    return is;
+}
+
+int main()
+{
+    {
+        std::istream is((std::streambuf*)0);
+        is >> f;
+        assert(f_called == 1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/istream.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/istream.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/istream.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/istream.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&
+//                                         (*pf)(basic_istream<charT,traits>&));
+
+#include <istream>
+#include <cassert>
+
+int f_called = 0;
+
+template <class CharT>
+std::basic_istream<CharT>&
+f(std::basic_istream<CharT>& is)
+{
+    ++f_called;
+    return is;
+}
+
+int main()
+{
+    {
+        std::istream is((std::streambuf*)0);
+        is >> f;
+        assert(f_called == 1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template<class traits>
+//   basic_istream<char,traits>& operator>>(basic_istream<char,traits>&& in, signed char& c);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("          ");
+        std::istream is(&sb);
+        signed char c = 'z';
+        is >> c;
+        assert( is.eof());
+        assert( is.fail());
+        assert(c == 'z');
+    }
+    {
+        testbuf<char> sb("   abcdefghijk    ");
+        std::istream is(&sb);
+        signed char c;
+        is >> c;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == 'a');
+        is >> c;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == 'b');
+        is >> c;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == 'c');
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template<class traits>
+//   basic_istream<char,traits>& operator>>(basic_istream<char,traits>&& in, signed char* s);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("   abcdefghijk    ");
+        std::istream is(&sb);
+        signed char s[20];
+        is >> s;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string((char*)s) == "abcdefghijk");
+    }
+    {
+        testbuf<char> sb("   abcdefghijk    ");
+        std::istream is(&sb);
+        is.width(4);
+        signed char s[20];
+        is >> s;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string((char*)s) == "abc");
+        assert(is.width() == 0);
+    }
+    {
+        testbuf<char> sb("   abcdefghijk");
+        std::istream is(&sb);
+        signed char s[20];
+        is >> s;
+        assert( is.eof());
+        assert(!is.fail());
+        assert(std::string((char*)s) == "abcdefghijk");
+        assert(is.width() == 0);
+    }
+    {
+        testbuf<char> sb("   abcdefghijk");
+        std::istream is(&sb);
+        signed char s[20];
+        is.width(1);
+        is >> s;
+        assert(!is.eof());
+        assert( is.fail());
+        assert(std::string((char*)s) == "");
+        assert(is.width() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_istream;
+
+// basic_istream<charT,traits>& operator<<(basic_streambuf<charT,traits>* sb);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+    testbuf(const std::basic_string<CharT>& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data() + str_.size()));
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("testing...");
+        std::istream is(&sb);
+        testbuf<char> sb2;
+        is >> &sb2;
+        assert(sb2.str() == "testing...");
+        assert(is.gcount() == 10);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template<class traits>
+//   basic_istream<char,traits>& operator>>(basic_istream<char,traits>&& in, unsigned char& c);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("          ");
+        std::istream is(&sb);
+        unsigned char c = 'z';
+        is >> c;
+        assert( is.eof());
+        assert( is.fail());
+        assert(c == 'z');
+    }
+    {
+        testbuf<char> sb("   abcdefghijk    ");
+        std::istream is(&sb);
+        unsigned char c;
+        is >> c;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == 'a');
+        is >> c;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == 'b');
+        is >> c;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == 'c');
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template<class traits>
+//   basic_istream<char,traits>& operator>>(basic_istream<char,traits>&& in, unsigned char* s);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("   abcdefghijk    ");
+        std::istream is(&sb);
+        unsigned char s[20];
+        is >> s;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string((char*)s) == "abcdefghijk");
+    }
+    {
+        testbuf<char> sb("   abcdefghijk    ");
+        std::istream is(&sb);
+        is.width(4);
+        unsigned char s[20];
+        is >> s;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string((char*)s) == "abc");
+        assert(is.width() == 0);
+    }
+    {
+        testbuf<char> sb("   abcdefghijk");
+        std::istream is(&sb);
+        unsigned char s[20];
+        is >> s;
+        assert( is.eof());
+        assert(!is.fail());
+        assert(std::string((char*)s) == "abcdefghijk");
+        assert(is.width() == 0);
+    }
+    {
+        testbuf<char> sb("   abcdefghijk");
+        std::istream is(&sb);
+        unsigned char s[20];
+        is.width(1);
+        is >> s;
+        assert(!is.eof());
+        assert( is.fail());
+        assert(std::string((char*)s) == "");
+        assert(is.width() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template<class charT, class traits>
+//   basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&& in, charT* s);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("   abcdefghijk    ");
+        std::istream is(&sb);
+        char s[20];
+        is >> s;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string(s) == "abcdefghijk");
+    }
+    {
+        testbuf<wchar_t> sb(L"   abcdefghijk    ");
+        std::wistream is(&sb);
+        is.width(4);
+        wchar_t s[20];
+        is >> s;
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s) == L"abc");
+        assert(is.width() == 0);
+    }
+    {
+        testbuf<wchar_t> sb(L"   abcdefghijk");
+        std::wistream is(&sb);
+        wchar_t s[20];
+        is >> s;
+        assert( is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s) == L"abcdefghijk");
+        assert(is.width() == 0);
+    }
+    {
+        testbuf<char> sb("   abcdefghijk");
+        std::istream is(&sb);
+        char s[20];
+        is.width(1);
+        is >> s;
+        assert(!is.eof());
+        assert( is.fail());
+        assert(std::string(s) == "");
+        assert(is.width() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.formatted/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/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.manip/ws.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits>
+//   basic_istream<charT,traits>&
+//   ws(basic_istream<charT,traits>& is);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("   123");
+        std::istream is(&sb);
+        ws(is);
+        assert(is.good());
+        assert(is.peek() == '1');
+    }
+    {
+        testbuf<wchar_t> sb(L"   123");
+        std::wistream is(&sb);
+        ws(is);
+        assert(is.good());
+        assert(is.peek() == L'1');
+    }
+    {
+        testbuf<char> sb("  ");
+        std::istream is(&sb);
+        ws(is);
+        assert(!is.fail());
+        assert(is.eof());
+        ws(is);
+        assert(is.eof());
+        assert(is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L"  ");
+        std::wistream is(&sb);
+        ws(is);
+        assert(!is.fail());
+        assert(is.eof());
+        ws(is);
+        assert(is.eof());
+        assert(is.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits, class T>
+//   basic_istream<charT, traits>&
+//   operator>>(basic_istream<charT, traits>&& is, T& x);
+
+#include <istream>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        testbuf<char> sb("   123");
+        int i = 0;
+        std::istream(&sb) >> i;
+        assert(i == 123);
+    }
+    {
+        testbuf<wchar_t> sb(L"   123");
+        int i = 0;
+        std::wistream(&sb) >> i;
+        assert(i == 123);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// int_type get();
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("          ");
+        std::istream is(&sb);
+        char c = is.get();
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == ' ');
+        assert(is.gcount() == 1);
+    }
+    {
+        testbuf<char> sb(" abc");
+        std::istream is(&sb);
+        char c = is.get();
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == ' ');
+        assert(is.gcount() == 1);
+        c = is.get();
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == 'a');
+        assert(is.gcount() == 1);
+        c = is.get();
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == 'b');
+        assert(is.gcount() == 1);
+        c = is.get();
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == 'c');
+        assert(is.gcount() == 1);
+    }
+    {
+        testbuf<wchar_t> sb(L" abc");
+        std::wistream is(&sb);
+        wchar_t c = is.get();
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == L' ');
+        assert(is.gcount() == 1);
+        c = is.get();
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == L'a');
+        assert(is.gcount() == 1);
+        c = is.get();
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == L'b');
+        assert(is.gcount() == 1);
+        c = is.get();
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == L'c');
+        assert(is.gcount() == 1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& get(char_type& c);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("          ");
+        std::istream is(&sb);
+        char c;
+        is.get(c);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == ' ');
+        assert(is.gcount() == 1);
+    }
+    {
+        testbuf<char> sb(" abc");
+        std::istream is(&sb);
+        char c;
+        is.get(c);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == ' ');
+        assert(is.gcount() == 1);
+        is.get(c);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == 'a');
+        assert(is.gcount() == 1);
+        is.get(c);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == 'b');
+        assert(is.gcount() == 1);
+        is.get(c);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == 'c');
+        assert(is.gcount() == 1);
+    }
+    {
+        testbuf<wchar_t> sb(L" abc");
+        std::wistream is(&sb);
+        wchar_t c;
+        is.get(c);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == L' ');
+        assert(is.gcount() == 1);
+        is.get(c);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == L'a');
+        assert(is.gcount() == 1);
+        is.get(c);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == L'b');
+        assert(is.gcount() == 1);
+        is.get(c);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(c == L'c');
+        assert(is.gcount() == 1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,99 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& get(char_type* s, streamsize n);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("  \n    \n ");
+        std::istream is(&sb);
+        char s[5];
+        is.get(s, 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string(s) == "  ");
+        assert(is.gcount() == 2);
+        is.get(s, 5);
+        assert(!is.eof());
+        assert( is.fail());
+        assert(std::string(s) == "");
+        assert(is.gcount() == 0);
+        is.clear();
+        assert(is.get() == '\n');
+        is.get(s, 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string(s) == "    ");
+        assert(is.gcount() == 4);
+        assert(is.get() == '\n');
+        is.get(s, 5);
+        assert( is.eof());
+        assert(!is.fail());
+        assert(std::string(s) == " ");
+        assert(is.gcount() == 1);
+    }
+    {
+        testbuf<wchar_t> sb(L"  \n    \n ");
+        std::wistream is(&sb);
+        wchar_t s[5];
+        is.get(s, 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s) == L"  ");
+        assert(is.gcount() == 2);
+        is.get(s, 5);
+        assert(!is.eof());
+        assert( is.fail());
+        assert(std::wstring(s) == L"");
+        assert(is.gcount() == 0);
+        is.clear();
+        assert(is.get() == L'\n');
+        is.get(s, 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s) == L"    ");
+        assert(is.gcount() == 4);
+        assert(is.get() == L'\n');
+        is.get(s, 5);
+        assert( is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s) == L" ");
+        assert(is.gcount() == 1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,99 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& get(char_type* s, streamsize n, char_type delim);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("  *    * ");
+        std::istream is(&sb);
+        char s[5];
+        is.get(s, 5, '*');
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string(s) == "  ");
+        assert(is.gcount() == 2);
+        is.get(s, 5, '*');
+        assert(!is.eof());
+        assert( is.fail());
+        assert(std::string(s) == "");
+        assert(is.gcount() == 0);
+        is.clear();
+        assert(is.get() == '*');
+        is.get(s, 5, '*');
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string(s) == "    ");
+        assert(is.gcount() == 4);
+        assert(is.get() == '*');
+        is.get(s, 5, '*');
+        assert( is.eof());
+        assert(!is.fail());
+        assert(std::string(s) == " ");
+        assert(is.gcount() == 1);
+    }
+    {
+        testbuf<wchar_t> sb(L"  *    * ");
+        std::wistream is(&sb);
+        wchar_t s[5];
+        is.get(s, 5, L'*');
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s) == L"  ");
+        assert(is.gcount() == 2);
+        is.get(s, 5, L'*');
+        assert(!is.eof());
+        assert( is.fail());
+        assert(std::wstring(s) == L"");
+        assert(is.gcount() == 0);
+        is.clear();
+        assert(is.get() == L'*');
+        is.get(s, 5, L'*');
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s) == L"    ");
+        assert(is.gcount() == 4);
+        assert(is.get() == L'*');
+        is.get(s, 5, L'*');
+        assert( is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s) == L" ");
+        assert(is.gcount() == 1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& get(basic_streambuf<char_type,traits>& sb);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+    testbuf(const std::basic_string<CharT>& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data() + str_.size()));
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("testing\n...");
+        std::istream is(&sb);
+        testbuf<char> sb2;
+        is.get(sb2);
+        assert(sb2.str() == "testing");
+        assert(is.good());
+        assert(is.gcount() == 7);
+        assert(is.get() == '\n');
+        is.get(sb2);
+        assert(sb2.str() == "testing...");
+        assert(is.eof());
+        assert(!is.fail());
+        assert(is.gcount() == 3);
+    }
+    {
+        testbuf<wchar_t> sb(L"testing\n...");
+        std::wistream is(&sb);
+        testbuf<wchar_t> sb2;
+        is.get(sb2);
+        assert(sb2.str() == L"testing");
+        assert(is.good());
+        assert(is.gcount() == 7);
+        assert(is.get() == L'\n');
+        is.get(sb2);
+        assert(sb2.str() == L"testing...");
+        assert(is.eof());
+        assert(!is.fail());
+        assert(is.gcount() == 3);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& get(basic_streambuf<char_type,traits>& sb,
+//                                  char_type delim);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+    testbuf(const std::basic_string<CharT>& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data() + str_.size()));
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("testing*...");
+        std::istream is(&sb);
+        testbuf<char> sb2;
+        is.get(sb2, '*');
+        assert(sb2.str() == "testing");
+        assert(is.good());
+        assert(is.gcount() == 7);
+        assert(is.get() == '*');
+        is.get(sb2, '*');
+        assert(sb2.str() == "testing...");
+        assert(is.eof());
+        assert(!is.fail());
+        assert(is.gcount() == 3);
+    }
+    {
+        testbuf<wchar_t> sb(L"testing*...");
+        std::wistream is(&sb);
+        testbuf<wchar_t> sb2;
+        is.get(sb2, L'*');
+        assert(sb2.str() == L"testing");
+        assert(is.good());
+        assert(is.gcount() == 7);
+        assert(is.get() == L'*');
+        is.get(sb2, L'*');
+        assert(sb2.str() == L"testing...");
+        assert(is.eof());
+        assert(!is.fail());
+        assert(is.gcount() == 3);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& getline(char_type* s, streamsize n);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("  \n    \n ");
+        std::istream is(&sb);
+        char s[5];
+        is.getline(s, 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string(s) == "  ");
+        assert(is.gcount() == 3);
+        is.getline(s, 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string(s) == "    ");
+        assert(is.gcount() == 5);
+        is.getline(s, 5);
+        assert( is.eof());
+        assert(!is.fail());
+        assert(std::string(s) == " ");
+        assert(is.gcount() == 1);
+    }
+    {
+        testbuf<wchar_t> sb(L"  \n    \n ");
+        std::wistream is(&sb);
+        wchar_t s[5];
+        is.getline(s, 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s) == L"  ");
+        assert(is.gcount() == 3);
+        is.getline(s, 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s) == L"    ");
+        assert(is.gcount() == 5);
+        is.getline(s, 5);
+        assert( is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s) == L" ");
+        assert(is.gcount() == 1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& getline(char_type* s, streamsize n, char_type delim);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("  *    * ");
+        std::istream is(&sb);
+        char s[5];
+        is.getline(s, 5, '*');
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string(s) == "  ");
+        assert(is.gcount() == 3);
+        is.getline(s, 5, '*');
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string(s) == "    ");
+        assert(is.gcount() == 5);
+        is.getline(s, 5, '*');
+        assert( is.eof());
+        assert(!is.fail());
+        assert(std::string(s) == " ");
+        assert(is.gcount() == 1);
+    }
+    {
+        testbuf<wchar_t> sb(L"  *    * ");
+        std::wistream is(&sb);
+        wchar_t s[5];
+        is.getline(s, 5, L'*');
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s) == L"  ");
+        assert(is.gcount() == 3);
+        is.getline(s, 5, L'*');
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s) == L"    ");
+        assert(is.gcount() == 5);
+        is.getline(s, 5, L'*');
+        assert( is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s) == L" ");
+        assert(is.gcount() == 1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>&
+//    ignore(streamsize n = 1, int_type delim = traits::eof());
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb(" 1\n2345\n6");
+        std::istream is(&sb);
+        is.ignore();
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(is.gcount() == 1);
+        is.ignore(5, '\n');
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(is.gcount() == 2);
+        is.ignore(15);
+        assert( is.eof());
+        assert(!is.fail());
+        assert(is.gcount() == 6);
+    }
+    {
+        testbuf<wchar_t> sb(L" 1\n2345\n6");
+        std::wistream is(&sb);
+        is.ignore();
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(is.gcount() == 1);
+        is.ignore(5, '\n');
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(is.gcount() == 2);
+        is.ignore(15);
+        assert( is.eof());
+        assert(!is.fail());
+        assert(is.gcount() == 6);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>&
+//    ignore(streamsize n = 1, int_type delim = traits::eof());
+
+// http://llvm.org/bugs/show_bug.cgi?id=16427
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    int bad=-1;
+    std::ostringstream os;
+    os << "aaaabbbb" << static_cast<char>(bad) 
+       << "ccccdddd" << std::endl;
+    std::string s=os.str();
+    
+    std::istringstream is(s);
+    const unsigned int ignoreLen=10;
+    size_t a=is.tellg();
+    is.ignore(ignoreLen);
+    size_t b=is.tellg();
+    assert((b-a)==ignoreLen);
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// int_type peek();
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb(" 1\n2345\n6");
+        std::istream is(&sb);
+        assert(is.peek() == ' ');
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(is.gcount() == 0);
+        is.get();
+        assert(is.peek() == '1');
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(is.gcount() == 0);
+    }
+    {
+        testbuf<wchar_t> sb(L" 1\n2345\n6");
+        std::wistream is(&sb);
+        assert(is.peek() == L' ');
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(is.gcount() == 0);
+        is.get();
+        assert(is.peek() == L'1');
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(is.gcount() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/putback.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/putback.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/putback.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/putback.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& putback(char_type c);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb(" 123456789");
+        std::istream is(&sb);
+        is.get();
+        is.get();
+        is.get();
+        is.putback('a');
+        assert(is.bad());
+        assert(is.gcount() == 0);
+        is.clear();
+        is.putback('2');
+        assert(is.good());
+        assert(is.gcount() == 0);
+        is.putback('1');
+        assert(is.good());
+        assert(is.gcount() == 0);
+        is.putback(' ');
+        assert(is.good());
+        assert(is.gcount() == 0);
+        is.putback(' ');
+        assert(is.bad());
+        assert(is.gcount() == 0);
+    }
+    {
+        testbuf<wchar_t> sb(L" 123456789");
+        std::wistream is(&sb);
+        is.get();
+        is.get();
+        is.get();
+        is.putback(L'a');
+        assert(is.bad());
+        assert(is.gcount() == 0);
+        is.clear();
+        is.putback(L'2');
+        assert(is.good());
+        assert(is.gcount() == 0);
+        is.putback(L'1');
+        assert(is.good());
+        assert(is.gcount() == 0);
+        is.putback(L' ');
+        assert(is.good());
+        assert(is.gcount() == 0);
+        is.putback(L' ');
+        assert(is.bad());
+        assert(is.gcount() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& read(char_type* s, streamsize n);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb(" 123456789");
+        std::istream is(&sb);
+        char s[5];
+        is.read(s, 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string(s, 5) == " 1234");
+        assert(is.gcount() == 5);
+        is.read(s, 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string(s, 5) == "56789");
+        assert(is.gcount() == 5);
+        is.read(s, 5);
+        assert( is.eof());
+        assert( is.fail());
+        assert(is.gcount() == 0);
+    }
+    {
+        testbuf<wchar_t> sb(L" 123456789");
+        std::wistream is(&sb);
+        wchar_t s[5];
+        is.read(s, 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s, 5) == L" 1234");
+        assert(is.gcount() == 5);
+        is.read(s, 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s, 5) == L"56789");
+        assert(is.gcount() == 5);
+        is.read(s, 5);
+        assert( is.eof());
+        assert( is.fail());
+        assert(is.gcount() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// streamsize readsome(char_type* s, streamsize n);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb(" 1234567890");
+        std::istream is(&sb);
+        char s[5];
+        assert(is.readsome(s, 5) == 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string(s, 5) == " 1234");
+        assert(is.gcount() == 5);
+        is.readsome(s, 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::string(s, 5) == "56789");
+        assert(is.gcount() == 5);
+        is.readsome(s, 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(is.gcount() == 1);
+        assert(std::string(s, 1) == "0");
+        assert(is.readsome(s, 5) == 0);
+    }
+    {
+        testbuf<wchar_t> sb(L" 1234567890");
+        std::wistream is(&sb);
+        wchar_t s[5];
+        assert(is.readsome(s, 5) == 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s, 5) == L" 1234");
+        assert(is.gcount() == 5);
+        is.readsome(s, 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(std::wstring(s, 5) == L"56789");
+        assert(is.gcount() == 5);
+        is.readsome(s, 5);
+        assert(!is.eof());
+        assert(!is.fail());
+        assert(is.gcount() == 1);
+        assert(std::wstring(s, 1) == L"0");
+        assert(is.readsome(s, 5) == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& seekg(pos_type pos);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+protected:
+    typename base::pos_type seekpos(typename base::pos_type sp,
+                                    std::ios_base::openmode which)
+    {
+        assert(which == std::ios_base::in);
+        return sp;
+    }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb(" 123456789");
+        std::istream is(&sb);
+        is.seekg(5);
+        assert(is.good());
+        is.seekg(-1);
+        assert(is.fail());
+    }
+    {
+        testbuf<wchar_t> sb(L" 123456789");
+        std::wistream is(&sb);
+        is.seekg(5);
+        assert(is.good());
+        is.seekg(-1);
+        assert(is.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& seekg(off_type off, ios_base::seekdir dir);
+
+#include <istream>
+#include <cassert>
+
+int seekoff_called = 0;
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+protected:
+    typename base::pos_type seekoff(typename base::off_type off,
+                                    std::ios_base::seekdir way,
+                                    std::ios_base::openmode which)
+    {
+        assert(which == std::ios_base::in);
+        ++seekoff_called;
+        return off;
+    }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb(" 123456789");
+        std::istream is(&sb);
+        is.seekg(5, std::ios_base::cur);
+        assert(is.good());
+        assert(seekoff_called == 1);
+        is.seekg(-1, std::ios_base::beg);
+        assert(is.fail());
+        assert(seekoff_called == 2);
+    }
+    {
+        testbuf<wchar_t> sb(L" 123456789");
+        std::wistream is(&sb);
+        is.seekg(5, std::ios_base::cur);
+        assert(is.good());
+        assert(seekoff_called == 3);
+        is.seekg(-1, std::ios_base::beg);
+        assert(is.fail());
+        assert(seekoff_called == 4);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// int sync();
+
+#include <istream>
+#include <cassert>
+
+int sync_called = 0;
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+
+protected:
+    int sync()
+    {
+        ++sync_called;
+        return 5;
+    }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb(" 123456789");
+        std::istream is(&sb);
+        assert(is.sync() == 0);
+        assert(sync_called == 1);
+    }
+    {
+        testbuf<wchar_t> sb(L" 123456789");
+        std::wistream is(&sb);
+        assert(is.sync() == 0);
+        assert(sync_called == 2);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/tellg.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/tellg.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/tellg.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/tellg.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// pos_type tellg();
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+protected:
+    typename base::pos_type seekoff(typename base::off_type off,
+                                    std::ios_base::seekdir way,
+                                    std::ios_base::openmode which)
+    {
+        assert(off == 0);
+        assert(way == std::ios_base::cur);
+        assert(which == std::ios_base::in);
+        return 5;
+    }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb(" 123456789");
+        std::istream is(&sb);
+        assert(is.tellg() == 5);
+    }
+    {
+        testbuf<wchar_t> sb(L" 123456789");
+        std::wistream is(&sb);
+        assert(is.tellg() == 5);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/unget.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/unget.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/unget.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/unget.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// basic_istream<charT,traits>& unget();
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb(" 123456789");
+        std::istream is(&sb);
+        is.get();
+        is.get();
+        is.get();
+        is.unget();
+        assert(is.good());
+        assert(is.gcount() == 0);
+        is.unget();
+        assert(is.good());
+        assert(is.gcount() == 0);
+        is.unget();
+        assert(is.good());
+        assert(is.gcount() == 0);
+        is.unget();
+        assert(is.bad());
+        assert(is.gcount() == 0);
+    }
+    {
+        testbuf<wchar_t> sb(L" 123456789");
+        std::wistream is(&sb);
+        is.get();
+        is.get();
+        is.get();
+        is.unget();
+        assert(is.good());
+        assert(is.gcount() == 0);
+        is.unget();
+        assert(is.good());
+        assert(is.gcount() == 0);
+        is.unget();
+        assert(is.good());
+        assert(is.gcount() == 0);
+        is.unget();
+        assert(is.bad());
+        assert(is.gcount() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.assign/member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.assign/member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.assign/member_swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// void swap(basic_istream& rhs);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+template <class CharT>
+struct test_istream
+    : public std::basic_istream<CharT>
+{
+    typedef std::basic_istream<CharT> base;
+    test_istream(testbuf<CharT>* sb) : base(sb) {}
+
+    void swap(test_istream& s) {base::swap(s);}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb1;
+        testbuf<char> sb2;
+        test_istream<char> is1(&sb1);
+        test_istream<char> is2(&sb2);
+        is1.swap(is2);
+        assert(is1.rdbuf() == &sb1);
+        assert(is1.tie() == 0);
+        assert(is1.fill() == ' ');
+        assert(is1.rdstate() == is1.goodbit);
+        assert(is1.exceptions() == is1.goodbit);
+        assert(is1.flags() == (is1.skipws | is1.dec));
+        assert(is1.precision() == 6);
+        assert(is1.getloc().name() == "C");
+        assert(is2.rdbuf() == &sb2);
+        assert(is2.tie() == 0);
+        assert(is2.fill() == ' ');
+        assert(is2.rdstate() == is2.goodbit);
+        assert(is2.exceptions() == is2.goodbit);
+        assert(is2.flags() == (is2.skipws | is2.dec));
+        assert(is2.precision() == 6);
+        assert(is2.getloc().name() == "C");
+    }
+    {
+        testbuf<wchar_t> sb1;
+        testbuf<wchar_t> sb2;
+        test_istream<wchar_t> is1(&sb1);
+        test_istream<wchar_t> is2(&sb2);
+        is1.swap(is2);
+        assert(is1.rdbuf() == &sb1);
+        assert(is1.tie() == 0);
+        assert(is1.fill() == ' ');
+        assert(is1.rdstate() == is1.goodbit);
+        assert(is1.exceptions() == is1.goodbit);
+        assert(is1.flags() == (is1.skipws | is1.dec));
+        assert(is1.precision() == 6);
+        assert(is1.getloc().name() == "C");
+        assert(is2.rdbuf() == &sb2);
+        assert(is2.tie() == 0);
+        assert(is2.fill() == ' ');
+        assert(is2.rdstate() == is2.goodbit);
+        assert(is2.exceptions() == is2.goodbit);
+        assert(is2.flags() == (is2.skipws | is2.dec));
+        assert(is2.precision() == 6);
+        assert(is2.getloc().name() == "C");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// basic_istream& operator=(basic_istream&& rhs);
+
+#include <istream>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+template <class CharT>
+struct test_istream
+    : public std::basic_istream<CharT>
+{
+    typedef std::basic_istream<CharT> base;
+    test_istream(testbuf<CharT>* sb) : base(sb) {}
+
+    test_istream& operator=(test_istream&& s)
+        {base::operator=(std::move(s)); return *this;}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        testbuf<char> sb1;
+        testbuf<char> sb2;
+        test_istream<char> is1(&sb1);
+        test_istream<char> is2(&sb2);
+        is2 = (std::move(is1));
+        assert(is1.rdbuf() == &sb1);
+        assert(is1.tie() == 0);
+        assert(is1.fill() == ' ');
+        assert(is1.rdstate() == is1.goodbit);
+        assert(is1.exceptions() == is1.goodbit);
+        assert(is1.flags() == (is1.skipws | is1.dec));
+        assert(is1.precision() == 6);
+        assert(is1.getloc().name() == "C");
+        assert(is2.rdbuf() == &sb2);
+        assert(is2.tie() == 0);
+        assert(is2.fill() == ' ');
+        assert(is2.rdstate() == is2.goodbit);
+        assert(is2.exceptions() == is2.goodbit);
+        assert(is2.flags() == (is2.skipws | is2.dec));
+        assert(is2.precision() == 6);
+        assert(is2.getloc().name() == "C");
+    }
+    {
+        testbuf<wchar_t> sb1;
+        testbuf<wchar_t> sb2;
+        test_istream<wchar_t> is1(&sb1);
+        test_istream<wchar_t> is2(&sb2);
+        is2 = (std::move(is1));
+        assert(is1.rdbuf() == &sb1);
+        assert(is1.tie() == 0);
+        assert(is1.fill() == ' ');
+        assert(is1.rdstate() == is1.goodbit);
+        assert(is1.exceptions() == is1.goodbit);
+        assert(is1.flags() == (is1.skipws | is1.dec));
+        assert(is1.precision() == 6);
+        assert(is1.getloc().name() == "C");
+        assert(is2.rdbuf() == &sb2);
+        assert(is2.tie() == 0);
+        assert(is2.fill() == ' ');
+        assert(is2.rdstate() == is2.goodbit);
+        assert(is2.exceptions() == is2.goodbit);
+        assert(is2.flags() == (is2.skipws | is2.dec));
+        assert(is2.precision() == 6);
+        assert(is2.getloc().name() == "C");
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// basic_istream(basic_istream&& rhs);
+
+#include <istream>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+template <class CharT>
+struct test_istream
+    : public std::basic_istream<CharT>
+{
+    typedef std::basic_istream<CharT> base;
+    test_istream(testbuf<CharT>* sb) : base(sb) {}
+
+    test_istream(test_istream&& s)
+        : base(std::move(s)) {}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        testbuf<char> sb;
+        test_istream<char> is1(&sb);
+        test_istream<char> is(std::move(is1));
+        assert(is1.rdbuf() == &sb);
+        assert(is1.gcount() == 0);
+        assert(is.gcount() == 0);
+        assert(is.rdbuf() == 0);
+        assert(is.tie() == 0);
+        assert(is.fill() == ' ');
+        assert(is.rdstate() == is.goodbit);
+        assert(is.exceptions() == is.goodbit);
+        assert(is.flags() == (is.skipws | is.dec));
+        assert(is.precision() == 6);
+        assert(is.getloc().name() == "C");
+    }
+    {
+        testbuf<wchar_t> sb;
+        test_istream<wchar_t> is1(&sb);
+        test_istream<wchar_t> is(std::move(is1));
+        assert(is1.gcount() == 0);
+        assert(is.gcount() == 0);
+        assert(is1.rdbuf() == &sb);
+        assert(is.rdbuf() == 0);
+        assert(is.tie() == 0);
+        assert(is.fill() == L' ');
+        assert(is.rdstate() == is.goodbit);
+        assert(is.exceptions() == is.goodbit);
+        assert(is.flags() == (is.skipws | is.dec));
+        assert(is.precision() == 6);
+        assert(is.getloc().name() == "C");
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/streambuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/streambuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/streambuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/streambuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// explicit basic_istream(basic_streambuf<charT,traits>* sb);
+
+#include <istream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::basic_istream<char> is(&sb);
+        assert(is.rdbuf() == &sb);
+        assert(is.tie() == 0);
+        assert(is.fill() == ' ');
+        assert(is.rdstate() == is.goodbit);
+        assert(is.exceptions() == is.goodbit);
+        assert(is.flags() == (is.skipws | is.dec));
+        assert(is.precision() == 6);
+        assert(is.getloc().name() == "C");
+        assert(is.gcount() == 0);
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::basic_istream<wchar_t> is(&sb);
+        assert(is.rdbuf() == &sb);
+        assert(is.tie() == 0);
+        assert(is.fill() == L' ');
+        assert(is.rdstate() == is.goodbit);
+        assert(is.exceptions() == is.goodbit);
+        assert(is.flags() == (is.skipws | is.dec));
+        assert(is.precision() == 6);
+        assert(is.getloc().name() == "C");
+        assert(is.gcount() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream_sentry/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream_sentry/ctor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream_sentry/ctor.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream_sentry/ctor.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,128 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream::sentry;
+
+// explicit sentry(basic_istream<charT,traits>& is, bool noskipws = false);
+
+#include <istream>
+#include <cassert>
+
+int sync_called = 0;
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_string<CharT> string_type;
+    typedef std::basic_streambuf<CharT> base;
+private:
+    string_type str_;
+public:
+
+    testbuf() {}
+    testbuf(const string_type& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()) + str_.size());
+    }
+
+    CharT* eback() const {return base::eback();}
+    CharT* gptr() const {return base::gptr();}
+    CharT* egptr() const {return base::egptr();}
+protected:
+
+    int virtual sync()
+    {
+        ++sync_called;
+        return 1;
+    }
+};
+
+int main()
+{
+    {
+        std::istream is((testbuf<char>*)0);
+        std::istream::sentry sen(is, true);
+        assert(!(bool)sen);
+        assert(!is.good());
+        assert(is.gcount() == 0);
+        assert(sync_called == 0);
+    }
+    {
+        std::wistream is((testbuf<wchar_t>*)0);
+        std::wistream::sentry sen(is, true);
+        assert(!(bool)sen);
+        assert(!is.good());
+        assert(is.gcount() == 0);
+        assert(sync_called == 0);
+    }
+    {
+        testbuf<char> sb("   123");
+        std::istream is(&sb);
+        std::istream::sentry sen(is, true);
+        assert((bool)sen);
+        assert(is.good());
+        assert(is.gcount() == 0);
+        assert(sync_called == 0);
+        assert(sb.gptr() == sb.eback());
+    }
+    {
+        testbuf<wchar_t> sb(L"   123");
+        std::wistream is(&sb);
+        std::wistream::sentry sen(is, true);
+        assert((bool)sen);
+        assert(is.good());
+        assert(is.gcount() == 0);
+        assert(sync_called == 0);
+        assert(sb.gptr() == sb.eback());
+    }
+    {
+        testbuf<char> sb("   123");
+        std::istream is(&sb);
+        std::istream::sentry sen(is);
+        assert((bool)sen);
+        assert(is.good());
+        assert(sync_called == 0);
+        assert(sb.gptr() == sb.eback() + 3);
+    }
+    {
+        testbuf<wchar_t> sb(L"   123");
+        std::wistream is(&sb);
+        std::wistream::sentry sen(is);
+        assert((bool)sen);
+        assert(is.good());
+        assert(sync_called == 0);
+        assert(sb.gptr() == sb.eback() + 3);
+    }
+    {
+        testbuf<char> sb("      ");
+        std::istream is(&sb);
+        std::istream::sentry sen(is);
+        assert(!(bool)sen);
+        assert(is.fail());
+        assert(is.eof());
+        assert(sync_called == 0);
+        assert(sb.gptr() == sb.eback() + 6);
+    }
+    {
+        testbuf<char> sb("      ");
+        std::istream is(&sb);
+        std::istream::sentry sen(is, true);
+        assert((bool)sen);
+        assert(is.good());
+        assert(sync_called == 0);
+        assert(sb.gptr() == sb.eback());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/types.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/types.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream
+//     : virtual public basic_ios<charT,traits>
+// {
+// public:
+//     // types (inherited from basic_ios (27.5.4)):
+//     typedef charT                          char_type;
+//     typedef traits                         traits_type;
+//     typedef typename traits_type::int_type int_type;
+//     typedef typename traits_type::pos_type pos_type;
+//     typedef typename traits_type::off_type off_type;
+
+#include <istream>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::basic_ios<char>, std::basic_istream<char> >::value), "");
+    static_assert((std::is_same<std::basic_istream<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::basic_istream<char>::traits_type, std::char_traits<char> >::value), "");
+    static_assert((std::is_same<std::basic_istream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+    static_assert((std::is_same<std::basic_istream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+    static_assert((std::is_same<std::basic_istream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/version.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+#include <istream>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/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/input.output/iostream.format/output.streams/ostream.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.assign/member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.assign/member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.assign/member_swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// void swap(basic_ostream& rhs);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+template <class CharT>
+struct test_ostream
+    : public std::basic_ostream<CharT>
+{
+    typedef std::basic_ostream<CharT> base;
+    test_ostream(testbuf<CharT>* sb) : base(sb) {}
+
+    void swap(test_ostream& s) {base::swap(s);}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb1;
+        testbuf<char> sb2;
+        test_ostream<char> os1(&sb1);
+        test_ostream<char> os2(&sb2);
+        os1.swap(os2);
+        assert(os1.rdbuf() == &sb1);
+        assert(os1.tie() == 0);
+        assert(os1.fill() == ' ');
+        assert(os1.rdstate() == os1.goodbit);
+        assert(os1.exceptions() == os1.goodbit);
+        assert(os1.flags() == (os1.skipws | os1.dec));
+        assert(os1.precision() == 6);
+        assert(os1.getloc().name() == "C");
+        assert(os2.rdbuf() == &sb2);
+        assert(os2.tie() == 0);
+        assert(os2.fill() == ' ');
+        assert(os2.rdstate() == os2.goodbit);
+        assert(os2.exceptions() == os2.goodbit);
+        assert(os2.flags() == (os2.skipws | os2.dec));
+        assert(os2.precision() == 6);
+        assert(os2.getloc().name() == "C");
+    }
+    {
+        testbuf<wchar_t> sb1;
+        testbuf<wchar_t> sb2;
+        test_ostream<wchar_t> os1(&sb1);
+        test_ostream<wchar_t> os2(&sb2);
+        os1.swap(os2);
+        assert(os1.rdbuf() == &sb1);
+        assert(os1.tie() == 0);
+        assert(os1.fill() == ' ');
+        assert(os1.rdstate() == os1.goodbit);
+        assert(os1.exceptions() == os1.goodbit);
+        assert(os1.flags() == (os1.skipws | os1.dec));
+        assert(os1.precision() == 6);
+        assert(os1.getloc().name() == "C");
+        assert(os2.rdbuf() == &sb2);
+        assert(os2.tie() == 0);
+        assert(os2.fill() == ' ');
+        assert(os2.rdstate() == os2.goodbit);
+        assert(os2.exceptions() == os2.goodbit);
+        assert(os2.flags() == (os2.skipws | os2.dec));
+        assert(os2.precision() == 6);
+        assert(os2.getloc().name() == "C");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// basic_ostream& operator=(basic_ostream&& rhs);
+
+#include <ostream>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+template <class CharT>
+struct test_ostream
+    : public std::basic_ostream<CharT>
+{
+    typedef std::basic_ostream<CharT> base;
+    test_ostream(testbuf<CharT>* sb) : base(sb) {}
+
+    test_ostream& operator=(test_ostream&& s)
+        {base::operator=(std::move(s)); return *this;}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        testbuf<char> sb1;
+        testbuf<char> sb2;
+        test_ostream<char> os1(&sb1);
+        test_ostream<char> os2(&sb2);
+        os2 = (std::move(os1));
+        assert(os1.rdbuf() == &sb1);
+        assert(os1.tie() == 0);
+        assert(os1.fill() == ' ');
+        assert(os1.rdstate() == os1.goodbit);
+        assert(os1.exceptions() == os1.goodbit);
+        assert(os1.flags() == (os1.skipws | os1.dec));
+        assert(os1.precision() == 6);
+        assert(os1.getloc().name() == "C");
+        assert(os2.rdbuf() == &sb2);
+        assert(os2.tie() == 0);
+        assert(os2.fill() == ' ');
+        assert(os2.rdstate() == os2.goodbit);
+        assert(os2.exceptions() == os2.goodbit);
+        assert(os2.flags() == (os2.skipws | os2.dec));
+        assert(os2.precision() == 6);
+        assert(os2.getloc().name() == "C");
+    }
+    {
+        testbuf<wchar_t> sb1;
+        testbuf<wchar_t> sb2;
+        test_ostream<wchar_t> os1(&sb1);
+        test_ostream<wchar_t> os2(&sb2);
+        os2 = (std::move(os1));
+        assert(os1.rdbuf() == &sb1);
+        assert(os1.tie() == 0);
+        assert(os1.fill() == ' ');
+        assert(os1.rdstate() == os1.goodbit);
+        assert(os1.exceptions() == os1.goodbit);
+        assert(os1.flags() == (os1.skipws | os1.dec));
+        assert(os1.precision() == 6);
+        assert(os1.getloc().name() == "C");
+        assert(os2.rdbuf() == &sb2);
+        assert(os2.tie() == 0);
+        assert(os2.fill() == ' ');
+        assert(os2.rdstate() == os2.goodbit);
+        assert(os2.exceptions() == os2.goodbit);
+        assert(os2.flags() == (os2.skipws | os2.dec));
+        assert(os2.precision() == 6);
+        assert(os2.getloc().name() == "C");
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// basic_ostream(basic_ostream&& rhs);
+
+#include <ostream>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+template <class CharT>
+struct test_ostream
+    : public std::basic_ostream<CharT>
+{
+    typedef std::basic_ostream<CharT> base;
+    test_ostream(testbuf<CharT>* sb) : base(sb) {}
+
+    test_ostream(test_ostream&& s)
+        : base(std::move(s)) {}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        testbuf<char> sb;
+        test_ostream<char> os1(&sb);
+        test_ostream<char> os(std::move(os1));
+        assert(os1.rdbuf() == &sb);
+        assert(os.rdbuf() == 0);
+        assert(os.tie() == 0);
+        assert(os.fill() == ' ');
+        assert(os.rdstate() == os.goodbit);
+        assert(os.exceptions() == os.goodbit);
+        assert(os.flags() == (os.skipws | os.dec));
+        assert(os.precision() == 6);
+        assert(os.getloc().name() == "C");
+    }
+    {
+        testbuf<wchar_t> sb;
+        test_ostream<wchar_t> os1(&sb);
+        test_ostream<wchar_t> os(std::move(os1));
+        assert(os1.rdbuf() == &sb);
+        assert(os.rdbuf() == 0);
+        assert(os.tie() == 0);
+        assert(os.fill() == L' ');
+        assert(os.rdstate() == os.goodbit);
+        assert(os.exceptions() == os.goodbit);
+        assert(os.flags() == (os.skipws | os.dec));
+        assert(os.precision() == 6);
+        assert(os.getloc().name() == "C");
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.cons/streambuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.cons/streambuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.cons/streambuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.cons/streambuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// explicit basic_ostream(basic_streambuf<charT,traits>* sb);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::basic_ostream<char> os(&sb);
+        assert(os.rdbuf() == &sb);
+        assert(os.tie() == 0);
+        assert(os.fill() == ' ');
+        assert(os.rdstate() == os.goodbit);
+        assert(os.exceptions() == os.goodbit);
+        assert(os.flags() == (os.skipws | os.dec));
+        assert(os.precision() == 6);
+        assert(os.getloc().name() == "C");
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::basic_ostream<wchar_t> os(&sb);
+        assert(os.rdbuf() == &sb);
+        assert(os.tie() == 0);
+        assert(os.fill() == L' ');
+        assert(os.rdstate() == os.goodbit);
+        assert(os.exceptions() == os.goodbit);
+        assert(os.flags() == (os.skipws | os.dec));
+        assert(os.precision() == 6);
+        assert(os.getloc().name() == "C");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/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/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.reqmts/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.reqmts/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.reqmts/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.reqmts/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/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// operator<<(bool val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        bool b = false;
+        os << b;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        bool b = false;
+        os << b;
+        assert(sb.str() == "0");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        bool b = true;
+        os << b;
+        assert(sb.str() == "1");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        boolalpha(os);
+        bool b = true;
+        os << b;
+        assert(sb.str() == "true");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        boolalpha(os);
+        bool b = false;
+        os << b;
+        assert(sb.str() == "false");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// operator<<(double val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        double n = 0;
+        os << n;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        double n = 0;
+        os << n;
+        assert(sb.str() == "0");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        double n = -10;
+        os << n;
+        assert(sb.str() == "-10");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        hex(os);
+        double n = -10.5;
+        os << n;
+        assert(sb.str() == "-10.5");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// operator<<(float val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        float n = 0;
+        os << n;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        float n = 0;
+        os << n;
+        assert(sb.str() == "0");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        float n = -10;
+        os << n;
+        assert(sb.str() == "-10");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        hex(os);
+        float n = -10.5;
+        os << n;
+        assert(sb.str() == "-10.5");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// operator<<(int val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        int n = 0;
+        os << n;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        int n = 0;
+        os << n;
+        assert(sb.str() == "0");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        int n = -10;
+        os << n;
+        assert(sb.str() == "-10");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        hex(os);
+        int n = -10;
+        os << n;
+        assert(sb.str() == "fffffff6");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// operator<<(long val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        long n = 0;
+        os << n;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        long n = 0;
+        os << n;
+        assert(sb.str() == "0");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        long n = -10;
+        os << n;
+        assert(sb.str() == "-10");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        hex(os);
+        long n = 0xfffffff6;
+        os << n;
+        assert(sb.str() == "fffffff6");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// operator<<(long double val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        long double n = 0;
+        os << n;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        long double n = 0;
+        os << n;
+        assert(sb.str() == "0");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        long double n = -10;
+        os << n;
+        assert(sb.str() == "-10");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        hex(os);
+        long double n = -10.5;
+        os << n;
+        assert(sb.str() == "-10.5");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// operator<<(long long val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        long long n = 0;
+        os << n;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        long long n = 0;
+        os << n;
+        assert(sb.str() == "0");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        long long n = -10;
+        os << n;
+        assert(sb.str() == "-10");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        hex(os);
+        long long n = -10;
+        os << n;
+        assert(sb.str() == "fffffffffffffff6");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,82 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// operator<<(const void* val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        const void* n = 0;
+        os << n;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        const void* n = 0;
+        os << n;
+        assert(os.good());
+        // %p is implementation defined.
+        // On some platforms (Windows), it's a hex number without
+        // any leading 0x like prefix.
+        // In that format, we assume a null pointer will yield 2 '0' hex digits
+        // for each 8 bits of address space.
+        assert(sb.str() == "0x0" || sb.str() == "(nil)" ||
+                                  sb.str() == std::string(sizeof(void*)*2,'0'));
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        const void* n = &sb;
+        os << n;
+        assert(os.good());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// operator<<(short val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        short n = 0;
+        os << n;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        short n = 0;
+        os << n;
+        assert(sb.str() == "0");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        short n = -10;
+        os << n;
+        assert(sb.str() == "-10");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        hex(os);
+        short n = -10;
+        os << n;
+        assert(sb.str() == "fff6");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// operator<<(unsigned int val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        unsigned int n = 0;
+        os << n;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        unsigned int n = 0;
+        os << n;
+        assert(sb.str() == "0");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        unsigned int n = 10;
+        os << n;
+        assert(sb.str() == "10");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        hex(os);
+        unsigned int n = 0xFFF6;
+        os << n;
+        assert(sb.str() == "fff6");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// operator<<(unsigned long val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        unsigned long n = 0;
+        os << n;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        unsigned long n = 0;
+        os << n;
+        assert(sb.str() == "0");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        unsigned long n = 10;
+        os << n;
+        assert(sb.str() == "10");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        hex(os);
+        unsigned long n = 0xfffffff6;
+        os << n;
+        assert(sb.str() == "fffffff6");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// operator<<(unsigned long long val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        unsigned long long n = 0;
+        os << n;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        unsigned long long n = 0;
+        os << n;
+        assert(sb.str() == "0");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        unsigned long long n = 10;
+        os << n;
+        assert(sb.str() == "10");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        hex(os);
+        unsigned long long n = -10;
+        os << n;
+        assert(sb.str() == "fffffffffffffff6");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// operator<<(unsigned short val);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        unsigned short n = 0;
+        os << n;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        unsigned short n = 0;
+        os << n;
+        assert(sb.str() == "0");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        unsigned short n = 10;
+        os << n;
+        assert(sb.str() == "10");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        hex(os);
+        unsigned short n = 0xFFF6;
+        os << n;
+        assert(sb.str() == "fff6");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// template<class charT, class traits>
+//   basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out, charT c);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::wostream os((std::wstreambuf*)0);
+        wchar_t c = L'a';
+        os << c;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        wchar_t c = L'a';
+        os << c;
+        assert(sb.str() == L"a");
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        os.width(5);
+        wchar_t c = L'a';
+        os << c;
+        assert(sb.str() == L"    a");
+        assert(os.width() == 0);
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        os.width(5);
+        left(os);
+        wchar_t c = L'a';
+        os << c;
+        assert(sb.str() == L"a    ");
+        assert(os.width() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// template<class charT, class traits>
+//   basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out, const charT* s);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::wostream os((std::wstreambuf*)0);
+        const wchar_t* c = L"123";
+        os << c;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        const wchar_t* c = L"123";
+        os << c;
+        assert(sb.str() == L"123");
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        os.width(5);
+        const wchar_t* c = L"123";
+        os << c;
+        assert(sb.str() == L"  123");
+        assert(os.width() == 0);
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        os.width(5);
+        left(os);
+        const wchar_t* c = L"123";
+        os << c;
+        assert(sb.str() == L"123  ");
+        assert(os.width() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// template<class char, class traits>
+//   basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out, char c);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        char c = 'a';
+        os << c;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        char c = 'a';
+        os << c;
+        assert(sb.str() == "a");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os.width(5);
+        char c = 'a';
+        os << c;
+        assert(sb.str() == "    a");
+        assert(os.width() == 0);
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os.width(5);
+        left(os);
+        char c = 'a';
+        os << c;
+        assert(sb.str() == "a    ");
+        assert(os.width() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// template<class traits>
+//   basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out, const char* s);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        const char* c = "123";
+        os << c;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        const char* c = "123";
+        os << c;
+        assert(sb.str() == "123");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os.width(5);
+        const char* c = "123";
+        os << c;
+        assert(sb.str() == "  123");
+        assert(os.width() == 0);
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os.width(5);
+        left(os);
+        const char* c = "123";
+        os << c;
+        assert(sb.str() == "123  ");
+        assert(os.width() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// template<class charT, class traits>
+//   basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out, char c);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::wostream os((std::wstreambuf*)0);
+        char c = 'a';
+        os << c;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        char c = 'a';
+        os << c;
+        assert(sb.str() == L"a");
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        os.width(5);
+        char c = 'a';
+        os << c;
+        assert(sb.str() == L"    a");
+        assert(os.width() == 0);
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        os.width(5);
+        left(os);
+        char c = 'a';
+        os << c;
+        assert(sb.str() == L"a    ");
+        assert(os.width() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// template<class charT, class traits>
+//   basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out, const char* s);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::wostream os((std::wstreambuf*)0);
+        const char* c = "123";
+        os << c;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        const char* c = "123";
+        os << c;
+        assert(sb.str() == L"123");
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        os.width(5);
+        const char* c = "123";
+        os << c;
+        assert(sb.str() == L"  123");
+        assert(os.width() == 0);
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        os.width(5);
+        left(os);
+        const char* c = "123";
+        os << c;
+        assert(sb.str() == L"123  ");
+        assert(os.width() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// template<class char, class traits>
+//   basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out, signed char c);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        signed char c = 'a';
+        os << c;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        signed char c = 'a';
+        os << c;
+        assert(sb.str() == "a");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os.width(5);
+        signed char c = 'a';
+        os << c;
+        assert(sb.str() == "    a");
+        assert(os.width() == 0);
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os.width(5);
+        left(os);
+        signed char c = 'a';
+        os << c;
+        assert(sb.str() == "a    ");
+        assert(os.width() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// template<class traits>
+//   basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out, const signed char* s);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        const signed char* c = (const signed char*)"123";
+        os << c;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        const signed char* c = (const signed char*)"123";
+        os << c;
+        assert(sb.str() == "123");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os.width(5);
+        const signed char* c = (const signed char*)"123";
+        os << c;
+        assert(sb.str() == "  123");
+        assert(os.width() == 0);
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os.width(5);
+        left(os);
+        const signed char* c = (const signed char*)"123";
+        os << c;
+        assert(sb.str() == "123  ");
+        assert(os.width() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// template<class char, class traits>
+//   basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out, unsigned char c);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        unsigned char c = 'a';
+        os << c;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        unsigned char c = 'a';
+        os << c;
+        assert(sb.str() == "a");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os.width(5);
+        unsigned char c = 'a';
+        os << c;
+        assert(sb.str() == "    a");
+        assert(os.width() == 0);
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os.width(5);
+        left(os);
+        unsigned char c = 'a';
+        os << c;
+        assert(sb.str() == "a    ");
+        assert(os.width() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// template<class traits>
+//   basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out, const unsigned char* s);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        const unsigned char* c = (const unsigned char*)"123";
+        os << c;
+        assert(os.bad());
+        assert(os.fail());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        const unsigned char* c = (const unsigned char*)"123";
+        os << c;
+        assert(sb.str() == "123");
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os.width(5);
+        const unsigned char* c = (const unsigned char*)"123";
+        os << c;
+        assert(sb.str() == "  123");
+        assert(os.width() == 0);
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os.width(5);
+        left(os);
+        const unsigned char* c = (const unsigned char*)"123";
+        os << c;
+        assert(sb.str() == "123  ");
+        assert(os.width() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// basic_ostream<charT,traits>& operator<<(basic_ios<charT,traits>&
+//                                         (*pf)(basic_ios<charT,traits>&));
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+template <class CharT>
+std::basic_ios<CharT>&
+f(std::basic_ios<CharT>& os)
+{
+    std::uppercase(os);
+    return os;
+}
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        assert(!(os.flags() & std::ios_base::uppercase));
+        os << f;
+        assert( (os.flags() & std::ios_base::uppercase));
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// basic_ostream<charT,traits>& operator<<(ios_base& (*pf)(ios_base&));
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        assert(!(os.flags() & std::ios_base::uppercase));
+        os << std::uppercase;
+        assert( (os.flags() & std::ios_base::uppercase));
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// basic_ostream<charT,traits>& operator<<
+//           (basic_ostream<charT,traits>& (*pf)(basic_ostream<charT,traits>&))
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+template <class CharT>
+std::basic_ostream<CharT>&
+f(std::basic_ostream<CharT>& os)
+{
+    os << "testing...";
+    return os;
+}
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os << f;
+        assert(sb.str() == "testing...");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// basic_ostream<charT,traits>& operator<<(basic_streambuf<charT,traits>* sb);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+    testbuf(const std::basic_string<CharT>& str)
+        : str_(str)
+    {
+        base::setg(const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data()),
+                   const_cast<CharT*>(str_.data() + str_.size()));
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        testbuf<char> sb2("testing...");
+        assert(sb.str() == "");
+        os << &sb2;
+        assert(sb.str() == "testing...");
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.manip/endl.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// template <class charT, class traits>
+//   basic_ostream<charT,traits>& endl(basic_ostream<charT,traits>& os);
+
+#include <ostream>
+#include <cassert>
+
+int sync_called = 0;
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+
+    virtual int
+        sync()
+        {
+            ++sync_called;
+            return 0;
+        }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        endl(os);
+        assert(sb.str() == "\n");
+        assert(sync_called == 1);
+        assert(os.good());
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        endl(os);
+        assert(sb.str() == L"\n");
+        assert(sync_called == 2);
+        assert(os.good());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.manip/ends.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// template <class charT, class traits>
+//   basic_ostream<charT,traits>& ends(basic_ostream<charT,traits>& os);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        ends(os);
+        assert(sb.str().size() == 1);
+        assert(sb.str().back() == 0);
+        assert(os.good());
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        ends(os);
+        assert(sb.str().size() == 1);
+        assert(sb.str().back() == 0);
+        assert(os.good());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.manip/flush.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.manip/flush.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.manip/flush.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.manip/flush.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// template <class charT, class traits>
+//   basic_ostream<charT,traits>& flush(basic_ostream<charT,traits>& os);
+
+#include <ostream>
+#include <cassert>
+
+int sync_called = 0;
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+public:
+    testbuf()
+    {
+    }
+
+protected:
+
+    virtual int
+        sync()
+        {
+            ++sync_called;
+            return 0;
+        }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        flush(os);
+        assert(sync_called == 1);
+        assert(os.good());
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        flush(os);
+        assert(sync_called == 2);
+        assert(os.good());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// template <class charT, class traits, class T>
+//   basic_ostream<charT, traits>&
+//   operator<<(basic_ostream<charT, traits>&& os, const T& x);
+
+#include <ostream>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        testbuf<char> sb;
+        std::ostream(&sb) << "testing...";
+        assert(sb.str() == "testing...");
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream(&sb) << L"123";
+        assert(sb.str() == L"123");
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// basic_ostream<charT,traits>& seekp(pos_type pos);
+
+#include <ostream>
+#include <cassert>
+
+int seekpos_called = 0;
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    testbuf() {}
+
+protected:
+
+    typename base::pos_type
+    seekpos(typename base::pos_type sp, std::ios_base::openmode which)
+    {
+        ++seekpos_called;
+        assert(which == std::ios_base::out);
+        return sp;
+    }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        assert(&os.seekp(5) == &os);
+        assert(seekpos_called == 0);
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        assert(&os.seekp(10) == &os);
+        assert(seekpos_called == 1);
+        assert(os.good());
+        assert(&os.seekp(-1) == &os);
+        assert(seekpos_called == 2);
+        assert(os.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp2.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp2.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp2.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// basic_ostream<charT,traits>& seekp(off_type off, ios_base::seekdir dir);
+
+#include <ostream>
+#include <cassert>
+
+int seekoff_called = 0;
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    testbuf() {}
+
+protected:
+
+    typename base::pos_type
+    seekoff(typename base::off_type off, std::ios_base::seekdir way,
+                                         std::ios_base::openmode which)
+    {
+        ++seekoff_called;
+        assert(way == std::ios_base::beg);
+        assert(which == std::ios_base::out);
+        return off;
+    }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        assert(&os.seekp(5, std::ios_base::beg) == &os);
+        assert(seekoff_called == 0);
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        assert(&os.seekp(10, std::ios_base::beg) == &os);
+        assert(seekoff_called == 1);
+        assert(os.good());
+        assert(&os.seekp(-1, std::ios_base::beg) == &os);
+        assert(seekoff_called == 2);
+        assert(os.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.seeks/tellp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.seeks/tellp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.seeks/tellp.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.seeks/tellp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// pos_type tellp();
+
+#include <ostream>
+#include <cassert>
+
+int seekoff_called = 0;
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    testbuf() {}
+
+protected:
+
+    typename base::pos_type
+    seekoff(typename base::off_type off, std::ios_base::seekdir way, std::ios_base::openmode which)
+    {
+        assert(off == 0);
+        assert(way == std::ios_base::cur);
+        assert(which == std::ios_base::out);
+        ++seekoff_called;
+        return 10;
+    }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        assert(os.tellp() == -1);
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        assert(os.tellp() == 10);
+        assert(seekoff_called == 1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.unformatted/flush.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.unformatted/flush.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.unformatted/flush.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.unformatted/flush.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// basic_ostream& flush();
+
+#include <ostream>
+#include <cassert>
+
+int sync_called = 0;
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+public:
+    testbuf()
+    {
+    }
+
+protected:
+
+    virtual int
+        sync()
+        {
+            if (sync_called++ == 1)
+                return -1;
+            return 0;
+        }
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os.flush();
+        assert(os.good());
+        assert(sync_called == 1);
+        os.flush();
+        assert(os.bad());
+        assert(sync_called == 2);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// basic_ostream<charT,traits>& put(char_type c);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::wostream os((std::wstreambuf*)0);
+        wchar_t c = L'a';
+        os.put(c);
+        assert(os.bad());
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        wchar_t c = L'a';
+        os.put(c);
+        assert(sb.str() == L"a");
+        assert(os.good());
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        char c = 'a';
+        os.put(c);
+        assert(sb.str() == "a");
+        assert(os.good());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+//   class basic_ostream;
+
+// basic_ostream& write(const char_type* s, streamsize n);
+
+#include <ostream>
+#include <cassert>
+
+template <class CharT>
+class testbuf
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    std::basic_string<CharT> str_;
+public:
+    testbuf()
+    {
+    }
+
+    std::basic_string<CharT> str() const
+        {return std::basic_string<CharT>(base::pbase(), base::pptr());}
+
+protected:
+
+    virtual typename base::int_type
+        overflow(typename base::int_type __c = base::traits_type::eof())
+        {
+            if (__c != base::traits_type::eof())
+            {
+                int n = str_.size();
+                str_.push_back(__c);
+                str_.resize(str_.capacity());
+                base::setp(const_cast<CharT*>(str_.data()),
+                           const_cast<CharT*>(str_.data() + str_.size()));
+                base::pbump(n+1);
+            }
+            return __c;
+        }
+};
+
+int main()
+{
+    {
+        std::wostream os((std::wstreambuf*)0);
+        const wchar_t s[] = L"123456790";
+        os.write(s, sizeof(s)/sizeof(s[0])-1);
+        assert(os.bad());
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        const wchar_t s[] = L"123456790";
+        os.write(s, sizeof(s)/sizeof(s[0])-1);
+        assert(os.good());
+        assert(sb.str() == s);
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        const char s[] = "123456790";
+        os.write(s, sizeof(s)/sizeof(s[0])-1);
+        assert(sb.str() == s);
+        assert(os.good());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream/types.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream/types.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream
+//     : virtual public basic_ios<charT,traits>
+// {
+// public:
+//     // types (inherited from basic_ios (27.5.4)):
+//     typedef charT                          char_type;
+//     typedef traits                         traits_type;
+//     typedef typename traits_type::int_type int_type;
+//     typedef typename traits_type::pos_type pos_type;
+//     typedef typename traits_type::off_type off_type;
+
+#include <ostream>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::basic_ios<char>, std::basic_ostream<char> >::value), "");
+    static_assert((std::is_same<std::basic_ostream<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::basic_ostream<char>::traits_type, std::char_traits<char> >::value), "");
+    static_assert((std::is_same<std::basic_ostream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+    static_assert((std::is_same<std::basic_ostream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+    static_assert((std::is_same<std::basic_ostream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream_sentry/construct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream_sentry/construct.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream_sentry/construct.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream_sentry/construct.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream::sentry;
+
+// explicit sentry(basic_ostream<charT,traits>& os);
+
+#include <ostream>
+#include <cassert>
+
+int sync_called = 0;
+
+template <class CharT>
+struct testbuf1
+    : public std::basic_streambuf<CharT>
+{
+    testbuf1() {}
+
+protected:
+
+    int virtual sync()
+    {
+        ++sync_called;
+        return 1;
+    }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        std::ostream::sentry s(os);
+        assert(!bool(s));
+    }
+    {
+        testbuf1<char> sb;
+        std::ostream os(&sb);
+        std::ostream::sentry s(os);
+        assert(bool(s));
+    }
+    {
+        testbuf1<char> sb;
+        std::ostream os(&sb);
+        testbuf1<char> sb2;
+        std::ostream os2(&sb2);
+        os.tie(&os2);
+        assert(sync_called == 0);
+        std::ostream::sentry s(os);
+        assert(bool(s));
+        assert(sync_called == 1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream::sentry;
+
+// ~sentry();
+
+#include <ostream>
+#include <cassert>
+
+int sync_called = 0;
+
+template <class CharT>
+struct testbuf1
+    : public std::basic_streambuf<CharT>
+{
+    testbuf1() {}
+
+protected:
+
+    int virtual sync()
+    {
+        ++sync_called;
+        return 1;
+    }
+};
+
+int main()
+{
+    {
+        std::ostream os((std::streambuf*)0);
+        std::ostream::sentry s(os);
+        assert(!bool(s));
+    }
+    assert(sync_called == 0);
+    {
+        testbuf1<char> sb;
+        std::ostream os(&sb);
+        std::ostream::sentry s(os);
+        assert(bool(s));
+    }
+    assert(sync_called == 0);
+    {
+        testbuf1<char> sb;
+        std::ostream os(&sb);
+        std::ostream::sentry s(os);
+        assert(bool(s));
+        unitbuf(os);
+    }
+    assert(sync_called == 1);
+    {
+        testbuf1<char> sb;
+        std::ostream os(&sb);
+        try
+        {
+            std::ostream::sentry s(os);
+            assert(bool(s));
+            unitbuf(os);
+            throw 1;
+        }
+        catch (...)
+        {
+        }
+        assert(sync_called == 1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/output.streams/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/output.streams/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/output.streams/version.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/output.streams/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+#include <ostream>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,219 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// quoted
+
+#include <iomanip>
+#include <sstream>
+#include <string>
+#include <cassert>
+
+#if _LIBCPP_STD_VER > 11
+
+bool is_skipws ( const std::istream *is ) {
+    return ( is->flags() & std::ios_base::skipws ) != 0;
+    }
+
+
+bool is_skipws ( const std::wistream *is ) {
+    return ( is->flags() & std::ios_base::skipws ) != 0;
+    }
+
+void both_ways ( const char *p ) {
+    std::string str(p);
+    auto q = std::quoted(str);
+
+    std::stringstream ss;
+    bool skippingws = is_skipws ( &ss );
+    ss << q;
+    ss >> q;
+    }
+
+void round_trip ( const char *p ) {
+    std::stringstream ss;
+    bool skippingws = is_skipws ( &ss );
+    ss << std::quoted(p);
+    std::string s;
+    ss >> std::quoted(s);
+    assert ( s == p );
+    assert ( skippingws == is_skipws ( &ss ));
+    }
+
+void round_trip_ws ( const char *p ) {
+    std::stringstream ss;
+    std::noskipws ( ss );
+    bool skippingws = is_skipws ( &ss );
+    ss << std::quoted(p);
+    std::string s;
+    ss >> std::quoted(s);
+    assert ( s == p );
+    assert ( skippingws == is_skipws ( &ss ));
+    }
+
+void round_trip_d ( const char *p, char delim ) {
+    std::stringstream ss;
+    ss << std::quoted(p, delim);
+    std::string s;
+    ss >> std::quoted(s, delim);
+    assert ( s == p );
+    }
+
+void round_trip_e ( const char *p, char escape ) {
+    std::stringstream ss;
+    ss << std::quoted(p, '"', escape );
+    std::string s;
+    ss >> std::quoted(s, '"', escape );
+    assert ( s == p );
+    }
+
+
+
+std::string quote ( const char *p, char delim='"', char escape='\\' ) {
+    std::stringstream ss;
+    ss << std::quoted(p, delim, escape);
+    std::string s;
+    ss >> s;    // no quote
+    return s;
+}
+
+std::string unquote ( const char *p, char delim='"', char escape='\\' ) {
+    std::stringstream ss;
+    ss << p;
+    std::string s;
+    ss >> std::quoted(s, delim, escape);
+    return s;
+}
+
+void test_padding () {
+    {
+    std::stringstream ss;
+    ss << std::left << std::setw(10) << std::setfill('!') << std::quoted("abc", '`');
+    assert ( ss.str() == "`abc`!!!!!" );
+    }
+    
+    {
+    std::stringstream ss;
+    ss << std::right << std::setw(10) << std::setfill('!') << std::quoted("abc", '`');
+    assert ( ss.str() == "!!!!!`abc`" );
+    }
+}
+
+
+void round_trip ( const wchar_t *p ) {
+    std::wstringstream ss;
+    bool skippingws = is_skipws ( &ss );
+    ss << std::quoted(p);
+    std::wstring s;
+    ss >> std::quoted(s);
+    assert ( s == p );
+    assert ( skippingws == is_skipws ( &ss ));
+    }
+    
+
+void round_trip_ws ( const wchar_t *p ) {
+    std::wstringstream ss;
+    std::noskipws ( ss );
+    bool skippingws = is_skipws ( &ss );
+    ss << std::quoted(p);
+    std::wstring s;
+    ss >> std::quoted(s);
+    assert ( s == p );
+    assert ( skippingws == is_skipws ( &ss ));
+    }
+
+void round_trip_d ( const wchar_t *p, wchar_t delim ) {
+    std::wstringstream ss;
+    ss << std::quoted(p, delim);
+    std::wstring s;
+    ss >> std::quoted(s, delim);
+    assert ( s == p );
+    }
+
+void round_trip_e ( const wchar_t *p, wchar_t escape ) {
+    std::wstringstream ss;
+    ss << std::quoted(p, wchar_t('"'), escape );
+    std::wstring s;
+    ss >> std::quoted(s, wchar_t('"'), escape );
+    assert ( s == p );
+    }
+
+
+std::wstring quote ( const wchar_t *p, wchar_t delim='"', wchar_t escape='\\' ) {
+    std::wstringstream ss;
+    ss << std::quoted(p, delim, escape);
+    std::wstring s;
+    ss >> s;    // no quote
+    return s;
+}
+
+std::wstring unquote ( const wchar_t *p, wchar_t delim='"', wchar_t escape='\\' ) {
+    std::wstringstream ss;
+    ss << p;
+    std::wstring s;
+    ss >> std::quoted(s, delim, escape);
+    return s;
+}
+
+int main()
+{
+    both_ways ( "" );   // This is a compilation check
+
+    round_trip    (  "" );
+    round_trip_ws (  "" );
+    round_trip_d  (  "", 'q' );
+    round_trip_e  (  "", 'q' );
+    
+    round_trip    ( L"" );
+    round_trip_ws ( L"" );
+    round_trip_d  ( L"", 'q' );
+    round_trip_e  ( L"", 'q' );
+    
+    round_trip    (  "Hi" );
+    round_trip_ws (  "Hi" );
+    round_trip_d  (  "Hi", '!' );
+    round_trip_e  (  "Hi", '!' );
+    assert ( quote ( "Hi", '!' ) == "!Hi!" );
+    assert ( quote ( "Hi!", '!' ) == R"(!Hi\!!)" );
+    
+    round_trip    ( L"Hi" );
+    round_trip_ws ( L"Hi" );
+    round_trip_d  ( L"Hi", '!' );
+    round_trip_e  ( L"Hi", '!' );
+    assert ( quote ( L"Hi", '!' )  == L"!Hi!" );
+    assert ( quote ( L"Hi!", '!' ) == LR"(!Hi\!!)" );
+    
+    round_trip    (  "Hi Mom" );
+    round_trip_ws (  "Hi Mom" );
+    round_trip    ( L"Hi Mom" );
+    round_trip_ws ( L"Hi Mom" );
+    
+    assert ( quote (  "" )  ==  "\"\"" );
+    assert ( quote ( L"" )  == L"\"\"" );
+    assert ( quote (  "a" ) ==  "\"a\"" );
+    assert ( quote ( L"a" ) == L"\"a\"" );
+
+//  missing end quote - must not hang
+    assert ( unquote (  "\"abc" ) ==  "abc" );
+    assert ( unquote ( L"\"abc" ) == L"abc" );
+    
+    assert ( unquote (  "abc" ) == "abc" ); // no delimiter
+    assert ( unquote ( L"abc" ) == L"abc" ); // no delimiter
+    assert ( unquote (  "abc def" ) ==  "abc" ); // no delimiter
+    assert ( unquote ( L"abc def" ) == L"abc" ); // no delimiter
+
+    assert ( unquote (  "" ) ==  "" ); // nothing there
+    assert ( unquote ( L"" ) == L"" ); // nothing there
+    test_padding ();
+    }
+
+#else
+int main() {}
+#endif

Added: libcxx/trunk/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// quoted
+
+#include <iomanip>
+#include <sstream>
+#include <string>
+#include <cassert>
+
+#if _LIBCPP_STD_VER > 11
+
+void round_trip ( const char *p ) {
+    std::wstringstream ss;
+    ss << std::quoted(p);
+    std::string s;
+    ss >> std::quoted(s);
+    }
+
+
+
+int main()
+{
+    round_trip ( "Hi Mom" );   
+}
+#else
+#error
+#endif

Added: libcxx/trunk/test/std/input.output/iostream.format/quoted.manip/quoted_traits.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/quoted.manip/quoted_traits.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/quoted.manip/quoted_traits.fail.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/quoted.manip/quoted_traits.fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// quoted
+
+#include <iomanip>
+#include <sstream>
+#include <string>
+#include <cassert>
+
+#if _LIBCPP_STD_VER > 11
+
+template <class charT>
+struct test_traits
+{
+    typedef charT     char_type;
+};
+
+void round_trip ( const char *p ) {
+    std::stringstream ss;
+    ss << std::quoted(p);
+    std::basic_string<char, test_traits<char>> s;
+    ss >> std::quoted(s);
+    }
+
+
+
+int main()
+{
+    round_trip ( "Hi Mom" );   
+}
+#else
+#error
+#endif

Added: libcxx/trunk/test/std/input.output/iostream.format/std.manip/resetiosflags.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/std.manip/resetiosflags.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/std.manip/resetiosflags.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/std.manip/resetiosflags.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// T1 resetiosflags(ios_base::fmtflags mask);
+
+#include <iomanip>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::istream is(&sb);
+        assert(is.flags() & std::ios_base::skipws);
+        is >> std::resetiosflags(std::ios_base::skipws);
+        assert(!(is.flags() & std::ios_base::skipws));
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        assert(os.flags() & std::ios_base::skipws);
+        os << std::resetiosflags(std::ios_base::skipws);
+        assert(!(os.flags() & std::ios_base::skipws));
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wistream is(&sb);
+        assert(is.flags() & std::ios_base::skipws);
+        is >> std::resetiosflags(std::ios_base::skipws);
+        assert(!(is.flags() & std::ios_base::skipws));
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        assert(os.flags() & std::ios_base::skipws);
+        os << std::resetiosflags(std::ios_base::skipws);
+        assert(!(os.flags() & std::ios_base::skipws));
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/std.manip/setbase.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/std.manip/setbase.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/std.manip/setbase.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/std.manip/setbase.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// T3 setbase(int base);
+
+#include <iomanip>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::istream is(&sb);
+        is >> std::setbase(8);
+        assert((is.flags() & std::ios_base::basefield) == std::ios_base::oct);
+        is >> std::setbase(10);
+        assert((is.flags() & std::ios_base::basefield) == std::ios_base::dec);
+        is >> std::setbase(16);
+        assert((is.flags() & std::ios_base::basefield) == std::ios_base::hex);
+        is >> std::setbase(15);
+        assert((is.flags() & std::ios_base::basefield) == 0);
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os << std::setbase(8);
+        assert((os.flags() & std::ios_base::basefield) == std::ios_base::oct);
+        os << std::setbase(10);
+        assert((os.flags() & std::ios_base::basefield) == std::ios_base::dec);
+        os << std::setbase(16);
+        assert((os.flags() & std::ios_base::basefield) == std::ios_base::hex);
+        os << std::setbase(15);
+        assert((os.flags() & std::ios_base::basefield) == 0);
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wistream is(&sb);
+        is >> std::setbase(8);
+        assert((is.flags() & std::ios_base::basefield) == std::ios_base::oct);
+        is >> std::setbase(10);
+        assert((is.flags() & std::ios_base::basefield) == std::ios_base::dec);
+        is >> std::setbase(16);
+        assert((is.flags() & std::ios_base::basefield) == std::ios_base::hex);
+        is >> std::setbase(15);
+        assert((is.flags() & std::ios_base::basefield) == 0);
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        os << std::setbase(8);
+        assert((os.flags() & std::ios_base::basefield) == std::ios_base::oct);
+        os << std::setbase(10);
+        assert((os.flags() & std::ios_base::basefield) == std::ios_base::dec);
+        os << std::setbase(16);
+        assert((os.flags() & std::ios_base::basefield) == std::ios_base::hex);
+        os << std::setbase(15);
+        assert((os.flags() & std::ios_base::basefield) == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/std.manip/setfill.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/std.manip/setfill.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/std.manip/setfill.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/std.manip/setfill.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// template<charT> T4 setfill(charT c);
+
+#include <iomanip>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os << std::setfill('*');
+        assert(os.fill() == '*');
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        os << std::setfill(L'*');
+        assert(os.fill() == L'*');
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/std.manip/setiosflags.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/std.manip/setiosflags.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/std.manip/setiosflags.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/std.manip/setiosflags.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// T2 setiosflags (ios_base::fmtflags mask);
+
+#include <iomanip>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::istream is(&sb);
+        assert(!(is.flags() & std::ios_base::oct));
+        is >> std::setiosflags(std::ios_base::oct);
+        assert(is.flags() & std::ios_base::oct);
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        assert(!(os.flags() & std::ios_base::oct));
+        os << std::setiosflags(std::ios_base::oct);
+        assert(os.flags() & std::ios_base::oct);
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wistream is(&sb);
+        assert(!(is.flags() & std::ios_base::oct));
+        is >> std::setiosflags(std::ios_base::oct);
+        assert(is.flags() & std::ios_base::oct);
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        assert(!(os.flags() & std::ios_base::oct));
+        os << std::setiosflags(std::ios_base::oct);
+        assert(os.flags() & std::ios_base::oct);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/std.manip/setprecision.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/std.manip/setprecision.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/std.manip/setprecision.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/std.manip/setprecision.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// T5 setprecision(int n);
+
+#include <iomanip>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::istream is(&sb);
+        is >> std::setprecision(10);
+        assert(is.precision() == 10);
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os << std::setprecision(10);
+        assert(os.precision() == 10);
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wistream is(&sb);
+        is >> std::setprecision(10);
+        assert(is.precision() == 10);
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        os << std::setprecision(10);
+        assert(os.precision() == 10);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/std.manip/setw.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/std.manip/setw.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/std.manip/setw.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/std.manip/setw.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// T6 setw(int n);
+
+#include <iomanip>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_streambuf<CharT>
+{
+    testbuf() {}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb;
+        std::istream is(&sb);
+        is >> std::setw(10);
+        assert(is.width() == 10);
+    }
+    {
+        testbuf<char> sb;
+        std::ostream os(&sb);
+        os << std::setw(10);
+        assert(os.width() == 10);
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wistream is(&sb);
+        is >> std::setw(10);
+        assert(is.width() == 10);
+    }
+    {
+        testbuf<wchar_t> sb;
+        std::wostream os(&sb);
+        os << std::setw(10);
+        assert(os.width() == 10);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.format/std.manip/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/std.manip/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/std.manip/version.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/std.manip/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+#include <iomanip>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/input.output/iostream.forward/iosfwd.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.forward/iosfwd.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.forward/iosfwd.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.forward/iosfwd.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,142 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iosfwd>
+
+#include <iosfwd>
+#include <cwchar>  // for mbstate_t
+
+int main()
+{
+    {
+    std::char_traits<char>*               t1 = 0;
+    std::char_traits<wchar_t>*            t2 = 0;
+    std::char_traits<unsigned short>*     t3 = 0;
+    }
+    {
+    std::basic_ios<char>*                 t1 = 0;
+    std::basic_ios<wchar_t>*              t2 = 0;
+    std::basic_ios<unsigned short>*       t3 = 0;
+    }
+    {
+    std::basic_streambuf<char>*           t1 = 0;
+    std::basic_streambuf<wchar_t>*        t2 = 0;
+    std::basic_streambuf<unsigned short>* t3 = 0;
+    }
+    {
+    std::basic_istream<char>*             t1 = 0;
+    std::basic_istream<wchar_t>*          t2 = 0;
+    std::basic_istream<unsigned short>*   t3 = 0;
+    }
+    {
+    std::basic_ostream<char>*             t1 = 0;
+    std::basic_ostream<wchar_t>*          t2 = 0;
+    std::basic_ostream<unsigned short>*   t3 = 0;
+    }
+    {
+    std::basic_iostream<char>*             t1 = 0;
+    std::basic_iostream<wchar_t>*          t2 = 0;
+    std::basic_iostream<unsigned short>*   t3 = 0;
+    }
+    {
+    std::basic_stringbuf<char>*             t1 = 0;
+    std::basic_stringbuf<wchar_t>*          t2 = 0;
+    std::basic_stringbuf<unsigned short>*   t3 = 0;
+    }
+    {
+    std::basic_istringstream<char>*             t1 = 0;
+    std::basic_istringstream<wchar_t>*          t2 = 0;
+    std::basic_istringstream<unsigned short>*   t3 = 0;
+    }
+    {
+    std::basic_ostringstream<char>*             t1 = 0;
+    std::basic_ostringstream<wchar_t>*          t2 = 0;
+    std::basic_ostringstream<unsigned short>*   t3 = 0;
+    }
+    {
+    std::basic_stringstream<char>*             t1 = 0;
+    std::basic_stringstream<wchar_t>*          t2 = 0;
+    std::basic_stringstream<unsigned short>*   t3 = 0;
+    }
+    {
+    std::basic_filebuf<char>*             t1 = 0;
+    std::basic_filebuf<wchar_t>*          t2 = 0;
+    std::basic_filebuf<unsigned short>*   t3 = 0;
+    }
+    {
+    std::basic_ifstream<char>*             t1 = 0;
+    std::basic_ifstream<wchar_t>*          t2 = 0;
+    std::basic_ifstream<unsigned short>*   t3 = 0;
+    }
+    {
+    std::basic_ofstream<char>*             t1 = 0;
+    std::basic_ofstream<wchar_t>*          t2 = 0;
+    std::basic_ofstream<unsigned short>*   t3 = 0;
+    }
+    {
+    std::basic_fstream<char>*             t1 = 0;
+    std::basic_fstream<wchar_t>*          t2 = 0;
+    std::basic_fstream<unsigned short>*   t3 = 0;
+    }
+    {
+    std::istreambuf_iterator<char>*             t1 = 0;
+    std::istreambuf_iterator<wchar_t>*          t2 = 0;
+    std::istreambuf_iterator<unsigned short>*   t3 = 0;
+    }
+    {
+    std::ostreambuf_iterator<char>*             t1 = 0;
+    std::ostreambuf_iterator<wchar_t>*          t2 = 0;
+    std::ostreambuf_iterator<unsigned short>*   t3 = 0;
+    }
+    {
+    std::ios*           t1 = 0;
+    std::wios*          t2 = 0;
+    }
+    {
+    std::streambuf*        t1 = 0;
+    std::istream*          t2 = 0;
+    std::ostream*          t3 = 0;
+    std::iostream*         t4 = 0;
+    }
+    {
+    std::stringbuf*            t1 = 0;
+    std::istringstream*        t2 = 0;
+    std::ostringstream*        t3 = 0;
+    std::stringstream*         t4 = 0;
+    }
+    {
+    std::filebuf*         t1 = 0;
+    std::ifstream*        t2 = 0;
+    std::ofstream*        t3 = 0;
+    std::fstream*         t4 = 0;
+    }
+    {
+    std::wstreambuf*        t1 = 0;
+    std::wistream*          t2 = 0;
+    std::wostream*          t3 = 0;
+    std::wiostream*         t4 = 0;
+    }
+    {
+    std::wstringbuf*            t1 = 0;
+    std::wistringstream*        t2 = 0;
+    std::wostringstream*        t3 = 0;
+    std::wstringstream*         t4 = 0;
+    }
+    {
+    std::wfilebuf*         t1 = 0;
+    std::wifstream*        t2 = 0;
+    std::wofstream*        t3 = 0;
+    std::wfstream*         t4 = 0;
+    }
+    {
+    std::fpos<std::mbstate_t>*   t1 = 0;
+    std::streampos*              t2 = 0;
+    std::wstreampos*             t3 = 0;
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostream.forward/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.forward/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.forward/version.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.forward/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iosfwd>
+
+#include <iosfwd>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iostream>
+
+// istream cerr;
+
+#include <iostream>
+#include <cassert>
+
+int main()
+{
+#if 0
+    std::cerr << "Hello World!\n";
+#else
+    assert(std::cerr.tie() == &std::cout);
+    assert(std::cerr.flags() & std::ios_base::unitbuf);
+#endif  // 0
+}

Added: libcxx/trunk/test/std/input.output/iostream.objects/narrow.stream.objects/cin.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.objects/narrow.stream.objects/cin.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.objects/narrow.stream.objects/cin.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.objects/narrow.stream.objects/cin.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iostream>
+
+// istream cin;
+
+#include <iostream>
+#include <cassert>
+
+int main()
+{
+#if 0
+    std::cout << "Hello World!\n";
+    int i;
+    std::cout << "Enter a number: ";
+    std::cin >> i;
+    std::cout << "The number is : " << i << '\n';
+#else  // 0
+    assert(std::cin.tie() == &std::cout);
+#endif
+}

Added: libcxx/trunk/test/std/input.output/iostream.objects/narrow.stream.objects/clog.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.objects/narrow.stream.objects/clog.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.objects/narrow.stream.objects/clog.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.objects/narrow.stream.objects/clog.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iostream>
+
+// istream clog;
+
+#include <iostream>
+
+int main()
+{
+#if 0
+    std::clog << "Hello World!\n";
+#else
+    (void)std::clog;
+#endif
+}

Added: libcxx/trunk/test/std/input.output/iostream.objects/narrow.stream.objects/cout.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.objects/narrow.stream.objects/cout.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.objects/narrow.stream.objects/cout.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.objects/narrow.stream.objects/cout.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iostream>
+
+// istream cout;
+
+#include <iostream>
+
+int main()
+{
+#if 0
+    std::cout << "Hello World!\n";
+    int i;
+    std::cout << "Enter a number: ";
+    std::cin >> i;
+    std::cout << "The number is : " << i << '\n';
+#else  // 0
+    (void)std::cout;
+#endif
+}

Added: libcxx/trunk/test/std/input.output/iostream.objects/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.objects/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.objects/version.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.objects/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iostream>
+
+#include <iostream>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iostream>
+
+// istream wcerr;
+
+#include <iostream>
+#include <cassert>
+
+int main()
+{
+#if 0
+    std::wcerr << L"Hello World!\n";
+#else
+    assert(std::wcerr.tie() == &std::wcout);
+    assert(std::wcerr.flags() & std::ios_base::unitbuf);
+#endif  // 0
+}

Added: libcxx/trunk/test/std/input.output/iostream.objects/wide.stream.objects/wcin.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.objects/wide.stream.objects/wcin.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.objects/wide.stream.objects/wcin.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.objects/wide.stream.objects/wcin.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iostream>
+
+// istream wcin;
+
+#include <iostream>
+#include <cassert>
+
+int main()
+{
+#if 0
+    std::wcout << L"Hello World!\n";
+    int i;
+    std::wcout << L"Enter a number: ";
+    std::wcin >> i;
+    std::wcout << L"The number is : " << i << L'\n';
+#else  // 0
+    assert(std::wcin.tie() == &std::wcout);
+#endif
+}

Added: libcxx/trunk/test/std/input.output/iostream.objects/wide.stream.objects/wclog.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.objects/wide.stream.objects/wclog.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.objects/wide.stream.objects/wclog.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.objects/wide.stream.objects/wclog.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iostream>
+
+// istream wclog;
+
+#include <iostream>
+
+int main()
+{
+#if 0
+    std::wclog << L"Hello World!\n";
+#else
+    (void)std::wclog;
+#endif
+}

Added: libcxx/trunk/test/std/input.output/iostream.objects/wide.stream.objects/wcout.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.objects/wide.stream.objects/wcout.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.objects/wide.stream.objects/wcout.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.objects/wide.stream.objects/wcout.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iostream>
+
+// istream wcout;
+
+#include <iostream>
+
+int main()
+{
+#if 0
+    std::wcout << L"Hello World!\n";
+#else
+    (void)std::wcout;
+#endif
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.members/state.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.members/state.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.members/state.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.members/state.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class StateT> class fpos
+
+// void state(stateT s);
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    std::fpos<int> f;
+    f.state(3);
+    assert(f.state() == 3);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/addition.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/addition.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/addition.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/addition.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class StateT> class fpos
+
+// Addition
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    typedef std::fpos<std::mbstate_t> P;
+    P p(5);
+    std::streamoff o(6);
+    P q = p + o;
+    assert(q == P(11));
+    p += o;
+    assert(p == q);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/ctor_int.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/ctor_int.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/ctor_int.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/ctor_int.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class StateT> class fpos
+
+// fpos(int)
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    typedef std::fpos<std::mbstate_t> P;
+    P p(5);
+    assert(p == P(5));
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/difference.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/difference.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/difference.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/difference.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class StateT> class fpos
+
+// Subraction with fpos
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    typedef std::fpos<std::mbstate_t> P;
+    P p(11);
+    P q(6);
+    std::streamoff o = p - q;
+    assert(o == 5);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/eq_int.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/eq_int.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/eq_int.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/eq_int.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class StateT> class fpos
+
+// == and !=
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    typedef std::fpos<std::mbstate_t> P;
+    P p(5);
+    P q(6);
+    assert(p == p);
+    assert(p != q);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/offset.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/offset.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/offset.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/offset.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class StateT> class fpos
+
+// converts to and from streamoff
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    typedef std::fpos<std::mbstate_t> P;
+    P p(std::streamoff(7));
+    std::streamoff offset(p);
+    assert(offset == 7);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/streamsize.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/streamsize.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/streamsize.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/streamsize.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// streamsize and streamoff interconvert
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    std::streamoff o(5);
+    std::streamsize sz(o);
+    assert(sz == 5);
+    std::streamoff o2(sz);
+    assert(o == o2);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/subtraction.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/subtraction.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/subtraction.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/fpos/fpos.operations/subtraction.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class StateT> class fpos
+
+// Subraction with offset
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    typedef std::fpos<std::mbstate_t> P;
+    P p(11);
+    std::streamoff o(6);
+    P q = p - o;
+    assert(q == P(5));
+    p -= o;
+    assert(p == q);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/fpos/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/fpos/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/fpos/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/fpos/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/input.output/iostreams.base/ios.base/fmtflags.state/flags.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// fmtflags flags() const;
+
+#include <ios>
+#include <cassert>
+
+class test
+    : public std::ios
+{
+public:
+    test()
+    {
+        init(0);
+    }
+};
+
+int main()
+{
+    const test t;
+    assert(t.flags() == (test::skipws | test::dec));
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags_fmtflags.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags_fmtflags.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags_fmtflags.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/flags_fmtflags.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// fmtflags flags(fmtflags fmtfl);
+
+#include <ios>
+#include <cassert>
+
+class test
+    : public std::ios
+{
+public:
+    test()
+    {
+        init(0);
+    }
+};
+
+int main()
+{
+    test t;
+    assert(t.flags() == (test::skipws | test::dec));
+    test::fmtflags f = t.flags(test::hex | test::right);
+    assert(f == (test::skipws | test::dec));
+    assert(t.flags() == (test::hex | test::right));
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// streamsize precision() const;
+
+#include <ios>
+#include <cassert>
+
+class test
+    : public std::ios
+{
+public:
+    test()
+    {
+        init(0);
+    }
+};
+
+int main()
+{
+    const test t;
+    assert(t.precision() == 6);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision_streamsize.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision_streamsize.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision_streamsize.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/precision_streamsize.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// streamsize precision(streamsize prec);
+
+#include <ios>
+#include <cassert>
+
+class test
+    : public std::ios
+{
+public:
+    test()
+    {
+        init(0);
+    }
+};
+
+int main()
+{
+    test t;
+    assert(t.precision() == 6);
+    std::streamsize p = t.precision(10);
+    assert(p == 6);
+    assert(t.precision() == 10);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// fmtflags setf(fmtflags fmtfl)
+
+#include <ios>
+#include <cassert>
+
+class test
+    : public std::ios
+{
+public:
+    test()
+    {
+        init(0);
+    }
+};
+
+int main()
+{
+    test t;
+    assert(t.flags() == (test::skipws | test::dec));
+    test::fmtflags f = t.setf(test::hex | test::right);
+    assert(f == (test::skipws | test::dec));
+    assert(t.flags() == (test::skipws | test::dec | test::hex | test::right));
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags_mask.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags_mask.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags_mask.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/setf_fmtflags_mask.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// fmtflags setf(fmtflags fmtfl, fmtflags mask);
+
+#include <ios>
+#include <cassert>
+
+class test
+    : public std::ios
+{
+public:
+    test()
+    {
+        init(0);
+    }
+};
+
+int main()
+{
+    test t;
+    assert(t.flags() == (test::skipws | test::dec));
+    test::fmtflags f = t.setf(test::hex | test::right, test::dec | test::right);
+    assert(f == (test::skipws | test::dec));
+    assert(t.flags() == (test::skipws | test::right));
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/unsetf_mask.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/unsetf_mask.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/unsetf_mask.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/unsetf_mask.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// void unsetf(fmtflags mask);
+
+#include <ios>
+#include <cassert>
+
+class test
+    : public std::ios
+{
+public:
+    test()
+    {
+        init(0);
+    }
+};
+
+int main()
+{
+    test t;
+    assert(t.flags() == (test::skipws | test::dec));
+    t.unsetf(test::dec | test::right);
+    assert(t.flags() == test::skipws);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// streamsize width() const;
+
+#include <ios>
+#include <cassert>
+
+class test
+    : public std::ios
+{
+public:
+    test()
+    {
+        init(0);
+    }
+};
+
+int main()
+{
+    const test t;
+    assert(t.width() == 0);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width_streamsize.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width_streamsize.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width_streamsize.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/fmtflags.state/width_streamsize.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// streamsize width(streamsize wide);
+
+#include <ios>
+#include <cassert>
+
+class test
+    : public std::ios
+{
+public:
+    test()
+    {
+        init(0);
+    }
+};
+
+int main()
+{
+    test t;
+    assert(t.width() == 0);
+    std::streamsize w = t.width(4);
+    assert(w == 0);
+    assert(t.width() == 4);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.callback/register_callback.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.callback/register_callback.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.callback/register_callback.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.callback/register_callback.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// void register_callback(event_callback fn, int index);
+
+#include <ios>
+#include <string>
+#include <locale>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+class test
+    : public std::ios
+{
+public:
+    test()
+    {
+        init(0);
+    }
+};
+
+int f1_called = 0;
+
+void f1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::imbue_event)
+    {
+        assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+        assert(index == 4);
+        ++f1_called;
+    }
+}
+
+int main()
+{
+    test t;
+    std::ios_base& b = t;
+    b.register_callback(f1, 4);
+    b.register_callback(f1, 4);
+    b.register_callback(f1, 4);
+    std::locale l = b.imbue(std::locale(LOCALE_en_US_UTF_8));
+    assert(f1_called == 3);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.cons/dtor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.cons/dtor.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.cons/dtor.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.cons/dtor.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ~ios_base()
+
+#include <ios>
+#include <string>
+#include <locale>
+#include <cassert>
+
+class test
+    : public std::ios
+{
+public:
+    test()
+    {
+        init(0);
+    }
+};
+
+bool f1_called = false;
+bool f2_called = false;
+bool f3_called = false;
+
+void f1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::erase_event)
+    {
+        assert(!f1_called);
+        assert( f2_called);
+        assert( f3_called);
+        assert(stream.getloc().name() == "C");
+        assert(index == 4);
+        f1_called = true;
+    }
+}
+
+void f2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::erase_event)
+    {
+        assert(!f1_called);
+        assert(!f2_called);
+        assert( f3_called);
+        assert(stream.getloc().name() == "C");
+        assert(index == 5);
+        f2_called = true;
+    }
+}
+
+void f3(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::erase_event)
+    {
+        assert(!f1_called);
+        assert(!f2_called);
+        assert(!f3_called);
+        assert(stream.getloc().name() == "C");
+        assert(index == 6);
+        f3_called = true;
+    }
+}
+
+int main()
+{
+    {
+        test t;
+        std::ios_base& b = t;
+        b.register_callback(f1, 4);
+        b.register_callback(f2, 5);
+        b.register_callback(f3, 6);
+    }
+    assert(f1_called);
+    assert(f2_called);
+    assert(f3_called);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.locales/getloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.locales/getloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.locales/getloc.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.locales/getloc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// locale getloc() const;
+
+#include <ios>
+#include <string>
+#include <cassert>
+
+class test
+    : public std::ios
+{
+public:
+    test()
+    {
+        init(0);
+    }
+};
+
+int main()
+{
+    const test t;
+    assert(t.getloc().name() == std::string("C"));
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.locales/imbue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.locales/imbue.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.locales/imbue.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.locales/imbue.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// locale imbue(const locale& loc);
+
+#include <ios>
+#include <string>
+#include <locale>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+class test
+    : public std::ios
+{
+public:
+    test()
+    {
+        init(0);
+    }
+};
+
+bool f1_called = false;
+bool f2_called = false;
+bool f3_called = false;
+
+void f1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::imbue_event)
+    {
+        assert(!f1_called);
+        assert( f2_called);
+        assert( f3_called);
+        assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+        assert(index == 4);
+        f1_called = true;
+    }
+}
+
+void f2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::imbue_event)
+    {
+        assert(!f1_called);
+        assert(!f2_called);
+        assert( f3_called);
+        assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+        assert(index == 5);
+        f2_called = true;
+    }
+}
+
+void f3(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::imbue_event)
+    {
+        assert(!f1_called);
+        assert(!f2_called);
+        assert(!f3_called);
+        assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+        assert(index == 6);
+        f3_called = true;
+    }
+}
+
+int main()
+{
+    test t;
+    std::ios_base& b = t;
+    b.register_callback(f1, 4);
+    b.register_callback(f2, 5);
+    b.register_callback(f3, 6);
+    std::locale l = b.imbue(std::locale(LOCALE_en_US_UTF_8));
+    assert(l.name() == std::string("C"));
+    assert(b.getloc().name() == std::string(LOCALE_en_US_UTF_8));
+    assert(f1_called);
+    assert(f2_called);
+    assert(f3_called);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.storage/iword.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.storage/iword.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.storage/iword.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.storage/iword.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// long& iword(int idx);
+
+#include <ios>
+#include <string>
+#include <cassert>
+
+class test
+    : public std::ios
+{
+public:
+    test()
+    {
+        init(0);
+    }
+};
+
+int main()
+{
+    test t;
+    std::ios_base& b = t;
+    for (int i = 0; i < 10000; ++i)
+    {
+        assert(b.iword(i) == 0);
+        b.iword(i) = i;
+        assert(b.iword(i) == i);
+        for (int j = 0; j <= i; ++j)
+            assert(b.iword(j) == j);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.storage/pword.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.storage/pword.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.storage/pword.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.storage/pword.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// void*& pword(int idx);
+
+#include <ios>
+#include <string>
+#include <cassert>
+#include <cstdint>
+
+class test
+    : public std::ios
+{
+public:
+    test()
+    {
+        init(0);
+    }
+};
+
+int main()
+{
+    test t;
+    std::ios_base& b = t;
+    for (std::intptr_t i = 0; i < 10000; ++i)
+    {
+        assert(b.pword(i) == 0);
+        b.pword(i) = (void*)i;
+        assert(b.pword(i) == (void*)i);
+        for (std::intptr_t j = 0; j <= i; ++j)
+            assert(b.pword(j) == (void*)j);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.storage/xalloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.storage/xalloc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.storage/xalloc.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.base.storage/xalloc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// static int xalloc();
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    assert(std::ios_base::xalloc() == 0);
+    assert(std::ios_base::xalloc() == 1);
+    assert(std::ios_base::xalloc() == 2);
+    assert(std::ios_base::xalloc() == 3);
+    assert(std::ios_base::xalloc() == 4);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.members.static/sync_with_stdio.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.members.static/sync_with_stdio.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.members.static/sync_with_stdio.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.members.static/sync_with_stdio.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// bool sync_with_stdio(bool sync = true);
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    assert( std::ios_base::sync_with_stdio(false));
+    assert(!std::ios_base::sync_with_stdio(false));
+    assert(!std::ios_base::sync_with_stdio(true));
+    assert( std::ios_base::sync_with_stdio(true));
+    assert( std::ios_base::sync_with_stdio());
+    assert( std::ios_base::sync_with_stdio(false));
+    assert(!std::ios_base::sync_with_stdio());
+    assert( std::ios_base::sync_with_stdio());
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_Init/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_Init/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_Init/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_Init/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/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_char_pointer_error_code.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base::failure
+
+// explicit failure(const char* msg, const error_code& ec = io_errc::stream);
+
+#include <ios>
+#include <string>
+#include <cassert>
+
+int main()
+{
+    {
+        std::string what_arg("io test message");
+        std::ios_base::failure se(what_arg.c_str(), make_error_code(std::errc::is_a_directory));
+        assert(se.code() == std::make_error_code(std::errc::is_a_directory));
+        std::string what_message(se.what());
+        assert(what_message.find(what_arg) != std::string::npos);
+        assert(what_message.find("Is a directory") != std::string::npos);
+    }
+    {
+        std::string what_arg("io test message");
+        std::ios_base::failure se(what_arg.c_str());
+        assert(se.code() == std::make_error_code(std::io_errc::stream));
+        std::string what_message(se.what());
+        assert(what_message.find(what_arg) != std::string::npos);
+        assert(what_message.find(std::iostream_category().message(static_cast<int>
+            (std::io_errc::stream))) != std::string::npos);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base::failure
+
+// explicit failure(const string& msg, const error_code& ec = io_errc::stream);
+
+#include <ios>
+#include <string>
+#include <cassert>
+
+int main()
+{
+    {
+        std::string what_arg("io test message");
+        std::ios_base::failure se(what_arg, make_error_code(std::errc::is_a_directory));
+        assert(se.code() == std::make_error_code(std::errc::is_a_directory));
+        std::string what_message(se.what());
+        assert(what_message.find(what_arg) != std::string::npos);
+        assert(what_message.find("Is a directory") != std::string::npos);
+    }
+    {
+        std::string what_arg("io test message");
+        std::ios_base::failure se(what_arg);
+        assert(se.code() == std::make_error_code(std::io_errc::stream));
+        std::string what_message(se.what());
+        assert(what_message.find(what_arg) != std::string::npos);
+        assert(what_message.find(std::iostream_category().message(static_cast<int>
+            (std::io_errc::stream))) != std::string::npos);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_fmtflags/fmtflags.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_fmtflags/fmtflags.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_fmtflags/fmtflags.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_fmtflags/fmtflags.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// static const fmtflags boolalpha;
+// static const fmtflags dec;
+// static const fmtflags fixed;
+// static const fmtflags hex;
+// static const fmtflags internal;
+// static const fmtflags left;
+// static const fmtflags oct;
+// static const fmtflags right;
+// static const fmtflags scientific;
+// static const fmtflags showbase;
+// static const fmtflags showpoint;
+// static const fmtflags showpos;
+// static const fmtflags skipws;
+// static const fmtflags unitbuf;
+// static const fmtflags uppercase;
+// static const fmtflags adjustfield = left | right | internal;
+// static const fmtflags basefield   = dec | oct | hex;
+// static const fmtflags floatfield  = scientific | fixed;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    assert(std::ios_base::boolalpha);
+    assert(std::ios_base::dec);
+    assert(std::ios_base::fixed);
+    assert(std::ios_base::hex);
+    assert(std::ios_base::internal);
+    assert(std::ios_base::left);
+    assert(std::ios_base::oct);
+    assert(std::ios_base::right);
+    assert(std::ios_base::scientific);
+    assert(std::ios_base::showbase);
+    assert(std::ios_base::showpoint);
+    assert(std::ios_base::showpos);
+    assert(std::ios_base::skipws);
+    assert(std::ios_base::unitbuf);
+    assert(std::ios_base::uppercase);
+
+    assert
+    (
+        ( std::ios_base::boolalpha
+        & std::ios_base::dec
+        & std::ios_base::fixed
+        & std::ios_base::hex
+        & std::ios_base::internal
+        & std::ios_base::left
+        & std::ios_base::oct
+        & std::ios_base::right
+        & std::ios_base::scientific
+        & std::ios_base::showbase
+        & std::ios_base::showpoint
+        & std::ios_base::showpos
+        & std::ios_base::skipws
+        & std::ios_base::unitbuf
+        & std::ios_base::uppercase) == 0
+    );
+
+    assert(std::ios_base::adjustfield == (std::ios_base::left
+                                        | std::ios_base::right
+                                        | std::ios_base::internal));
+    assert(std::ios_base::basefield == (std::ios_base::dec
+                                      | std::ios_base::oct
+                                      | std::ios_base::hex));
+    assert(std::ios_base::floatfield == (std::ios_base::scientific
+                                       | std::ios_base::fixed));
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_iostate/iostate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_iostate/iostate.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_iostate/iostate.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_iostate/iostate.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// static const iostate badbit;
+// static const iostate eofbit;
+// static const iostate failbit;
+// static const iostate goodbit = 0;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    assert(std::ios_base::badbit);
+    assert(std::ios_base::eofbit);
+    assert(std::ios_base::failbit);
+
+    assert
+    (
+        ( std::ios_base::badbit
+        & std::ios_base::eofbit
+        & std::ios_base::failbit) == 0
+    );
+
+    assert(std::ios_base::goodbit == 0);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_openmode/openmode.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_openmode/openmode.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_openmode/openmode.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_openmode/openmode.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// static const openmode app;
+// static const openmode ate;
+// static const openmode binary;
+// static const openmode in;
+// static const openmode out;
+// static const openmode trunc;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    assert(std::ios_base::app);
+    assert(std::ios_base::ate);
+    assert(std::ios_base::binary);
+    assert(std::ios_base::in);
+    assert(std::ios_base::out);
+    assert(std::ios_base::trunc);
+
+    assert
+    (
+        ( std::ios_base::app
+        & std::ios_base::ate
+        & std::ios_base::binary
+        & std::ios_base::in
+        & std::ios_base::out
+        & std::ios_base::trunc) == 0
+    );
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_seekdir/seekdir.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_seekdir/seekdir.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_seekdir/seekdir.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/ios_seekdir/seekdir.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// static const seekdir beg;
+// static const seekdir cur;
+// static const seekdir end;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    assert(std::ios_base::beg != std::ios_base::cur);
+    assert(std::ios_base::beg != std::ios_base::end);
+    assert(std::ios_base::cur != std::ios_base::end);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/ios.types/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/input.output/iostreams.base/ios.base/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios.base/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios.base/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios.base/nothing_to_do.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,16 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+#include <ios>
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.cons/ctor_streambuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.cons/ctor_streambuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.cons/ctor_streambuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.cons/ctor_streambuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// explicit basic_ios(basic_streambuf<charT,traits>* sb);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+int main()
+{
+    {
+        std::streambuf* sb = 0;
+        std::basic_ios<char> ios(sb);
+        assert(ios.rdbuf() == sb);
+        assert(ios.tie() == 0);
+        assert(ios.rdstate() == std::ios::badbit);
+        assert(ios.exceptions() == std::ios::goodbit);
+        assert(ios.flags() == (std::ios::skipws | std::ios::dec));
+        assert(ios.width() == 0);
+        assert(ios.precision() == 6);
+        assert(ios.fill() == ' ');
+        assert(ios.getloc() == std::locale());
+    }
+    {
+        std::streambuf* sb = (std::streambuf*)1;
+        std::basic_ios<char> ios(sb);
+        assert(ios.rdbuf() == sb);
+        assert(ios.tie() == 0);
+        assert(ios.rdstate() == std::ios::goodbit);
+        assert(ios.exceptions() == std::ios::goodbit);
+        assert(ios.flags() == (std::ios::skipws | std::ios::dec));
+        assert(ios.width() == 0);
+        assert(ios.precision() == 6);
+        assert(ios.fill() == ' ');
+        assert(ios.getloc() == std::locale());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,190 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// basic_ios& copyfmt(const basic_ios& rhs);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+struct testbuf
+    : public std::streambuf
+{
+};
+
+bool f1_called = false;
+bool f2_called = false;
+
+bool g1_called = false;
+bool g2_called = false;
+bool g3_called = false;
+
+void f1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::erase_event)
+    {
+        assert(!f1_called);
+        assert( f2_called);
+        assert(!g1_called);
+        assert(!g2_called);
+        assert(!g3_called);
+        assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+        assert(index == 4);
+        f1_called = true;
+    }
+}
+
+void f2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::erase_event)
+    {
+        assert(!f1_called);
+        assert(!f2_called);
+        assert(!g1_called);
+        assert(!g2_called);
+        assert(!g3_called);
+        assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+        assert(index == 5);
+        f2_called = true;
+    }
+}
+
+void g1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::copyfmt_event)
+    {
+        assert( f1_called);
+        assert( f2_called);
+        assert(!g1_called);
+        assert( g2_called);
+        assert( g3_called);
+        assert(stream.getloc().name() == LOCALE_fr_FR_UTF_8);
+        assert(index == 7);
+        g1_called = true;
+    }
+}
+
+void g2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::copyfmt_event)
+    {
+        assert( f1_called);
+        assert( f2_called);
+        assert(!g1_called);
+        assert(!g2_called);
+        assert( g3_called);
+        assert(stream.getloc().name() == LOCALE_fr_FR_UTF_8);
+        assert(index == 8);
+        g2_called = true;
+    }
+}
+
+void g3(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::copyfmt_event)
+    {
+        assert( f1_called);
+        assert( f2_called);
+        assert(!g1_called);
+        assert(!g2_called);
+        assert(!g3_called);
+        assert(stream.getloc().name() == LOCALE_fr_FR_UTF_8);
+        assert(index == 9);
+        g3_called = true;
+    }
+}
+
+int main()
+{
+    testbuf sb1;
+    std::ios ios1(&sb1);
+    ios1.flags(std::ios::boolalpha | std::ios::dec | std::ios::fixed);
+    ios1.precision(1);
+    ios1.width(11);
+    ios1.imbue(std::locale(LOCALE_en_US_UTF_8));
+    ios1.exceptions(std::ios::failbit);
+    ios1.setstate(std::ios::eofbit);
+    ios1.register_callback(f1, 4);
+    ios1.register_callback(f2, 5);
+    ios1.iword(0) = 1;
+    ios1.iword(1) = 2;
+    ios1.iword(2) = 3;
+    char c1, c2, c3;
+    ios1.pword(0) = &c1;
+    ios1.pword(1) = &c2;
+    ios1.pword(2) = &c3;
+    ios1.tie((std::ostream*)1);
+    ios1.fill('1');
+
+    testbuf sb2;
+    std::ios ios2(&sb2);
+    ios2.flags(std::ios::showpoint | std::ios::uppercase);
+    ios2.precision(2);
+    ios2.width(12);
+    ios2.imbue(std::locale(LOCALE_fr_FR_UTF_8));
+    ios2.exceptions(std::ios::eofbit);
+    ios2.setstate(std::ios::goodbit);
+    ios2.register_callback(g1, 7);
+    ios2.register_callback(g2, 8);
+    ios2.register_callback(g3, 9);
+    ios2.iword(0) = 4;
+    ios2.iword(1) = 5;
+    ios2.iword(2) = 6;
+    ios2.iword(3) = 7;
+    ios2.iword(4) = 8;
+    ios2.iword(5) = 9;
+    char d1, d2;
+    ios2.pword(0) = &d1;
+    ios2.pword(1) = &d2;
+    ios2.tie((std::ostream*)2);
+    ios2.fill('2');
+
+    ios1.copyfmt(ios1);
+    assert(!f1_called);
+
+    try
+    {
+        ios1.copyfmt(ios2);
+        assert(false);
+    }
+    catch (std::ios_base::failure&)
+    {
+    }
+    assert(ios1.rdstate() == std::ios::eofbit);
+    assert(ios1.rdbuf() == &sb1);
+    assert(ios1.flags() == (std::ios::showpoint | std::ios::uppercase));
+    assert(ios1.precision() == 2);
+    assert(ios1.width() == 12);
+    assert(ios1.getloc().name() == LOCALE_fr_FR_UTF_8);
+    assert(ios1.exceptions() == std::ios::eofbit);
+    assert(f1_called);
+    assert(f2_called);
+    assert(g1_called);
+    assert(g2_called);
+    assert(g3_called);
+    assert(ios1.iword(0) == 4);
+    assert(ios1.iword(1) == 5);
+    assert(ios1.iword(2) == 6);
+    assert(ios1.iword(3) == 7);
+    assert(ios1.iword(4) == 8);
+    assert(ios1.iword(5) == 9);
+    assert(ios1.pword(0) == &d1);
+    assert(ios1.pword(1) == &d2);
+    assert(ios1.tie() == (std::ostream*)2);
+    assert(ios1.fill() == '2');
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/fill.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/fill.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/fill.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/fill.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// char_type fill() const;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    const std::ios ios(0);
+    assert(ios.fill() == ' ');
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/fill_char_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/fill_char_type.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/fill_char_type.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/fill_char_type.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// char_type fill(char_type fillch);
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    std::ios ios(0);
+    assert(ios.fill() == ' ');
+    char c = ios.fill('*');
+    assert(c == ' ');
+    assert(ios.fill() == '*');
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/imbue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/imbue.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/imbue.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/imbue.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// locale imbue(const locale& loc);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+struct testbuf
+    : public std::streambuf
+{
+};
+
+bool f1_called = false;
+bool f2_called = false;
+bool f3_called = false;
+
+void f1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::imbue_event)
+    {
+        assert(!f1_called);
+        assert( f2_called);
+        assert( f3_called);
+        assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+        assert(index == 4);
+        f1_called = true;
+    }
+}
+
+void f2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::imbue_event)
+    {
+        assert(!f1_called);
+        assert(!f2_called);
+        assert( f3_called);
+        assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+        assert(index == 5);
+        f2_called = true;
+    }
+}
+
+void f3(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::imbue_event)
+    {
+        assert(!f1_called);
+        assert(!f2_called);
+        assert(!f3_called);
+        assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
+        assert(index == 6);
+        f3_called = true;
+    }
+}
+
+int main()
+{
+    {
+        std::ios ios(0);
+        ios.register_callback(f1, 4);
+        ios.register_callback(f2, 5);
+        ios.register_callback(f3, 6);
+        std::locale l = ios.imbue(std::locale(LOCALE_en_US_UTF_8));
+        assert(l.name() == std::string("C"));
+        assert(ios.getloc().name() == std::string(LOCALE_en_US_UTF_8));
+        assert(f1_called);
+        assert(f2_called);
+        assert(f3_called);
+    }
+    f1_called = false;
+    f2_called = false;
+    f3_called = false;
+    {
+        testbuf sb;
+        std::ios ios(&sb);
+        ios.register_callback(f1, 4);
+        ios.register_callback(f2, 5);
+        ios.register_callback(f3, 6);
+        std::locale l = ios.imbue(std::locale(LOCALE_en_US_UTF_8));
+        assert(l.name() == std::string("C"));
+        assert(ios.getloc().name() == std::string(LOCALE_en_US_UTF_8));
+        assert(sb.getloc().name() == std::string(LOCALE_en_US_UTF_8));
+        assert(f1_called);
+        assert(f2_called);
+        assert(f3_called);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/move.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.fr_FR.UTF-8
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// void move(basic_ios&& rhs);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+struct testbuf
+    : public std::streambuf
+{
+};
+
+struct testios
+    : public std::ios
+{
+    testios() {}
+    testios(std::streambuf* p) : std::ios(p) {}
+    void move(std::ios& x) {std::ios::move(x);}
+};
+
+bool f1_called = false;
+bool f2_called = false;
+
+bool g1_called = false;
+bool g2_called = false;
+bool g3_called = false;
+
+void f1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    f1_called = true;
+}
+
+void f2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    f2_called = true;
+}
+
+void g1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::imbue_event)
+    {
+        assert(index == 7);
+        g1_called = true;
+    }
+}
+
+void g2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::imbue_event)
+    {
+        assert(index == 8);
+        g2_called = true;
+    }
+}
+
+void g3(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    if (ev == std::ios_base::imbue_event)
+    {
+        assert(index == 9);
+        g3_called = true;
+    }
+}
+
+int main()
+{
+    testios ios1;
+    testbuf sb2;
+    std::ios ios2(&sb2);
+    ios2.flags(std::ios::showpoint | std::ios::uppercase);
+    ios2.precision(2);
+    ios2.width(12);
+    ios2.imbue(std::locale(LOCALE_fr_FR_UTF_8));
+    ios2.exceptions(std::ios::eofbit);
+    ios2.setstate(std::ios::goodbit);
+    ios2.register_callback(g1, 7);
+    ios2.register_callback(g2, 8);
+    ios2.register_callback(g3, 9);
+    ios2.iword(0) = 4;
+    ios2.iword(1) = 5;
+    ios2.iword(2) = 6;
+    ios2.iword(3) = 7;
+    ios2.iword(4) = 8;
+    ios2.iword(5) = 9;
+    char d1, d2;
+    ios2.pword(0) = &d1;
+    ios2.pword(1) = &d2;
+    ios2.tie((std::ostream*)2);
+    ios2.fill('2');
+
+    ios1.move(ios2);
+
+    assert(ios1.rdstate() == std::ios::goodbit);
+    assert(ios1.rdbuf() == 0);
+    assert(ios1.flags() == (std::ios::showpoint | std::ios::uppercase));
+    assert(ios1.precision() == 2);
+    assert(ios1.width() == 12);
+    assert(ios1.getloc().name() == LOCALE_fr_FR_UTF_8);
+    assert(ios1.exceptions() == std::ios::eofbit);
+    assert(!f1_called);
+    assert(!f2_called);
+    assert(!g1_called);
+    assert(!g2_called);
+    assert(!g3_called);
+    assert(ios1.iword(0) == 4);
+    assert(ios1.iword(1) == 5);
+    assert(ios1.iword(2) == 6);
+    assert(ios1.iword(3) == 7);
+    assert(ios1.iword(4) == 8);
+    assert(ios1.iword(5) == 9);
+    assert(ios1.pword(0) == &d1);
+    assert(ios1.pword(1) == &d2);
+    assert(ios1.tie() == (std::ostream*)2);
+    assert(ios1.fill() == '2');
+    ios1.imbue(std::locale("C"));
+    assert(!f1_called);
+    assert(!f2_called);
+    assert(g1_called);
+    assert(g2_called);
+    assert(g3_called);
+
+    assert(ios2.rdbuf() == &sb2);
+    assert(ios2.tie() == 0);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/narow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/narow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/narow.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/narow.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// char narrow(char_type c, char dfault) const;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    const std::ios ios(0);
+    assert(ios.narrow('c', '*') == 'c');
+    assert(ios.narrow('\xFE', '*') == '*');
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// basic_streambuf<charT,traits>* rdbuf() const;
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+int main()
+{
+    {
+        const std::ios ios(0);
+        assert(ios.rdbuf() == 0);
+    }
+    {
+        std::streambuf* sb = (std::streambuf*)1;
+        const std::ios ios(sb);
+        assert(ios.rdbuf() == sb);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf_streambuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf_streambuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf_streambuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/rdbuf_streambuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* sb);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+int main()
+{
+    std::ios ios(0);
+    assert(ios.rdbuf() == 0);
+    assert(!ios.good());
+    std::streambuf* sb = (std::streambuf*)1;
+    std::streambuf* sb2 = ios.rdbuf(sb);
+    assert(sb2 == 0);
+    assert(ios.rdbuf() == sb);
+    assert(ios.good());
+    sb2 = ios.rdbuf(0);
+    assert(sb2 == (std::streambuf*)1);
+    assert(ios.rdbuf() == 0);
+    assert(ios.bad());
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// void set_rdbuf(basic_streambuf<charT, traits>* sb);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf
+    : public std::streambuf
+{
+};
+
+struct testios
+    : public std::ios
+{
+    testios(std::streambuf* p) : std::ios(p) {}
+    void set_rdbuf(std::streambuf* x) {std::ios::set_rdbuf(x);}
+};
+
+int main()
+{
+    testbuf sb1;
+    testbuf sb2;
+    testios ios(&sb1);
+    try
+    {
+        ios.setstate(std::ios::badbit);
+        ios.exceptions(std::ios::badbit);
+    }
+    catch (...)
+    {
+    }
+    ios.set_rdbuf(&sb2);
+    assert(ios.rdbuf() == &sb2);
+    try
+    {
+        ios.setstate(std::ios::badbit);
+        ios.exceptions(std::ios::badbit);
+    }
+    catch (...)
+    {
+    }
+    ios.set_rdbuf(0);
+    assert(ios.rdbuf() == 0);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,168 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// void move(basic_ios&& rhs);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+struct testbuf
+    : public std::streambuf
+{
+};
+
+struct testios
+    : public std::ios
+{
+    testios(std::streambuf* p) : std::ios(p) {}
+    void swap(std::ios& x) {std::ios::swap(x);}
+};
+
+bool f1_called = false;
+bool f2_called = false;
+
+bool g1_called = false;
+bool g2_called = false;
+bool g3_called = false;
+
+void f1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    assert(index == 4);
+    f1_called = true;
+}
+
+void f2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    assert(index == 5);
+    f2_called = true;
+}
+
+void g1(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    assert(index == 7);
+    g1_called = true;
+}
+
+void g2(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    assert(index == 8);
+    g2_called = true;
+}
+
+void g3(std::ios_base::event ev, std::ios_base& stream, int index)
+{
+    assert(index == 9);
+    g3_called = true;
+}
+
+int main()
+{
+    testbuf sb1;
+    testios ios1(&sb1);
+    ios1.flags(std::ios::boolalpha | std::ios::dec | std::ios::fixed);
+    ios1.precision(1);
+    ios1.width(11);
+    ios1.imbue(std::locale(LOCALE_en_US_UTF_8));
+    ios1.exceptions(std::ios::failbit);
+    ios1.setstate(std::ios::eofbit);
+    ios1.register_callback(f1, 4);
+    ios1.register_callback(f2, 5);
+    ios1.iword(0) = 1;
+    ios1.iword(1) = 2;
+    ios1.iword(2) = 3;
+    char c1, c2, c3;
+    ios1.pword(0) = &c1;
+    ios1.pword(1) = &c2;
+    ios1.pword(2) = &c3;
+    ios1.tie((std::ostream*)1);
+    ios1.fill('1');
+
+    testbuf sb2;
+    testios ios2(&sb2);
+    ios2.flags(std::ios::showpoint | std::ios::uppercase);
+    ios2.precision(2);
+    ios2.width(12);
+    ios2.imbue(std::locale(LOCALE_fr_FR_UTF_8));
+    ios2.exceptions(std::ios::eofbit);
+    ios2.setstate(std::ios::goodbit);
+    ios2.register_callback(g1, 7);
+    ios2.register_callback(g2, 8);
+    ios2.register_callback(g3, 9);
+    ios2.iword(0) = 4;
+    ios2.iword(1) = 5;
+    ios2.iword(2) = 6;
+    ios2.iword(3) = 7;
+    ios2.iword(4) = 8;
+    ios2.iword(5) = 9;
+    char d1, d2;
+    ios2.pword(0) = &d1;
+    ios2.pword(1) = &d2;
+    ios2.tie((std::ostream*)2);
+    ios2.fill('2');
+
+    ios1.swap(ios2);
+
+    assert(ios1.rdstate() == std::ios::goodbit);
+    assert(ios1.rdbuf() == &sb1);
+    assert(ios1.flags() == (std::ios::showpoint | std::ios::uppercase));
+    assert(ios1.precision() == 2);
+    assert(ios1.width() == 12);
+    assert(ios1.getloc().name() == LOCALE_fr_FR_UTF_8);
+    assert(ios1.exceptions() == std::ios::eofbit);
+    assert(!f1_called);
+    assert(!f2_called);
+    assert(!g1_called);
+    assert(!g2_called);
+    assert(!g3_called);
+    assert(ios1.iword(0) == 4);
+    assert(ios1.iword(1) == 5);
+    assert(ios1.iword(2) == 6);
+    assert(ios1.iword(3) == 7);
+    assert(ios1.iword(4) == 8);
+    assert(ios1.iword(5) == 9);
+    assert(ios1.pword(0) == &d1);
+    assert(ios1.pword(1) == &d2);
+    assert(ios1.tie() == (std::ostream*)2);
+    assert(ios1.fill() == '2');
+    ios1.imbue(std::locale("C"));
+    assert(!f1_called);
+    assert(!f2_called);
+    assert(g1_called);
+    assert(g2_called);
+    assert(g3_called);
+
+    assert(ios2.rdstate() == std::ios::eofbit);
+    assert(ios2.rdbuf() == &sb2);
+    assert(ios2.flags() == (std::ios::boolalpha | std::ios::dec | std::ios::fixed));
+    assert(ios2.precision() == 1);
+    assert(ios2.width() == 11);
+    assert(ios2.getloc().name() == LOCALE_en_US_UTF_8);
+    assert(ios2.exceptions() == std::ios::failbit);
+    assert(ios2.iword(0) == 1);
+    assert(ios2.iword(1) == 2);
+    assert(ios2.iword(2) == 3);
+    assert(ios2.pword(0) == &c1);
+    assert(ios2.pword(1) == &c2);
+    assert(ios2.pword(2) == &c3);
+    assert(ios2.tie() == (std::ostream*)1);
+    assert(ios2.fill() == '1');
+    ios2.imbue(std::locale("C"));
+    assert(f1_called);
+    assert(f2_called);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/tie.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/tie.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/tie.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/tie.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// basic_ostream<charT,traits>* tie() const;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    const std::basic_ios<char> ios(0);
+    assert(ios.tie() == 0);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/tie_ostream.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/tie_ostream.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/tie_ostream.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/tie_ostream.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// basic_ostream<charT,traits>* tie(basic_ostream<charT,traits>* tiestr);
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    std::ios ios(0);
+    std::ostream* os = (std::ostream*)1;
+    std::ostream* r = ios.tie(os);
+    assert(r == 0);
+    assert(ios.tie() == os);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/widen.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/widen.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/widen.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/widen.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// char_type widen(char c) const;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    const std::ios ios(0);
+    assert(ios.widen('c') == 'c');
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/bad.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/bad.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/bad.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/bad.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// bool bad() const;
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    {
+        std::ios ios(0);
+        assert(ios.bad());
+        ios.setstate(std::ios::eofbit);
+        assert(ios.bad());
+    }
+    {
+        testbuf sb;
+        std::ios ios(&sb);
+        assert(!ios.bad());
+        ios.setstate(std::ios::eofbit);
+        assert(!ios.bad());
+        ios.setstate(std::ios::failbit);
+        assert(!ios.bad());
+        ios.setstate(std::ios::badbit);
+        assert(ios.bad());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/bool.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/bool.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/bool.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/bool.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// operator unspecified-bool-type() const;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    std::ios ios(0);
+    assert(static_cast<bool>(ios) == !ios.fail());
+    ios.setstate(std::ios::failbit);
+    assert(static_cast<bool>(ios) == !ios.fail());
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/clear.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// void clear(iostate state = goodbit);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    {
+        std::ios ios(0);
+        ios.clear();
+        assert(ios.rdstate() == std::ios::badbit);
+        try
+        {
+            ios.exceptions(std::ios::badbit);
+        }
+        catch (...)
+        {
+        }
+        try
+        {
+            ios.clear();
+            assert(false);
+        }
+        catch (std::ios::failure&)
+        {
+            assert(ios.rdstate() == std::ios::badbit);
+        }
+        try
+        {
+            ios.clear(std::ios::eofbit);
+            assert(false);
+        }
+        catch (std::ios::failure&)
+        {
+            assert(ios.rdstate() == (std::ios::eofbit | std::ios::badbit));
+        }
+    }
+    {
+        testbuf sb;
+        std::ios ios(&sb);
+        ios.clear();
+        assert(ios.rdstate() == std::ios::goodbit);
+        ios.exceptions(std::ios::badbit);
+        ios.clear();
+        assert(ios.rdstate() == std::ios::goodbit);
+        ios.clear(std::ios::eofbit);
+        assert(ios.rdstate() == std::ios::eofbit);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/eof.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/eof.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/eof.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/eof.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// bool eof() const;
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    {
+        std::ios ios(0);
+        assert(!ios.eof());
+        ios.setstate(std::ios::eofbit);
+        assert(ios.eof());
+    }
+    {
+        testbuf sb;
+        std::ios ios(&sb);
+        assert(!ios.eof());
+        ios.setstate(std::ios::eofbit);
+        assert(ios.eof());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// iostate exceptions() const;
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    {
+        const std::ios ios(0);
+        assert(ios.exceptions() == std::ios::goodbit);
+    }
+    {
+        testbuf sb;
+        const std::ios ios(&sb);
+        assert(ios.exceptions() == std::ios::goodbit);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// iostate exceptions() const;
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    {
+        std::ios ios(0);
+        assert(ios.exceptions() == std::ios::goodbit);
+        ios.exceptions(std::ios::eofbit);
+        assert(ios.exceptions() == std::ios::eofbit);
+        try
+        {
+            ios.exceptions(std::ios::badbit);
+            assert(false);
+        }
+        catch (std::ios::failure&)
+        {
+        }
+        assert(ios.exceptions() == std::ios::badbit);
+    }
+    {
+        testbuf sb;
+        std::ios ios(&sb);
+        assert(ios.exceptions() == std::ios::goodbit);
+        ios.exceptions(std::ios::eofbit);
+        assert(ios.exceptions() == std::ios::eofbit);
+        ios.exceptions(std::ios::badbit);
+        assert(ios.exceptions() == std::ios::badbit);
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/fail.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/fail.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/fail.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// bool fail() const;
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    {
+        std::ios ios(0);
+        assert(ios.fail());
+        ios.setstate(std::ios::eofbit);
+        assert(ios.fail());
+    }
+    {
+        testbuf sb;
+        std::ios ios(&sb);
+        assert(!ios.fail());
+        ios.setstate(std::ios::eofbit);
+        assert(!ios.fail());
+        ios.setstate(std::ios::badbit);
+        assert(ios.fail());
+        ios.setstate(std::ios::failbit);
+        assert(ios.fail());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/good.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/good.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/good.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/good.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// bool good() const;
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    {
+        std::ios ios(0);
+        assert(!ios.good());
+    }
+    {
+        testbuf sb;
+        std::ios ios(&sb);
+        assert(ios.good());
+        ios.setstate(std::ios::eofbit);
+        assert(!ios.good());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/not.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/not.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/not.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/not.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// bool operator!() const;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    std::ios ios(0);
+    assert(!ios == ios.fail());
+    ios.setstate(std::ios::failbit);
+    assert(!ios == ios.fail());
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/rdstate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/rdstate.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/rdstate.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/rdstate.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// iostate rdstate() const;
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    std::ios ios(0);
+    assert(ios.rdstate() == std::ios::badbit);
+    ios.setstate(std::ios::failbit);
+    assert(ios.rdstate() == (std::ios::failbit | std::ios::badbit));
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/iostate.flags/setstate.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// void setstate(iostate state);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    {
+        std::ios ios(0);
+        ios.setstate(std::ios::goodbit);
+        assert(ios.rdstate() == std::ios::badbit);
+        try
+        {
+            ios.exceptions(std::ios::badbit);
+        }
+        catch (...)
+        {
+        }
+        try
+        {
+            ios.setstate(std::ios::goodbit);
+            assert(false);
+        }
+        catch (std::ios::failure&)
+        {
+            assert(ios.rdstate() == std::ios::badbit);
+        }
+        try
+        {
+            ios.setstate(std::ios::eofbit);
+            assert(false);
+        }
+        catch (std::ios::failure&)
+        {
+            assert(ios.rdstate() == (std::ios::eofbit | std::ios::badbit));
+        }
+    }
+    {
+        testbuf sb;
+        std::ios ios(&sb);
+        ios.setstate(std::ios::goodbit);
+        assert(ios.rdstate() == std::ios::goodbit);
+        ios.setstate(std::ios::eofbit);
+        assert(ios.rdstate() == std::ios::eofbit);
+        ios.setstate(std::ios::failbit);
+        assert(ios.rdstate() == (std::ios::eofbit | std::ios::failbit));
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/ios/types.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/ios/types.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ios : public ios_base
+// {
+// public:
+//     typedef charT char_type;
+//     typedef typename traits::int_type int_type;
+//     typedef typename traits::pos_type pos_type;
+//     typedef typename traits::off_type off_type;
+//     typedef traits traits_type;
+
+#include <ios>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::ios_base, std::basic_ios<char> >::value), "");
+    static_assert((std::is_same<std::basic_ios<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::basic_ios<char>::traits_type, std::char_traits<char> >::value), "");
+    static_assert((std::is_same<std::basic_ios<char>::int_type, std::char_traits<char>::int_type>::value), "");
+    static_assert((std::is_same<std::basic_ios<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+    static_assert((std::is_same<std::basic_ios<char>::off_type, std::char_traits<char>::off_type>::value), "");
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/internal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/internal.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/internal.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/internal.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& internal(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::internal(ios);
+    assert(&r == &ios);
+    assert(ios.flags() & std::ios::internal);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/left.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/left.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/left.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/left.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& left(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::left(ios);
+    assert(&r == &ios);
+    assert(ios.flags() & std::ios::left);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/right.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/right.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/right.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/adjustfield.manip/right.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& right(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::right(ios);
+    assert(&r == &ios);
+    assert(ios.flags() & std::ios::right);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/dec.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/dec.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/dec.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/dec.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& dec(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::dec(ios);
+    assert(&r == &ios);
+    assert(ios.flags() & std::ios::dec);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/hex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/hex.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/hex.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/hex.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& hex(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::hex(ios);
+    assert(&r == &ios);
+    assert(ios.flags() & std::ios::hex);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/oct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/oct.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/oct.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/basefield.manip/oct.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& oct(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::oct(ios);
+    assert(&r == &ios);
+    assert(ios.flags() & std::ios::oct);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/iostream_category.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/iostream_category.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/iostream_category.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/iostream_category.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// const error_category& iostream_category();
+
+#include <ios>
+#include <cassert>
+#include <string>
+
+int main()
+{
+    const std::error_category& e_cat1 = std::iostream_category();
+    std::string m1 = e_cat1.name();
+    assert(m1 == "iostream");
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/make_error_code.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/make_error_code.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/make_error_code.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/make_error_code.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// error_code make_error_code(io_errc e);
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    {
+        std::error_code ec = make_error_code(std::io_errc::stream);
+        assert(ec.value() == static_cast<int>(std::io_errc::stream));
+        assert(ec.category() == std::iostream_category());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/make_error_condition.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/make_error_condition.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/make_error_condition.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/error.reporting/make_error_condition.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// error_condition make_error_condition(io_errc e);
+
+#include <ios>
+#include <cassert>
+
+int main()
+{
+    {
+        const std::error_condition ec1 = std::make_error_condition(std::io_errc::stream);
+        assert(ec1.value() == static_cast<int>(std::io_errc::stream));
+        assert(ec1.category() == std::iostream_category());
+    }
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/defaultfloat.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/defaultfloat.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/defaultfloat.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/defaultfloat.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& defaultfloat(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::defaultfloat(ios);
+    assert(&r == &ios);
+    assert(!(ios.flags() & std::ios::fixed));
+    assert(!(ios.flags() & std::ios::scientific));
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/fixed.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/fixed.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/fixed.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/fixed.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& fixed(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::fixed(ios);
+    assert(&r == &ios);
+    assert(ios.flags() & std::ios::fixed);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/hexfloat.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/hexfloat.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/hexfloat.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/hexfloat.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& hexfloat(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::hexfloat(ios);
+    assert(&r == &ios);
+    assert(ios.flags() & std::ios::fixed);
+    assert(ios.flags() & std::ios::scientific);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/scientific.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/scientific.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/scientific.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/floatfield.manip/scientific.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& scientific(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::scientific(ios);
+    assert(&r == &ios);
+    assert(ios.flags() & std::ios::scientific);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/boolalpha.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/boolalpha.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/boolalpha.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/boolalpha.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& boolalpha(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::boolalpha(ios);
+    assert(&r == &ios);
+    assert(ios.flags() & std::ios::boolalpha);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noboolalpha.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noboolalpha.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noboolalpha.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noboolalpha.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& noboolalpha(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::boolalpha(ios);
+    std::ios_base& r = std::noboolalpha(ios);
+    assert(&r == &ios);
+    assert(!(ios.flags() & std::ios::boolalpha));
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowbase.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowbase.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowbase.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowbase.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& noshowbase(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::showbase(ios);
+    std::ios_base& r = std::noshowbase(ios);
+    assert(&r == &ios);
+    assert(!(ios.flags() & std::ios::showbase));
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowpoint.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowpoint.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowpoint.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowpoint.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& noshowpoint(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::showpoint(ios);
+    std::ios_base& r = std::noshowpoint(ios);
+    assert(&r == &ios);
+    assert(!(ios.flags() & std::ios::showpoint));
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowpos.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowpos.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowpos.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noshowpos.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& noshowpos(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::showpos(ios);
+    std::ios_base& r = std::noshowpos(ios);
+    assert(&r == &ios);
+    assert(!(ios.flags() & std::ios::showpos));
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noskipws.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noskipws.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noskipws.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/noskipws.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& noskipws(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::skipws(ios);
+    std::ios_base& r = std::noskipws(ios);
+    assert(&r == &ios);
+    assert(!(ios.flags() & std::ios::skipws));
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/nounitbuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/nounitbuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/nounitbuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/nounitbuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& nounitbuf(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::unitbuf(ios);
+    std::ios_base& r = std::nounitbuf(ios);
+    assert(&r == &ios);
+    assert(!(ios.flags() & std::ios::unitbuf));
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/nouppercase.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/nouppercase.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/nouppercase.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/nouppercase.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& nouppercase(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::uppercase(ios);
+    std::ios_base& r = std::nouppercase(ios);
+    assert(&r == &ios);
+    assert(!(ios.flags() & std::ios::uppercase));
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showbase.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showbase.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showbase.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showbase.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& showbase(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::showbase(ios);
+    assert(&r == &ios);
+    assert(ios.flags() & std::ios::showbase);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showpoint.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showpoint.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showpoint.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showpoint.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& showpoint(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::showpoint(ios);
+    assert(&r == &ios);
+    assert(ios.flags() & std::ios::showpoint);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showpos.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showpos.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showpos.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/showpos.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& showpos(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::showpos(ios);
+    assert(&r == &ios);
+    assert(ios.flags() & std::ios::showpos);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/skipws.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/skipws.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/skipws.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/skipws.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& skipws(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::skipws(ios);
+    assert(&r == &ios);
+    assert(ios.flags() & std::ios::skipws);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/unitbuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/unitbuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/unitbuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/unitbuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& unitbuf(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::unitbuf(ios);
+    assert(&r == &ios);
+    assert(ios.flags() & std::ios::unitbuf);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/uppercase.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/uppercase.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/uppercase.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/fmtflags.manip/uppercase.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// class ios_base
+
+// ios_base& uppercase(ios_base& str);
+
+#include <ios>
+#include <streambuf>
+#include <cassert>
+
+struct testbuf : public std::streambuf {};
+
+int main()
+{
+    testbuf sb;
+    std::ios ios(&sb);
+    std::ios_base& r = std::uppercase(ios);
+    assert(&r == &ios);
+    assert(ios.flags() & std::ios::uppercase);
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/std.ios.manip/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/input.output/iostreams.base/stream.types/streamoff.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/stream.types/streamoff.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/stream.types/streamoff.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/stream.types/streamoff.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// typedef OFF_T streamoff;
+
+#include <ios>
+#include <type_traits>
+
+int main()
+{
+    static_assert(std::is_integral<std::streamoff>::value, "");
+    static_assert(std::is_signed<std::streamoff>::value, "");
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/stream.types/streamsize.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/stream.types/streamsize.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/stream.types/streamsize.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/stream.types/streamsize.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// typedef SZ_T streamsize;
+
+#include <ios>
+#include <type_traits>
+
+int main()
+{
+    static_assert(std::is_integral<std::streamsize>::value, "");
+    static_assert(std::is_signed<std::streamsize>::value, "");
+}

Added: libcxx/trunk/test/std/input.output/iostreams.base/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.base/version.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.base/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+#include <ios>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/input.output/iostreams.requirements/iostream.limits.imbue/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.requirements/iostream.limits.imbue/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.requirements/iostream.limits.imbue/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.requirements/iostream.limits.imbue/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/input.output/iostreams.requirements/iostreams.limits.pos/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.requirements/iostreams.limits.pos/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.requirements/iostreams.limits.pos/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.requirements/iostreams.limits.pos/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/input.output/iostreams.requirements/iostreams.threadsafety/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.requirements/iostreams.threadsafety/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.requirements/iostreams.threadsafety/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.requirements/iostreams.threadsafety/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/input.output/iostreams.requirements/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.requirements/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostreams.requirements/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostreams.requirements/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/input.output/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/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/input.output/stream.buffers/streambuf.reqts/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf.reqts/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf.reqts/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf.reqts/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/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf(const basic_streambuf& rhs);  // protected
+
+#include <streambuf>
+#include <cassert>
+
+std::streambuf get();
+
+int main()
+{
+    std::streambuf sb = get();
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf(const basic_streambuf& rhs);
+
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    test() {}
+
+    test(const test& t)
+        : std::basic_streambuf<CharT>(t)
+    {
+        assert(this->eback() == t.eback());
+        assert(this->gptr()  == t.gptr());
+        assert(this->egptr() == t.egptr());
+        assert(this->pbase() == t.pbase());
+        assert(this->pptr()  == t.pptr());
+        assert(this->epptr() == t.epptr());
+        assert(this->getloc() == t.getloc());
+    }
+
+    void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+    {
+        base::setg(gbeg, gnext, gend);
+    }
+    void setp(CharT* pbeg, CharT* pend)
+    {
+        base::setp(pbeg, pend);
+    }
+};
+
+int main()
+{
+    {
+        test<char> t;
+        test<char> t2 = t;
+    }
+    {
+        test<wchar_t> t;
+        test<wchar_t> t2 = t;
+    }
+    {
+        char g1, g2, g3, p1, p3;
+        test<char> t;
+        t.setg(&g1, &g2, &g3);
+        t.setp(&p1, &p3);
+        test<char> t2 = t;
+    }
+    {
+        wchar_t g1, g2, g3, p1, p3;
+        test<wchar_t> t;
+        t.setg(&g1, &g2, &g3);
+        t.setp(&p1, &p3);
+        test<wchar_t> t2 = t;
+    }
+    std::locale::global(std::locale(LOCALE_en_US_UTF_8));
+    {
+        test<char> t;
+        test<char> t2 = t;
+    }
+    {
+        test<wchar_t> t;
+        test<wchar_t> t2 = t;
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.fail.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.fail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf();  // is protected
+
+#include <streambuf>
+
+int main()
+{
+    std::basic_streambuf<char> sb;
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.cons/default.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf();
+
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test
+    : public std::basic_streambuf<CharT>
+{
+    test()
+    {
+        assert(this->eback() == 0);
+        assert(this->gptr() == 0);
+        assert(this->egptr() == 0);
+        assert(this->pbase() == 0);
+        assert(this->pptr() == 0);
+        assert(this->epptr() == 0);
+    }
+};
+
+int main()
+{
+    {
+        test<char> t;
+        assert(t.getloc().name() == "C");
+    }
+    {
+        test<wchar_t> t;
+        assert(t.getloc().name() == "C");
+    }
+    std::locale::global(std::locale(LOCALE_en_US_UTF_8));
+    {
+        test<char> t;
+        assert(t.getloc().name() == LOCALE_en_US_UTF_8);
+    }
+    {
+        test<wchar_t> t;
+        assert(t.getloc().name() == LOCALE_en_US_UTF_8);
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/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/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekoff.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekoff.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekoff.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekoff.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// pos_type pubseekoff(off_type off, ios_base::seekdir way,
+//                     ios_base::openmode which = ios_base::in | ios_base::out);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+    : public std::basic_streambuf<CharT>
+{
+    test() {}
+};
+
+int main()
+{
+    {
+        test<char> t;
+        assert(t.pubseekoff(0, std::ios_base::beg) == -1);
+        assert(t.pubseekoff(0, std::ios_base::beg, std::ios_base::app) == -1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekpos.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekpos.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekpos.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubseekpos.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// pos_type pubseekpos(pos_type sp,
+//                     ios_base::openmode which = ios_base::in | ios_base::out;
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+    : public std::basic_streambuf<CharT>
+{
+    test() {}
+};
+
+int main()
+{
+    {
+        test<char> t;
+        assert(t.pubseekpos(0, std::ios_base::app) == -1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsetbuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsetbuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsetbuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsetbuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf* pubsetbuf(char_type* s, streamsize n);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+    : public std::basic_streambuf<CharT>
+{
+    test() {}
+};
+
+int main()
+{
+    {
+        test<char> t;
+        assert(t.pubsetbuf(0, 0) == &t);
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsync.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsync.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsync.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.buffer/pubsync.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int pubsync();
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+    : public std::basic_streambuf<CharT>
+{
+    test() {}
+};
+
+int main()
+{
+    {
+        test<char> t;
+        assert(t.pubsync() == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.locales/locales.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.locales/locales.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.locales/locales.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.locales/locales.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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: locale.fr_FR.UTF-8
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// locale pubimbue(const locale& loc);
+// locale getloc() const;
+
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test
+    : public std::basic_streambuf<CharT>
+{
+    test() {}
+
+    void imbue(const std::locale&)
+    {
+        assert(this->getloc().name() == LOCALE_en_US_UTF_8);
+    }
+};
+
+int main()
+{
+    {
+        test<char> t;
+        assert(t.getloc().name() == "C");
+    }
+    std::locale::global(std::locale(LOCALE_en_US_UTF_8));
+    {
+        test<char> t;
+        assert(t.getloc().name() == LOCALE_en_US_UTF_8);
+        assert(t.pubimbue(std::locale(LOCALE_fr_FR_UTF_8)).name() == "en_US.UTF-8");
+        assert(t.getloc().name() == LOCALE_fr_FR_UTF_8);
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/in_avail.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/in_avail.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/in_avail.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/in_avail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize in_avail();
+
+#include <streambuf>
+#include <cassert>
+
+int showmanyc_called = 0;
+
+template <class CharT>
+struct test
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+
+    test() {}
+
+    void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+    {
+        base::setg(gbeg, gnext, gend);
+    }
+protected:
+    std::streamsize showmanyc()
+    {
+        ++showmanyc_called;
+        return 5;
+    }
+};
+
+int main()
+{
+    {
+        test<char> t;
+        assert(t.in_avail() == 5);
+        assert(showmanyc_called == 1);
+        char in[5];
+        t.setg(in, in+2, in+5);
+        assert(t.in_avail() == 3);
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sbumpc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sbumpc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sbumpc.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sbumpc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type sbumpc();
+
+#include <streambuf>
+#include <cassert>
+
+int uflow_called = 0;
+
+struct test
+    : public std::basic_streambuf<char>
+{
+    typedef std::basic_streambuf<char> base;
+
+    test() {}
+
+    void setg(char* gbeg, char* gnext, char* gend)
+    {
+        base::setg(gbeg, gnext, gend);
+    }
+
+protected:
+    int_type uflow()
+    {
+        ++uflow_called;
+        return 'a';
+    }
+};
+
+int main()
+{
+    {
+        test t;
+        assert(uflow_called == 0);
+        assert(t.sbumpc() == 'a');
+        assert(uflow_called == 1);
+        char in[] = "ABC";
+        t.setg(in, in, in+sizeof(in));
+        assert(t.sbumpc() == 'A');
+        assert(uflow_called == 1);
+        assert(t.sbumpc() == 'B');
+        assert(uflow_called == 1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetc.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type sgetc();
+
+#include <streambuf>
+#include <cassert>
+
+int underflow_called = 0;
+
+struct test
+    : public std::basic_streambuf<char>
+{
+    typedef std::basic_streambuf<char> base;
+
+    test() {}
+
+    void setg(char* gbeg, char* gnext, char* gend)
+    {
+        base::setg(gbeg, gnext, gend);
+    }
+
+protected:
+    int_type underflow()
+    {
+        ++underflow_called;
+        return 'a';
+    }
+};
+
+int main()
+{
+    {
+        test t;
+        assert(underflow_called == 0);
+        assert(t.sgetc() == 'a');
+        assert(underflow_called == 1);
+        char in[] = "ABC";
+        t.setg(in, in, in+sizeof(in));
+        assert(t.sgetc() == 'A');
+        assert(underflow_called == 1);
+        assert(t.sgetc() == 'A');
+        assert(underflow_called == 1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize sgetn(char_type* s, streamsize n);
+
+#include <streambuf>
+#include <cassert>
+
+int xsgetn_called = 0;
+
+struct test
+    : public std::basic_streambuf<char>
+{
+    test() {}
+
+protected:
+    std::streamsize xsgetn(char_type* s, std::streamsize n)
+    {
+        ++xsgetn_called;
+        return 10;
+    }
+};
+
+int main()
+{
+    test t;
+    assert(xsgetn_called == 0);
+    assert(t.sgetn(0, 0) == 10);
+    assert(xsgetn_called == 1);
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/snextc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/snextc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/snextc.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/snextc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type snextc();
+
+#include <streambuf>
+#include <cassert>
+
+int uflow_called = 0;
+
+struct test
+    : public std::basic_streambuf<char>
+{
+    typedef std::basic_streambuf<char> base;
+
+    test() {}
+
+    void setg(char* gbeg, char* gnext, char* gend)
+    {
+        base::setg(gbeg, gnext, gend);
+    }
+
+protected:
+    int_type uflow()
+    {
+        ++uflow_called;
+        return 'a';
+    }
+};
+
+int main()
+{
+    {
+        test t;
+        assert(uflow_called == 0);
+        assert(t.snextc() == -1);
+        assert(uflow_called == 1);
+        char in[] = "ABC";
+        t.setg(in, in, in+sizeof(in));
+        assert(t.snextc() == 'B');
+        assert(uflow_called == 1);
+        assert(t.snextc() == 'C');
+        assert(uflow_called == 1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type sputbackc(char_type c);
+
+#include <streambuf>
+#include <cassert>
+
+int pbackfail_called = 0;
+
+struct test
+    : public std::basic_streambuf<char>
+{
+    typedef std::basic_streambuf<char> base;
+
+    test() {}
+
+    void setg(char* gbeg, char* gnext, char* gend)
+    {
+        base::setg(gbeg, gnext, gend);
+    }
+
+protected:
+    int_type pbackfail(int_type c = traits_type::eof())
+    {
+        ++pbackfail_called;
+        return 'a';
+    }
+};
+
+int main()
+{
+    {
+        test t;
+        assert(pbackfail_called == 0);
+        assert(t.sputbackc('A') == 'a');
+        assert(pbackfail_called == 1);
+        char in[] = "ABC";
+        t.setg(in, in+1, in+sizeof(in));
+        assert(t.sputbackc('A') == 'A');
+        assert(pbackfail_called == 1);
+        assert(t.sputbackc('A') == 'a');
+        assert(pbackfail_called == 2);
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type sungetc();
+
+#include <streambuf>
+#include <cassert>
+
+int pbackfail_called = 0;
+
+struct test
+    : public std::basic_streambuf<char>
+{
+    typedef std::basic_streambuf<char> base;
+
+    test() {}
+
+    void setg(char* gbeg, char* gnext, char* gend)
+    {
+        base::setg(gbeg, gnext, gend);
+    }
+
+protected:
+    int_type pbackfail(int_type c = traits_type::eof())
+    {
+        ++pbackfail_called;
+        return 'a';
+    }
+};
+
+int main()
+{
+    {
+        test t;
+        assert(pbackfail_called == 0);
+        assert(t.sungetc() == 'a');
+        assert(pbackfail_called == 1);
+        char in[] = "ABC";
+        t.setg(in, in+1, in+sizeof(in));
+        assert(t.sungetc() == 'A');
+        assert(pbackfail_called == 1);
+        assert(t.sungetc() == 'a');
+        assert(pbackfail_called == 2);
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type sputc(char_type c);
+
+#include <streambuf>
+#include <cassert>
+
+int overflow_called = 0;
+
+struct test
+    : public std::basic_streambuf<char>
+{
+    typedef std::basic_streambuf<char> base;
+
+    test() {}
+
+    void setg(char* gbeg, char* gnext, char* gend)
+    {
+        base::setg(gbeg, gnext, gend);
+    }
+    void setp(char* pbeg, char* pend)
+    {
+        base::setp(pbeg, pend);
+    }
+
+protected:
+    int_type overflow(int_type c = traits_type::eof())
+    {
+        ++overflow_called;
+        return 'a';
+    }
+};
+
+int main()
+{
+    {
+        test t;
+        assert(overflow_called == 0);
+        assert(t.sputc('A') == 'a');
+        assert(overflow_called == 1);
+        char out[3] = {0};
+        t.setp(out, out+sizeof(out));
+        assert(t.sputc('A') == 'A');
+        assert(overflow_called == 1);
+        assert(out[0] == 'A');
+        assert(t.sputc('B') == 'B');
+        assert(overflow_called == 1);
+        assert(out[0] == 'A');
+        assert(out[1] == 'B');
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize sputn(const char_type* s, streamsize n);
+
+#include <streambuf>
+#include <cassert>
+
+int xsputn_called = 0;
+
+struct test
+    : public std::basic_streambuf<char>
+{
+    test() {}
+
+protected:
+    std::streamsize xsputn(const char_type* s, std::streamsize n)
+    {
+        ++xsputn_called;
+        return 5;
+    }
+};
+
+int main()
+{
+    test t;
+    assert(xsputn_called == 0);
+    assert(t.sputn(0, 0) == 5);
+    assert(xsputn_called == 1);
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/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/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/assign.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// basic_streambuf& operator=(const basic_streambuf& rhs);
+
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    test() {}
+
+    test& operator=(const test& t)
+    {
+        base::operator=(t);
+        assert(this->eback() == t.eback());
+        assert(this->gptr()  == t.gptr());
+        assert(this->egptr() == t.egptr());
+        assert(this->pbase() == t.pbase());
+        assert(this->pptr()  == t.pptr());
+        assert(this->epptr() == t.epptr());
+        assert(this->getloc() == t.getloc());
+        return *this;
+    }
+
+    void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+    {
+        base::setg(gbeg, gnext, gend);
+    }
+    void setp(CharT* pbeg, CharT* pend)
+    {
+        base::setp(pbeg, pend);
+    }
+};
+
+int main()
+{
+    {
+        test<char> t;
+        test<char> t2;
+        t2 = t;
+    }
+    {
+        test<wchar_t> t;
+        test<wchar_t> t2;
+        t2 = t;
+    }
+    {
+        char g1, g2, g3, p1, p3;
+        test<char> t;
+        t.setg(&g1, &g2, &g3);
+        t.setp(&p1, &p3);
+        test<char> t2;
+        t2 = t;
+    }
+    {
+        wchar_t g1, g2, g3, p1, p3;
+        test<wchar_t> t;
+        t.setg(&g1, &g2, &g3);
+        t.setp(&p1, &p3);
+        test<wchar_t> t2;
+        t2 = t;
+    }
+    std::locale::global(std::locale(LOCALE_en_US_UTF_8));
+    {
+        test<char> t;
+        test<char> t2;
+        t2 = t;
+    }
+    {
+        test<wchar_t> t;
+        test<wchar_t> t2;
+        t2 = t;
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.assign/swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// void swap(basic_streambuf& rhs);
+
+#include <streambuf>
+#include <cassert>
+
+#include "platform_support.h" // locale name macros
+
+template <class CharT>
+struct test
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+    test() {}
+
+    void swap(test& t)
+    {
+        test old_this(*this);
+        test old_that(t);
+        base::swap(t);
+        assert(this->eback() == old_that.eback());
+        assert(this->gptr()  == old_that.gptr());
+        assert(this->egptr() == old_that.egptr());
+        assert(this->pbase() == old_that.pbase());
+        assert(this->pptr()  == old_that.pptr());
+        assert(this->epptr() == old_that.epptr());
+        assert(this->getloc() == old_that.getloc());
+
+        assert(t.eback() == old_this.eback());
+        assert(t.gptr()  == old_this.gptr());
+        assert(t.egptr() == old_this.egptr());
+        assert(t.pbase() == old_this.pbase());
+        assert(t.pptr()  == old_this.pptr());
+        assert(t.epptr() == old_this.epptr());
+        assert(t.getloc() == old_this.getloc());
+        return *this;
+    }
+
+    void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+    {
+        base::setg(gbeg, gnext, gend);
+    }
+    void setp(CharT* pbeg, CharT* pend)
+    {
+        base::setp(pbeg, pend);
+    }
+};
+
+int main()
+{
+    {
+        test<char> t;
+        test<char> t2;
+        swap(t2, t);
+    }
+    {
+        test<wchar_t> t;
+        test<wchar_t> t2;
+        swap(t2, t);
+    }
+    {
+        char g1, g2, g3, p1, p3;
+        test<char> t;
+        t.setg(&g1, &g2, &g3);
+        t.setp(&p1, &p3);
+        test<char> t2;
+        swap(t2, t);
+    }
+    {
+        wchar_t g1, g2, g3, p1, p3;
+        test<wchar_t> t;
+        t.setg(&g1, &g2, &g3);
+        t.setp(&p1, &p3);
+        test<wchar_t> t2;
+        swap(t2, t);
+    }
+    std::locale::global(std::locale(LOCALE_en_US_UTF_8));
+    {
+        test<char> t;
+        test<char> t2;
+        swap(t2, t);
+    }
+    {
+        test<wchar_t> t;
+        test<wchar_t> t2;
+        swap(t2, t);
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/gbump.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/gbump.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/gbump.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/gbump.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// void gbump(int n);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+
+    test() {}
+
+    void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+    {
+        base::setg(gbeg, gnext, gend);
+    }
+
+    void gbump(int n)
+    {
+        CharT* gbeg = base::eback();
+        CharT* gnext = base::gptr();
+        CharT* gend = base::egptr();
+        base::gbump(n);
+        assert(base::eback() == gbeg);
+        assert(base::gptr() == gnext+n);
+        assert(base::egptr() == gend);
+    }
+};
+
+int main()
+{
+    {
+        test<char> t;
+        char in[] = "ABCDE";
+        t.setg(in, in+1, in+sizeof(in)/sizeof(in[0]));
+        t.gbump(2);
+    }
+    {
+        test<wchar_t> t;
+        wchar_t in[] = L"ABCDE";
+        t.setg(in, in+1, in+sizeof(in)/sizeof(in[0]));
+        t.gbump(3);
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/setg.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/setg.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/setg.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.get.area/setg.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// void setg(char_type* gbeg, char_type* gnext, char_type* gend);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+
+    test() {}
+
+    void setg(CharT* gbeg, CharT* gnext, CharT* gend)
+    {
+        base::setg(gbeg, gnext, gend);
+        assert(base::eback() == gbeg);
+        assert(base::gptr() == gnext);
+        assert(base::egptr() == gend);
+    }
+};
+
+int main()
+{
+    {
+        test<char> t;
+        char in[] = "ABC";
+        t.setg(in, in+1, in+sizeof(in)/sizeof(in[0]));
+    }
+    {
+        test<wchar_t> t;
+        wchar_t in[] = L"ABC";
+        t.setg(in, in+1, in+sizeof(in)/sizeof(in[0]));
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// void pbump(int n);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+
+    test() {}
+
+    void setp(CharT* pbeg, CharT* pend)
+    {
+        base::setp(pbeg, pend);
+    }
+
+    void pbump(int n)
+    {
+        CharT* pbeg = base::pbase();
+        CharT* pnext = base::pptr();
+        CharT* pend = base::epptr();
+        base::pbump(n);
+        assert(base::pbase() == pbeg);
+        assert(base::pptr() == pnext+n);
+        assert(base::epptr() == pend);
+    }
+};
+
+int main()
+{
+    {
+        test<char> t;
+        char in[] = "ABCDE";
+        t.setp(in, in+sizeof(in)/sizeof(in[0]));
+        t.pbump(2);
+        t.pbump(1);
+    }
+    {
+        test<wchar_t> t;
+        wchar_t in[] = L"ABCDE";
+        t.setp(in, in+sizeof(in)/sizeof(in[0]));
+        t.pbump(3);
+        t.pbump(1);
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/setp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/setp.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/setp.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/setp.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// void setp(char_type* pbeg, char_type* pend);
+
+#include <streambuf>
+#include <cassert>
+
+template <class CharT>
+struct test
+    : public std::basic_streambuf<CharT>
+{
+    typedef std::basic_streambuf<CharT> base;
+
+    test() {}
+
+    void setp(CharT* pbeg, CharT* pend)
+    {
+        base::setp(pbeg, pend);
+        assert(base::pbase() == pbeg);
+        assert(base::pptr() == pbeg);
+        assert(base::epptr() == pend);
+    }
+};
+
+int main()
+{
+    {
+        test<char> t;
+        char in[] = "ABC";
+        t.setp(in, in+sizeof(in)/sizeof(in[0]));
+    }
+    {
+        test<wchar_t> t;
+        wchar_t in[] = L"ABC";
+        t.setp(in, in+sizeof(in)/sizeof(in[0]));
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/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/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.buffer/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.buffer/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.buffer/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.buffer/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/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/showmanyc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/showmanyc.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/showmanyc.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/showmanyc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize showmanyc();
+
+#include <streambuf>
+#include <cassert>
+
+int showmanyc_called = 0;
+
+template <class CharT>
+struct test
+    : public std::basic_streambuf<CharT>
+{
+    test() {}
+};
+
+int main()
+{
+    test<char> t;
+    assert(t.in_avail() == 0);
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/uflow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/uflow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/uflow.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/uflow.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type uflow();
+
+#include <streambuf>
+#include <cassert>
+
+int underflow_called = 0;
+
+struct test
+    : public std::basic_streambuf<char>
+{
+    test() {}
+
+};
+
+int main()
+{
+    test t;
+    assert(t.sgetc() == -1);
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/underflow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/underflow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/underflow.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/underflow.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type underflow();
+
+#include <streambuf>
+#include <cassert>
+
+struct test
+    : public std::basic_streambuf<char>
+{
+    test() {}
+};
+
+int main()
+{
+    test t;
+    assert(t.sgetc() == -1);
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.get/xsgetn.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize xsgetn(char_type* s, streamsize n);
+
+#include <streambuf>
+#include <cassert>
+
+struct test
+    : public std::basic_streambuf<char>
+{
+    typedef std::basic_streambuf<char> base;
+
+    test() {}
+
+    void setg(char* gbeg, char* gnext, char* gend)
+    {
+        base::setg(gbeg, gnext, gend);
+    }
+};
+
+int main()
+{
+    test t;
+    char input[7] = "123456";
+    t.setg(input, input, input+7);
+    char output[sizeof(input)] = {0};
+    assert(t.sgetn(output, 10) == 7);
+    assert(strcmp(input, output) == 0);
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.locales/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.locales/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.locales/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.locales/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/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.pback/pbackfail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type pbackfail(int_type c = traits::eof());
+
+#include <streambuf>
+#include <cassert>
+
+int pbackfail_called = 0;
+
+struct test
+    : public std::basic_streambuf<char>
+{
+    test() {}
+};
+
+int main()
+{
+    test t;
+    assert(t.sputbackc('A') == -1);
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/overflow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/overflow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/overflow.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/overflow.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// int_type overflow(int_type c = traits::eof());
+
+#include <streambuf>
+#include <cassert>
+
+struct test
+    : public std::basic_streambuf<char>
+{
+    test() {}
+};
+
+int main()
+{
+    test t;
+    assert(t.sputc('A') == -1);
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf;
+
+// streamsize xsputn(const char_type* s, streamsize n);
+
+#include <streambuf>
+#include <cassert>
+
+struct test
+    : public std::basic_streambuf<char>
+{
+    typedef std::basic_streambuf<char> base;
+
+    test() {}
+
+    void setp(char* pbeg, char* pend)
+    {
+        base::setp(pbeg, pend);
+    }
+};
+
+int main()
+{
+    {
+        test t;
+        char in[] = "123456";
+        assert(t.sputn(in, sizeof(in)) == 0);
+        char out[sizeof(in)] = {0};
+        t.setp(out, out+sizeof(out));
+        assert(t.sputn(in, sizeof(in)) == sizeof(in));
+        assert(strcmp(in, out) == 0);
+    }
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/streambuf/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/streambuf/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/streambuf/types.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/streambuf/types.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_streambuf
+// {
+// public:
+//     // types:
+//     typedef charT char_type;
+//     typedef traits traits_type;
+//     typedef typename traits_type::int_type int_type;
+//     typedef typename traits_type::pos_type pos_type;
+//     typedef typename traits_type::off_type off_type;
+
+#include <streambuf>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::streambuf::char_type, char>::value), "");
+    static_assert((std::is_same<std::streambuf::traits_type, std::char_traits<char> >::value), "");
+    static_assert((std::is_same<std::streambuf::int_type, std::char_traits<char>::int_type>::value), "");
+    static_assert((std::is_same<std::streambuf::pos_type, std::char_traits<char>::pos_type>::value), "");
+    static_assert((std::is_same<std::streambuf::off_type, std::char_traits<char>::off_type>::value), "");
+
+    static_assert((std::is_same<std::wstreambuf::char_type, wchar_t>::value), "");
+    static_assert((std::is_same<std::wstreambuf::traits_type, std::char_traits<wchar_t> >::value), "");
+    static_assert((std::is_same<std::wstreambuf::int_type, std::char_traits<wchar_t>::int_type>::value), "");
+    static_assert((std::is_same<std::wstreambuf::pos_type, std::char_traits<wchar_t>::pos_type>::value), "");
+    static_assert((std::is_same<std::wstreambuf::off_type, std::char_traits<wchar_t>::off_type>::value), "");
+}

Added: libcxx/trunk/test/std/input.output/stream.buffers/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/stream.buffers/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/stream.buffers/version.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/stream.buffers/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <streambuf>
+
+#include <streambuf>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.assign/member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.assign/member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.assign/member_swap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// void swap(basic_istringstream& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::istringstream ss0(" 123 456");
+        std::istringstream ss(" 789 321");
+        ss.swap(ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss0 >> i;
+        assert(i == 789);
+        ss0 >> i;
+        assert(i == 321);
+    }
+    {
+        std::wistringstream ss0(L" 123 456");
+        std::wistringstream ss(L" 789 321");
+        ss.swap(ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss0 >> i;
+        assert(i == 789);
+        ss0 >> i;
+        assert(i == 321);
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.assign/move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// basic_istringstream& operator=(basic_istringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        std::istringstream ss0(" 123 456");
+        std::istringstream ss;
+        ss = std::move(ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+    }
+    {
+        std::istringstream s1("Aaaaa Bbbbb Cccccccccc Dddddddddddddddddd");
+        std::string s;
+        s1 >> s;
+
+        std::istringstream s2 = std::move(s1);
+        s2 >> s;
+        assert(s == "Bbbbb");
+
+        std::istringstream s3;
+        s3 = std::move(s2);
+        s3 >> s;
+        assert(s == "Cccccccccc");
+
+        s1 = std::move(s3);
+        s1 >> s;
+        assert(s == "Dddddddddddddddddd");
+    }
+    {
+        std::wistringstream ss0(L" 123 456");
+        std::wistringstream ss;
+        ss = std::move(ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+    }
+    {
+        std::wistringstream s1(L"Aaaaa Bbbbb Cccccccccc Dddddddddddddddddd");
+        std::wstring s;
+        s1 >> s;
+
+        std::wistringstream s2 = std::move(s1);
+        s2 >> s;
+        assert(s == L"Bbbbb");
+
+        std::wistringstream s3;
+        s3 = std::move(s2);
+        s3 >> s;
+        assert(s == L"Cccccccccc");
+
+        s1 = std::move(s3);
+        s1 >> s;
+        assert(s == L"Dddddddddddddddddd");
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.assign/nonmember_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.assign/nonmember_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.assign/nonmember_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.assign/nonmember_swap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// template <class charT, class traits, class Allocator>
+//   void
+//   swap(basic_istringstream<charT, traits, Allocator>& x,
+//        basic_istringstream<charT, traits, Allocator>& y);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::istringstream ss0(" 123 456");
+        std::istringstream ss(" 789 321");
+        swap(ss, ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss0 >> i;
+        assert(i == 789);
+        ss0 >> i;
+        assert(i == 321);
+    }
+    {
+        std::wistringstream ss0(L" 123 456");
+        std::wistringstream ss(L" 789 321");
+        swap(ss, ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss0 >> i;
+        assert(i == 789);
+        ss0 >> i;
+        assert(i == 321);
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.cons/default.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// explicit basic_istringstream(ios_base::openmode which = ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::istringstream ss;
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == "");
+    }
+    {
+        std::istringstream ss(std::ios_base::in);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == "");
+    }
+    {
+        std::wistringstream ss;
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L"");
+    }
+    {
+        std::wistringstream ss(std::ios_base::in);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L"");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.cons/move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// basic_istringstream(basic_istringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        std::istringstream ss0(" 123 456");
+        std::istringstream ss(std::move(ss0));
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+    }
+    {
+        std::wistringstream ss0(L" 123 456");
+        std::wistringstream ss(std::move(ss0));
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.cons/string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.cons/string.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.cons/string.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.cons/string.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// explicit basic_istringstream(const basic_string<charT,traits,allocator>& str,
+//                              ios_base::openmode which = ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::istringstream ss(" 123 456");
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+    }
+    {
+        std::istringstream ss(" 123 456", std::ios_base::out);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+    }
+    {
+        std::wistringstream ss(L" 123 456");
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+    }
+    {
+        std::wistringstream ss(L" 123 456", std::ios_base::out);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.members/str.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.members/str.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.members/str.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/istringstream/istringstream.members/str.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+
+// void str(const basic_string<charT,traits,Allocator>& s);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::istringstream ss(" 123 456");
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss.str(" 789");
+        ss.clear();
+        assert(ss.good());
+        assert(ss.str() == " 789");
+        ss >> i;
+        assert(i == 789);
+    }
+    {
+        std::wistringstream ss(L" 123 456");
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss.str(L" 789");
+        ss.clear();
+        assert(ss.good());
+        assert(ss.str() == L" 789");
+        ss >> i;
+        assert(i == 789);
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/istringstream/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/istringstream/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/istringstream/types.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/istringstream/types.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_istringstream
+//     : public basic_istream<charT, traits>
+// {
+// public:
+//     typedef charT                          char_type;
+//     typedef traits                         traits_type;
+//     typedef typename traits_type::int_type int_type;
+//     typedef typename traits_type::pos_type pos_type;
+//     typedef typename traits_type::off_type off_type;
+//     typedef Allocator                      allocator_type;
+
+#include <sstream>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::basic_istream<char>, std::basic_istringstream<char> >::value), "");
+    static_assert((std::is_same<std::basic_istringstream<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::basic_istringstream<char>::traits_type, std::char_traits<char> >::value), "");
+    static_assert((std::is_same<std::basic_istringstream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+    static_assert((std::is_same<std::basic_istringstream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+    static_assert((std::is_same<std::basic_istringstream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+    static_assert((std::is_same<std::basic_istringstream<char>::allocator_type, std::allocator<char> >::value), "");
+}

Added: libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// void swap(basic_ostringstream& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ostringstream ss0(" 123 456");
+        std::ostringstream ss;
+        ss.swap(ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456");
+        int i = 234;
+        ss << i << ' ' << 567;;
+        assert(ss.str() == "234 5676");
+        ss0 << i << ' ' << 567;;
+        assert(ss0.str() == "234 567");
+    }
+    {
+        std::wostringstream ss0(L" 123 456");
+        std::wostringstream ss;
+        ss.swap(ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456");
+        int i = 234;
+        ss << i << ' ' << 567;;
+        assert(ss.str() == L"234 5676");
+        ss0 << i << ' ' << 567;;
+        assert(ss0.str() == L"234 567");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// basic_ostringstream& operator=(basic_ostringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        std::ostringstream ss0(" 123 456");
+        std::ostringstream ss;
+        ss = std::move(ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456");
+        int i = 234;
+        ss << i << ' ' << 567;;
+        assert(ss.str() == "234 5676");
+    }
+    {
+        std::wostringstream ss0(L" 123 456");
+        std::wostringstream ss;
+        ss = std::move(ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456");
+        int i = 234;
+        ss << i << ' ' << 567;;
+        assert(ss.str() == L"234 5676");
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// void swap(basic_ostringstream& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ostringstream ss0(" 123 456");
+        std::ostringstream ss;
+        swap(ss, ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456");
+        int i = 234;
+        ss << i << ' ' << 567;;
+        assert(ss.str() == "234 5676");
+        ss0 << i << ' ' << 567;;
+        assert(ss0.str() == "234 567");
+    }
+    {
+        std::wostringstream ss0(L" 123 456");
+        std::wostringstream ss;
+        swap(ss, ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456");
+        int i = 234;
+        ss << i << ' ' << 567;;
+        assert(ss.str() == L"234 5676");
+        ss0 << i << ' ' << 567;;
+        assert(ss0.str() == L"234 567");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// explicit basic_ostringstream(ios_base::openmode which = ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ostringstream ss;
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == "");
+    }
+    {
+        std::ostringstream ss(std::ios_base::out);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == "");
+    }
+    {
+        std::wostringstream ss;
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L"");
+    }
+    {
+        std::wostringstream ss(std::ios_base::out);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L"");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// basic_ostringstream(basic_ostringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        std::ostringstream ss0(" 123 456");
+        std::ostringstream ss(std::move(ss0));
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456");
+        int i = 234;
+        ss << i << ' ' << 567;;
+        assert(ss.str() == "234 5676");
+    }
+    {
+        std::wostringstream ss0(L" 123 456");
+        std::wostringstream ss(std::move(ss0));
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456");
+        int i = 234;
+        ss << i << ' ' << 567;;
+        assert(ss.str() == L"234 5676");
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// explicit basic_ostringstream(const basic_string<charT,traits,allocator>& str,
+//                              ios_base::openmode which = ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ostringstream ss(" 123 456");
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456");
+        int i = 234;
+        ss << i << ' ' << 567;;
+        assert(ss.str() == "234 5676");
+    }
+    {
+        std::ostringstream ss(" 123 456", std::ios_base::in);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456");
+        int i = 234;
+        ss << i << ' ' << 567;;
+        assert(ss.str() == "234 5676");
+    }
+    {
+        std::wostringstream ss(L" 123 456");
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456");
+        int i = 234;
+        ss << i << ' ' << 567;;
+        assert(ss.str() == L"234 5676");
+    }
+    {
+        std::wostringstream ss(L" 123 456", std::ios_base::in);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456");
+        int i = 234;
+        ss << i << ' ' << 567;;
+        assert(ss.str() == L"234 5676");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.members/str.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.members/str.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.members/str.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/ostringstream/ostringstream.members/str.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+
+// void str(const basic_string<charT,traits,Allocator>& s);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::ostringstream ss(" 123 456");
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456");
+        int i = 0;
+        ss << i;
+        assert(ss.str() == "0123 456");
+        ss << 456;
+        assert(ss.str() == "0456 456");
+        ss.str(" 789");
+        assert(ss.str() == " 789");
+        ss << "abc";
+        assert(ss.str() == "abc9");
+    }
+    {
+        std::wostringstream ss(L" 123 456");
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456");
+        int i = 0;
+        ss << i;
+        assert(ss.str() == L"0123 456");
+        ss << 456;
+        assert(ss.str() == L"0456 456");
+        ss.str(L" 789");
+        assert(ss.str() == L" 789");
+        ss << L"abc";
+        assert(ss.str() == L"abc9");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/ostringstream/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/ostringstream/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/ostringstream/types.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/ostringstream/types.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_ostringstream
+//     : public basic_ostream<charT, traits>
+// {
+// public:
+//     typedef charT                          char_type;
+//     typedef traits                         traits_type;
+//     typedef typename traits_type::int_type int_type;
+//     typedef typename traits_type::pos_type pos_type;
+//     typedef typename traits_type::off_type off_type;
+//     typedef Allocator                      allocator_type;
+
+#include <sstream>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::basic_ostream<char>, std::basic_ostringstream<char> >::value), "");
+    static_assert((std::is_same<std::basic_ostringstream<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::basic_ostringstream<char>::traits_type, std::char_traits<char> >::value), "");
+    static_assert((std::is_same<std::basic_ostringstream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+    static_assert((std::is_same<std::basic_ostringstream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+    static_assert((std::is_same<std::basic_ostringstream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+    static_assert((std::is_same<std::basic_ostringstream<char>::allocator_type, std::allocator<char> >::value), "");
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.assign/member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.assign/member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.assign/member_swap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// void swap(basic_stringbuf& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::stringbuf buf1("testing");
+        std::stringbuf buf;
+        buf.swap(buf1);
+        assert(buf.str() == "testing");
+        assert(buf1.str() == "");
+    }
+    {
+        std::stringbuf buf1("testing", std::ios_base::in);
+        std::stringbuf buf;
+        buf.swap(buf1);
+        assert(buf.str() == "testing");
+        assert(buf1.str() == "");
+    }
+    {
+        std::stringbuf buf1("testing", std::ios_base::out);
+        std::stringbuf buf;
+        buf.swap(buf1);
+        assert(buf.str() == "testing");
+        assert(buf1.str() == "");
+    }
+    {
+        std::wstringbuf buf1(L"testing");
+        std::wstringbuf buf;
+        buf.swap(buf1);
+        assert(buf.str() == L"testing");
+        assert(buf1.str() == L"");
+    }
+    {
+        std::wstringbuf buf1(L"testing", std::ios_base::in);
+        std::wstringbuf buf;
+        buf.swap(buf1);
+        assert(buf.str() == L"testing");
+        assert(buf1.str() == L"");
+    }
+    {
+        std::wstringbuf buf1(L"testing", std::ios_base::out);
+        std::wstringbuf buf;
+        buf.swap(buf1);
+        assert(buf.str() == L"testing");
+        assert(buf1.str() == L"");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.assign/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.assign/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.assign/move.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.assign/move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// basic_stringbuf& operator=(basic_stringbuf&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::stringbuf buf1("testing");
+        std::stringbuf buf;
+        buf = move(buf1);
+        assert(buf.str() == "testing");
+    }
+    {
+        std::stringbuf buf1("testing", std::ios_base::in);
+        std::stringbuf buf;
+        buf = move(buf1);
+        assert(buf.str() == "testing");
+    }
+    {
+        std::stringbuf buf1("testing", std::ios_base::out);
+        std::stringbuf buf;
+        buf = move(buf1);
+        assert(buf.str() == "testing");
+    }
+    {
+        std::wstringbuf buf1(L"testing");
+        std::wstringbuf buf;
+        buf = move(buf1);
+        assert(buf.str() == L"testing");
+    }
+    {
+        std::wstringbuf buf1(L"testing", std::ios_base::in);
+        std::wstringbuf buf;
+        buf = move(buf1);
+        assert(buf.str() == L"testing");
+    }
+    {
+        std::wstringbuf buf1(L"testing", std::ios_base::out);
+        std::wstringbuf buf;
+        buf = move(buf1);
+        assert(buf.str() == L"testing");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.assign/nonmember_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.assign/nonmember_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.assign/nonmember_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.assign/nonmember_swap.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// template <class charT, class traits, class Allocator>
+//   void swap(basic_stringbuf<charT, traits, Allocator>& x,
+//             basic_stringbuf<charT, traits, Allocator>& y);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::stringbuf buf1("testing");
+        std::stringbuf buf;
+        swap(buf, buf1);
+        assert(buf.str() == "testing");
+        assert(buf1.str() == "");
+    }
+    {
+        std::stringbuf buf1("testing", std::ios_base::in);
+        std::stringbuf buf;
+        swap(buf, buf1);
+        assert(buf.str() == "testing");
+        assert(buf1.str() == "");
+    }
+    {
+        std::stringbuf buf1("testing", std::ios_base::out);
+        std::stringbuf buf;
+        swap(buf, buf1);
+        assert(buf.str() == "testing");
+        assert(buf1.str() == "");
+    }
+    {
+        std::wstringbuf buf1(L"testing");
+        std::wstringbuf buf;
+        swap(buf, buf1);
+        assert(buf.str() == L"testing");
+        assert(buf1.str() == L"");
+    }
+    {
+        std::wstringbuf buf1(L"testing", std::ios_base::in);
+        std::wstringbuf buf;
+        swap(buf, buf1);
+        assert(buf.str() == L"testing");
+        assert(buf1.str() == L"");
+    }
+    {
+        std::wstringbuf buf1(L"testing", std::ios_base::out);
+        std::wstringbuf buf;
+        swap(buf, buf1);
+        assert(buf.str() == L"testing");
+        assert(buf1.str() == L"");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// explicit basic_stringbuf(ios_base::openmode which = ios_base::in | ios_base::out);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::stringbuf buf;
+        assert(buf.str() == "");
+    }
+    {
+        std::wstringbuf buf;
+        assert(buf.str() == L"");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// basic_stringbuf(basic_stringbuf&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::stringbuf buf1("testing");
+        std::stringbuf buf(move(buf1));
+        assert(buf.str() == "testing");
+    }
+    {
+        std::stringbuf buf1("testing", std::ios_base::in);
+        std::stringbuf buf(move(buf1));
+        assert(buf.str() == "testing");
+    }
+    {
+        std::stringbuf buf1("testing", std::ios_base::out);
+        std::stringbuf buf(move(buf1));
+        assert(buf.str() == "testing");
+    }
+    {
+        std::wstringbuf buf1(L"testing");
+        std::wstringbuf buf(move(buf1));
+        assert(buf.str() == L"testing");
+    }
+    {
+        std::wstringbuf buf1(L"testing", std::ios_base::in);
+        std::wstringbuf buf(move(buf1));
+        assert(buf.str() == L"testing");
+    }
+    {
+        std::wstringbuf buf1(L"testing", std::ios_base::out);
+        std::wstringbuf buf(move(buf1));
+        assert(buf.str() == L"testing");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// explicit basic_stringbuf(const basic_string<charT,traits,Allocator>& s,
+//                          ios_base::openmode which = ios_base::in | ios_base::out);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::stringbuf buf("testing");
+        assert(buf.str() == "testing");
+    }
+    {
+        std::stringbuf buf("testing", std::ios_base::in);
+        assert(buf.str() == "testing");
+    }
+    {
+        std::stringbuf buf("testing", std::ios_base::out);
+        assert(buf.str() == "testing");
+    }
+    {
+        std::wstringbuf buf(L"testing");
+        assert(buf.str() == L"testing");
+    }
+    {
+        std::wstringbuf buf(L"testing", std::ios_base::in);
+        assert(buf.str() == L"testing");
+    }
+    {
+        std::wstringbuf buf(L"testing", std::ios_base::out);
+        assert(buf.str() == L"testing");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.members/str.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.members/str.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.members/str.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.members/str.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// void str(const basic_string<charT,traits,Allocator>& s);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::stringbuf buf("testing");
+        assert(buf.str() == "testing");
+        buf.str("another test");
+        assert(buf.str() == "another test");
+    }
+    {
+        std::wstringbuf buf(L"testing");
+        assert(buf.str() == L"testing");
+        buf.str(L"another test");
+        assert(buf.str() == L"another test");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// int_type overflow(int_type c = traits::eof());
+
+#include <sstream>
+#include <cassert>
+
+int overflow_called = 0;
+
+template <class CharT>
+struct testbuf
+    : public std::basic_stringbuf<CharT>
+{
+    typedef std::basic_stringbuf<CharT> base;
+    explicit testbuf(const std::basic_string<CharT>& str,
+                     std::ios_base::openmode which = std::ios_base::in | std::ios_base::out)
+        : base(str, which) {}
+
+    typename base::int_type
+        overflow(typename base::int_type c = base::type_traits::eof())
+        {++overflow_called; return base::overflow(c);}
+
+    void pbump(int n) {base::pbump(n);}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("abc");
+        assert(sb.sputc('1') == '1');
+        assert(sb.str() == "1bc");
+        assert(sb.sputc('2') == '2');
+        assert(sb.str() == "12c");
+        assert(sb.sputc('3') == '3');
+        assert(sb.str() == "123");
+        assert(sb.sputc('4') == '4');
+        assert(sb.str() == "1234");
+        assert(sb.sputc('5') == '5');
+        assert(sb.str() == "12345");
+        assert(sb.sputc('6') == '6');
+        assert(sb.str() == "123456");
+        assert(sb.sputc('7') == '7');
+        assert(sb.str() == "1234567");
+        assert(sb.sputc('8') == '8');
+        assert(sb.str() == "12345678");
+        assert(sb.sputc('9') == '9');
+        assert(sb.str() == "123456789");
+        assert(sb.sputc('0') == '0');
+        assert(sb.str() == "1234567890");
+        assert(sb.sputc('1') == '1');
+        assert(sb.str() == "12345678901");
+    }
+    {
+        testbuf<wchar_t> sb(L"abc");
+        assert(sb.sputc(L'1') == L'1');
+        assert(sb.str() == L"1bc");
+        assert(sb.sputc(L'2') == L'2');
+        assert(sb.str() == L"12c");
+        assert(sb.sputc(L'3') == L'3');
+        assert(sb.str() == L"123");
+        assert(sb.sputc(L'4') == L'4');
+        assert(sb.str() == L"1234");
+        assert(sb.sputc(L'5') == L'5');
+        assert(sb.str() == L"12345");
+        assert(sb.sputc(L'6') == L'6');
+        assert(sb.str() == L"123456");
+        assert(sb.sputc(L'7') == L'7');
+        assert(sb.str() == L"1234567");
+        assert(sb.sputc(L'8') == L'8');
+        assert(sb.str() == L"12345678");
+        assert(sb.sputc(L'9') == L'9');
+        assert(sb.str() == L"123456789");
+        assert(sb.sputc(L'0') == L'0');
+        assert(sb.str() == L"1234567890");
+        assert(sb.sputc(L'1') == L'1');
+        assert(sb.str() == L"12345678901");
+    }
+    {
+        testbuf<char> sb("abc", std::ios_base::app | std::ios_base::out);
+        assert(sb.sputc('1') == '1');
+        assert(sb.str() == "abc1");
+        assert(sb.sputc('2') == '2');
+        assert(sb.str() == "abc12");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// int_type pbackfail(int_type c = traits::eof());
+
+#include <sstream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_stringbuf<CharT>
+{
+    typedef std::basic_stringbuf<CharT> base;
+    explicit testbuf(const std::basic_string<CharT>& str,
+                     std::ios_base::openmode which = std::ios_base::in | std::ios_base::out)
+        : base(str, which) {}
+
+    typename base::int_type
+        pbackfail(typename base::int_type c = base::type_traits::eof())
+        {return base::pbackfail(c);}
+
+    void pbump(int n) {base::pbump(n);}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("123", std::ios_base::in);
+        assert(sb.sgetc() == '1');
+        assert(sb.snextc() == '2');
+        assert(sb.snextc() == '3');
+        assert(sb.sgetc() == '3');
+        assert(sb.snextc() == std::char_traits<char>::eof());
+        assert(sb.pbackfail('3') == '3');
+        assert(sb.pbackfail('3') == std::char_traits<char>::eof());
+        assert(sb.pbackfail('2') == '2');
+        assert(sb.pbackfail(std::char_traits<char>::eof()) != std::char_traits<char>::eof());
+        assert(sb.pbackfail(std::char_traits<char>::eof()) == std::char_traits<char>::eof());
+        assert(sb.str() == "123");
+    }
+    {
+        testbuf<char> sb("123");
+        assert(sb.sgetc() == '1');
+        assert(sb.snextc() == '2');
+        assert(sb.snextc() == '3');
+        assert(sb.sgetc() == '3');
+        assert(sb.snextc() == std::char_traits<char>::eof());
+        assert(sb.pbackfail('3') == '3');
+        assert(sb.pbackfail('3') == '3');
+        assert(sb.pbackfail(std::char_traits<char>::eof()) != std::char_traits<char>::eof());
+        assert(sb.pbackfail(std::char_traits<char>::eof()) == std::char_traits<char>::eof());
+        assert(sb.str() == "133");
+    }
+    {
+        testbuf<wchar_t> sb(L"123", std::ios_base::in);
+        assert(sb.sgetc() == L'1');
+        assert(sb.snextc() == L'2');
+        assert(sb.snextc() == L'3');
+        assert(sb.sgetc() == L'3');
+        assert(sb.snextc() == std::char_traits<wchar_t>::eof());
+        assert(sb.pbackfail(L'3') == L'3');
+        assert(sb.pbackfail(L'3') == std::char_traits<wchar_t>::eof());
+        assert(sb.pbackfail(L'2') == L'2');
+        assert(sb.pbackfail(std::char_traits<wchar_t>::eof()) != std::char_traits<wchar_t>::eof());
+        assert(sb.pbackfail(std::char_traits<wchar_t>::eof()) == std::char_traits<wchar_t>::eof());
+        assert(sb.str() == L"123");
+    }
+    {
+        testbuf<wchar_t> sb(L"123");
+        assert(sb.sgetc() == L'1');
+        assert(sb.snextc() == L'2');
+        assert(sb.snextc() == L'3');
+        assert(sb.sgetc() == L'3');
+        assert(sb.snextc() == std::char_traits<wchar_t>::eof());
+        assert(sb.pbackfail(L'3') == L'3');
+        assert(sb.pbackfail(L'3') == L'3');
+        assert(sb.pbackfail(std::char_traits<wchar_t>::eof()) != std::char_traits<wchar_t>::eof());
+        assert(sb.pbackfail(std::char_traits<wchar_t>::eof()) == std::char_traits<wchar_t>::eof());
+        assert(sb.str() == L"133");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,143 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// pos_type seekoff(off_type off, ios_base::seekdir way,
+//                  ios_base::openmode which = ios_base::in | ios_base::out);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::stringbuf sb("0123456789", std::ios_base::in);
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == -1);
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == -1);
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == -1);
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in | std::ios_base::out) == -1);
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in | std::ios_base::out) == -1);
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in | std::ios_base::out) == -1);
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == 3);
+        assert(sb.sgetc() == '3');
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == 6);
+        assert(sb.sgetc() == '6');
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == 7);
+        assert(sb.sgetc() == '7');
+    }
+    {
+        std::stringbuf sb("0123456789", std::ios_base::out);
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == -1);
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == -1);
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == -1);
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out | std::ios_base::in) == -1);
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out | std::ios_base::in) == -1);
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out | std::ios_base::in) == -1);
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == 3);
+        assert(sb.sputc('a') == 'a');
+        assert(sb.str() == "012a456789");
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == 7);
+        assert(sb.sputc('b') == 'b');
+        assert(sb.str() == "012a456b89");
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == 7);
+        assert(sb.sputc('c') == 'c');
+        assert(sb.str() == "012a456c89");
+    }
+    {
+        std::stringbuf sb("0123456789");
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == 3);
+        assert(sb.sgetc() == '3');
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == 6);
+        assert(sb.sgetc() == '6');
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == 7);
+        assert(sb.sgetc() == '7');
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out | std::ios_base::in) == 3);
+        assert(sb.sgetc() == '3');
+        assert(sb.sputc('a') == 'a');
+        assert(sb.str() == "012a456789");
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out | std::ios_base::in) == -1);
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out | std::ios_base::in) == 7);
+        assert(sb.sgetc() == '7');
+        assert(sb.sputc('c') == 'c');
+        assert(sb.str() == "012a456c89");
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == 3);
+        assert(sb.sputc('3') == '3');
+        assert(sb.str() == "0123456c89");
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == 7);
+        assert(sb.sputc('7') == '7');
+        assert(sb.str() == "0123456789");
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == 7);
+        assert(sb.sputc('c') == 'c');
+        assert(sb.str() == "0123456c89");
+    }
+    {
+        std::wstringbuf sb(L"0123456789", std::ios_base::in);
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == -1);
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == -1);
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == -1);
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in | std::ios_base::out) == -1);
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in | std::ios_base::out) == -1);
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in | std::ios_base::out) == -1);
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == 3);
+        assert(sb.sgetc() == L'3');
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == 6);
+        assert(sb.sgetc() == L'6');
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == 7);
+        assert(sb.sgetc() == L'7');
+    }
+    {
+        std::wstringbuf sb(L"0123456789", std::ios_base::out);
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == -1);
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == -1);
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == -1);
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out | std::ios_base::in) == -1);
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out | std::ios_base::in) == -1);
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out | std::ios_base::in) == -1);
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == 3);
+        assert(sb.sputc(L'a') == L'a');
+        assert(sb.str() == L"012a456789");
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == 7);
+        assert(sb.sputc(L'b') == L'b');
+        assert(sb.str() == L"012a456b89");
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == 7);
+        assert(sb.sputc(L'c') == L'c');
+        assert(sb.str() == L"012a456c89");
+    }
+    {
+        std::wstringbuf sb(L"0123456789");
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == 3);
+        assert(sb.sgetc() == L'3');
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == 6);
+        assert(sb.sgetc() == L'6');
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == 7);
+        assert(sb.sgetc() == L'7');
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out | std::ios_base::in) == 3);
+        assert(sb.sgetc() == L'3');
+        assert(sb.sputc(L'a') == L'a');
+        assert(sb.str() == L"012a456789");
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out | std::ios_base::in) == -1);
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out | std::ios_base::in) == 7);
+        assert(sb.sgetc() == L'7');
+        assert(sb.sputc(L'c') == L'c');
+        assert(sb.str() == L"012a456c89");
+        assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == 3);
+        assert(sb.sputc(L'3') == L'3');
+        assert(sb.str() == L"0123456c89");
+        assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == 7);
+        assert(sb.sputc(L'7') == L'7');
+        assert(sb.str() == L"0123456789");
+        assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == 7);
+        assert(sb.sputc(L'c') == L'c');
+        assert(sb.str() == L"0123456c89");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekpos.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekpos.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekpos.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekpos.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// pos_type seekpos(pos_type sp,
+//                  ios_base::openmode which = ios_base::in | ios_base::out);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::stringbuf sb("0123456789", std::ios_base::in);
+        assert(sb.pubseekpos(3, std::ios_base::out) == -1);
+        assert(sb.pubseekpos(3, std::ios_base::in | std::ios_base::out) == -1);
+        assert(sb.pubseekpos(3, std::ios_base::in) == 3);
+        assert(sb.sgetc() == '3');
+    }
+    {
+        std::stringbuf sb("0123456789", std::ios_base::out);
+        assert(sb.pubseekpos(3, std::ios_base::in) == -1);
+        assert(sb.pubseekpos(3, std::ios_base::out | std::ios_base::in) == -1);
+        assert(sb.pubseekpos(3, std::ios_base::out) == 3);
+        assert(sb.sputc('a') == 'a');
+        assert(sb.str() == "012a456789");
+    }
+    {
+        std::stringbuf sb("0123456789");
+        assert(sb.pubseekpos(3, std::ios_base::in) == 3);
+        assert(sb.sgetc() == '3');
+        assert(sb.pubseekpos(3, std::ios_base::out | std::ios_base::in) == 3);
+        assert(sb.sgetc() == '3');
+        assert(sb.sputc('a') == 'a');
+        assert(sb.str() == "012a456789");
+        assert(sb.pubseekpos(3, std::ios_base::out) == 3);
+        assert(sb.sputc('3') == '3');
+        assert(sb.str() == "0123456789");
+    }
+    {
+        std::wstringbuf sb(L"0123456789", std::ios_base::in);
+        assert(sb.pubseekpos(3, std::ios_base::out) == -1);
+        assert(sb.pubseekpos(3, std::ios_base::in | std::ios_base::out) == -1);
+        assert(sb.pubseekpos(3, std::ios_base::in) == 3);
+        assert(sb.sgetc() == L'3');
+    }
+    {
+        std::wstringbuf sb(L"0123456789", std::ios_base::out);
+        assert(sb.pubseekpos(3, std::ios_base::in) == -1);
+        assert(sb.pubseekpos(3, std::ios_base::out | std::ios_base::in) == -1);
+        assert(sb.pubseekpos(3, std::ios_base::out) == 3);
+        assert(sb.sputc(L'a') == L'a');
+        assert(sb.str() == L"012a456789");
+    }
+    {
+        std::wstringbuf sb(L"0123456789");
+        assert(sb.pubseekpos(3, std::ios_base::in) == 3);
+        assert(sb.sgetc() == L'3');
+        assert(sb.pubseekpos(3, std::ios_base::out | std::ios_base::in) == 3);
+        assert(sb.sgetc() == L'3');
+        assert(sb.sputc(L'a') == L'a');
+        assert(sb.str() == L"012a456789");
+        assert(sb.pubseekpos(3, std::ios_base::out) == 3);
+        assert(sb.sputc(L'3') == L'3');
+        assert(sb.str() == L"0123456789");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/setbuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/setbuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/setbuf.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/setbuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// basic_streambuf<charT,traits>* setbuf(charT* s, streamsize n);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::stringbuf sb("0123456789");
+        assert(sb.pubsetbuf(0, 0) == &sb);
+        assert(sb.str() == "0123456789");
+    }
+    {
+        std::wstringbuf sb(L"0123456789");
+        assert(sb.pubsetbuf(0, 0) == &sb);
+        assert(sb.str() == L"0123456789");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/underflow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/underflow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/underflow.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/underflow.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+
+// int_type underflow();
+
+#include <sstream>
+#include <cassert>
+
+template <class CharT>
+struct testbuf
+    : public std::basic_stringbuf<CharT>
+{
+    typedef std::basic_stringbuf<CharT> base;
+    explicit testbuf(const std::basic_string<CharT>& str)
+        : base(str) {}
+
+    typename base::int_type underflow() {return base::underflow();}
+    void pbump(int n) {base::pbump(n);}
+};
+
+int main()
+{
+    {
+        testbuf<char> sb("123");
+        sb.pbump(3);
+        assert(sb.underflow() == '1');
+        assert(sb.underflow() == '1');
+        assert(sb.snextc() == '2');
+        assert(sb.underflow() == '2');
+        assert(sb.underflow() == '2');
+        assert(sb.snextc() == '3');
+        assert(sb.underflow() == '3');
+        assert(sb.underflow() == '3');
+        assert(sb.snextc() == std::char_traits<char>::eof());
+        assert(sb.underflow() == std::char_traits<char>::eof());
+        assert(sb.underflow() == std::char_traits<char>::eof());
+        sb.sputc('4');
+        assert(sb.underflow() == '4');
+        assert(sb.underflow() == '4');
+    }
+    {
+        testbuf<wchar_t> sb(L"123");
+        sb.pbump(3);
+        assert(sb.underflow() == L'1');
+        assert(sb.underflow() == L'1');
+        assert(sb.snextc() == L'2');
+        assert(sb.underflow() == L'2');
+        assert(sb.underflow() == L'2');
+        assert(sb.snextc() == L'3');
+        assert(sb.underflow() == L'3');
+        assert(sb.underflow() == L'3');
+        assert(sb.snextc() == std::char_traits<wchar_t>::eof());
+        assert(sb.underflow() == std::char_traits<wchar_t>::eof());
+        assert(sb.underflow() == std::char_traits<wchar_t>::eof());
+        sb.sputc(L'4');
+        assert(sb.underflow() == L'4');
+        assert(sb.underflow() == L'4');
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringbuf/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringbuf/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringbuf/types.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringbuf/types.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringbuf
+//     : public basic_streambuf<charT, traits>
+// {
+// public:
+//     typedef charT                          char_type;
+//     typedef traits                         traits_type;
+//     typedef typename traits_type::int_type int_type;
+//     typedef typename traits_type::pos_type pos_type;
+//     typedef typename traits_type::off_type off_type;
+//     typedef Allocator                      allocator_type;
+
+#include <sstream>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::basic_streambuf<char>, std::basic_stringbuf<char> >::value), "");
+    static_assert((std::is_same<std::basic_stringbuf<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::basic_stringbuf<char>::traits_type, std::char_traits<char> >::value), "");
+    static_assert((std::is_same<std::basic_stringbuf<char>::int_type, std::char_traits<char>::int_type>::value), "");
+    static_assert((std::is_same<std::basic_stringbuf<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+    static_assert((std::is_same<std::basic_stringbuf<char>::off_type, std::char_traits<char>::off_type>::value), "");
+    static_assert((std::is_same<std::basic_stringbuf<char>::allocator_type, std::allocator<char> >::value), "");
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/default.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// explicit basic_stringstream(ios_base::openmode which = ios_base::out|ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::stringstream ss;
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == "");
+    }
+    {
+        std::stringstream ss(std::ios_base::in);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == "");
+    }
+    {
+        std::wstringstream ss;
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L"");
+    }
+    {
+        std::wstringstream ss(std::ios_base::in);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L"");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// basic_stringstream(basic_stringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        std::stringstream ss0(" 123 456 ");
+        std::stringstream ss(std::move(ss0));
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456 ");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss << i << ' ' << 123;
+        assert(ss.str() == "456 1236 ");
+    }
+    {
+        std::wstringstream ss0(L" 123 456 ");
+        std::wstringstream ss(std::move(ss0));
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456 ");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss << i << ' ' << 123;
+        assert(ss.str() == L"456 1236 ");
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/move2.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// basic_stringstream(basic_stringstream&& rhs);
+
+#include <sstream>
+#include <vector>
+#include <string>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::vector<std::istringstream> vecis;
+    vecis.push_back(std::istringstream());
+    vecis.back().str("hub started at [00 6b 8b 45 69]");
+    vecis.push_back(std::istringstream());
+    vecis.back().str("hub started at [00 6b 8b 45 69]");
+    for (int n = 0; n < vecis.size(); n++)
+    {
+        assert(vecis[n].str().size() == 31);
+        vecis[n].seekg(0, std::ios_base::beg);
+        assert(vecis[n].str().size() == 31);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/string.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// explicit basic_stringstream(const basic_string<charT,traits,Allocator>& str,
+//                             ios_base::openmode which = ios_base::out|ios_base::in);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::stringstream ss(" 123 456 ");
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456 ");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss << i << ' ' << 123;
+        assert(ss.str() == "456 1236 ");
+    }
+    {
+        std::wstringstream ss(L" 123 456 ");
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456 ");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss << i << ' ' << 123;
+        assert(ss.str() == L"456 1236 ");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/member_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/member_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/member_swap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// void swap(basic_stringstream& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::stringstream ss0(" 123 456 ");
+        std::stringstream ss;
+        ss.swap(ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456 ");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss << i << ' ' << 123;
+        assert(ss.str() == "456 1236 ");
+        ss0 << i << ' ' << 123;
+        assert(ss0.str() == "456 123");
+    }
+    {
+        std::wstringstream ss0(L" 123 456 ");
+        std::wstringstream ss;
+        ss.swap(ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456 ");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss << i << ' ' << 123;
+        assert(ss.str() == L"456 1236 ");
+        ss0 << i << ' ' << 123;
+        assert(ss0.str() == L"456 123");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// basic_stringstream& operator=(basic_stringstream&& rhs);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+        std::stringstream ss0(" 123 456 ");
+        std::stringstream ss;
+        ss = std::move(ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456 ");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss << i << ' ' << 123;
+        assert(ss.str() == "456 1236 ");
+    }
+    {
+        std::wstringstream ss0(L" 123 456 ");
+        std::wstringstream ss;
+        ss = std::move(ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456 ");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss << i << ' ' << 123;
+        assert(ss.str() == L"456 1236 ");
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/nonmember_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/nonmember_swap.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/nonmember_swap.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/nonmember_swap.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// template <class charT, class traits, class Allocator>
+//   void
+//   swap(basic_stringstream<charT, traits, Allocator>& x,
+//        basic_stringstream<charT, traits, Allocator>& y);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::stringstream ss0(" 123 456 ");
+        std::stringstream ss;
+        swap(ss, ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456 ");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss << i << ' ' << 123;
+        assert(ss.str() == "456 1236 ");
+        ss0 << i << ' ' << 123;
+        assert(ss0.str() == "456 123");
+    }
+    {
+        std::wstringstream ss0(L" 123 456 ");
+        std::wstringstream ss;
+        swap(ss, ss0);
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456 ");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss << i << ' ' << 123;
+        assert(ss.str() == L"456 1236 ");
+        ss0 << i << ' ' << 123;
+        assert(ss0.str() == L"456 123");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringstream.members/str.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringstream.members/str.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringstream.members/str.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringstream.members/str.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+
+// void str(const basic_string<charT,traits,Allocator>& str);
+
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::stringstream ss(" 123 456 ");
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == " 123 456 ");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss << i << ' ' << 123;
+        assert(ss.str() == "456 1236 ");
+        ss.str("5466 89 ");
+        ss >> i;
+        assert(i == 5466);
+        ss >> i;
+        assert(i == 89);
+        ss << i << ' ' << 321;
+        assert(ss.str() == "89 3219 ");
+    }
+    {
+        std::wstringstream ss(L" 123 456 ");
+        assert(ss.rdbuf() != 0);
+        assert(ss.good());
+        assert(ss.str() == L" 123 456 ");
+        int i = 0;
+        ss >> i;
+        assert(i == 123);
+        ss >> i;
+        assert(i == 456);
+        ss << i << ' ' << 123;
+        assert(ss.str() == L"456 1236 ");
+        ss.str(L"5466 89 ");
+        ss >> i;
+        assert(i == 5466);
+        ss >> i;
+        assert(i == 89);
+        ss << i << ' ' << 321;
+        assert(ss.str() == L"89 3219 ");
+    }
+}

Added: libcxx/trunk/test/std/input.output/string.streams/stringstream/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringstream/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/stringstream/types.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/stringstream/types.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
+// class basic_stringstream
+//     : public basic_iostream<charT, traits>
+// {
+// public:
+//     typedef charT                          char_type;
+//     typedef traits                         traits_type;
+//     typedef typename traits_type::int_type int_type;
+//     typedef typename traits_type::pos_type pos_type;
+//     typedef typename traits_type::off_type off_type;
+//     typedef Allocator                      allocator_type;
+
+#include <sstream>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::basic_iostream<char>, std::basic_stringstream<char> >::value), "");
+    static_assert((std::is_same<std::basic_stringstream<char>::char_type, char>::value), "");
+    static_assert((std::is_same<std::basic_stringstream<char>::traits_type, std::char_traits<char> >::value), "");
+    static_assert((std::is_same<std::basic_stringstream<char>::int_type, std::char_traits<char>::int_type>::value), "");
+    static_assert((std::is_same<std::basic_stringstream<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
+    static_assert((std::is_same<std::basic_stringstream<char>::off_type, std::char_traits<char>::off_type>::value), "");
+    static_assert((std::is_same<std::basic_stringstream<char>::allocator_type, std::allocator<char> >::value), "");
+}

Added: libcxx/trunk/test/std/input.output/string.streams/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/version.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/string.streams/version.pass.cpp (added)
+++ libcxx/trunk/test/std/input.output/string.streams/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.
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+#include <sstream>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Added: libcxx/trunk/test/std/iterators/iterator.container/data.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.container/data.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.container/data.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.container/data.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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> constexpr auto data(C& c) -> decltype(c.data());               // C++17
+// template <class C> constexpr auto data(const C& c) -> decltype(c.data());         // C++17
+// template <class T, size_t N> constexpr T* data(T (&array)[N]) noexcept;           // C++17
+// template <class E> constexpr const E* data(initializer_list<E> il) noexcept;      // C++17
+
+#if __cplusplus <= 201402L
+int main () {}
+#else
+
+
+#include <__config>
+
+#include <iterator>
+#include <cassert>
+#include <vector>
+#include <array>
+#include <initializer_list>
+
+template<typename C>
+void test_const_container( const C& c )
+{
+    assert ( std::data(c)   == c.data());
+}
+
+template<typename T>
+void test_const_container( const std::initializer_list<T>& c )
+{
+    assert ( std::data(c)   == c.begin());
+}
+
+template<typename C>
+void test_container( C& c )
+{
+    assert ( std::data(c)   == c.data());
+}
+    
+template<typename T>
+void test_container( std::initializer_list<T>& c)
+{
+    assert ( std::data(c)   == c.begin());
+}
+
+template<typename T, size_t Sz>
+void test_const_array( const T (&array)[Sz] )
+{
+    assert ( std::data(array) == &array[0]);
+}
+
+int main()
+{
+    std::vector<int> v; v.push_back(1);
+    std::array<int, 1> a; a[0] = 3;
+    std::initializer_list<int> il = { 4 };
+    
+    test_container ( v );
+    test_container ( a );
+    test_container ( il );
+
+    test_const_container ( v );
+    test_const_container ( a );
+    test_const_container ( il );
+    
+    static constexpr int arrA [] { 1, 2, 3 };
+    test_const_array ( arrA );
+}
+
+#endif

Added: libcxx/trunk/test/std/iterators/iterator.container/empty.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.container/empty.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.container/empty.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.container/empty.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>
+// template <class C> constexpr auto empty(const C& c) -> decltype(c.empty());       // C++17
+// template <class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept;  // C++17
+// template <class E> constexpr bool empty(initializer_list<E> il) noexcept;         // C++17
+
+#if __cplusplus <= 201402L
+int main () {}
+#else
+
+
+#include <__config>
+
+#include <iterator>
+#include <cassert>
+#include <vector>
+#include <array>
+#include <list>
+#include <initializer_list>
+
+template<typename C>
+void test_const_container( const C& c )
+{
+    assert ( std::empty(c)   == c.empty());
+}
+
+template<typename T>
+void test_const_container( const std::initializer_list<T>& c )
+{
+    assert ( std::empty(c)   == (c.size() == 0));
+}
+
+template<typename C>
+void test_container( C& c )
+{
+    assert ( std::empty(c)   == c.empty());
+}
+    
+template<typename T>
+void test_container( std::initializer_list<T>& c )
+{
+    assert ( std::empty(c)   == (c.size() == 0));
+}
+
+template<typename T, size_t Sz>
+void test_const_array( const T (&array)[Sz] )
+{
+    assert (!std::empty(array));
+}
+
+int main()
+{
+    std::vector<int> v; v.push_back(1);
+    std::list<int>   l; l.push_back(2);
+    std::array<int, 1> a; a[0] = 3;
+    std::initializer_list<int> il = { 4 };
+    
+    test_container ( v );
+    test_container ( l );
+    test_container ( a );
+    test_container ( il );
+
+    test_const_container ( v );
+    test_const_container ( l );
+    test_const_container ( a );
+    test_const_container ( il );
+    
+    static constexpr int arrA [] { 1, 2, 3 };
+    test_const_array ( arrA );
+}
+
+#endif

Added: libcxx/trunk/test/std/iterators/iterator.container/size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.container/size.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.container/size.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.container/size.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+// template <class C> constexpr auto size(const C& c) -> decltype(c.size());         // C++17
+// template <class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept; // C++17
+
+#if __cplusplus <= 201402L
+int main () {}
+#else
+
+
+#include <__config>
+
+#include <iterator>
+#include <cassert>
+#include <vector>
+#include <array>
+#include <list>
+#include <initializer_list>
+
+template<typename C>
+void test_const_container( const C& c )
+{
+    assert ( std::size(c)   == c.size());
+}
+
+template<typename T>
+void test_const_container( const std::initializer_list<T>& c)
+{
+    assert ( std::size(c)   == c.size());
+}
+
+template<typename C>
+void test_container( C& c)
+{
+    assert ( std::size(c)   == c.size());
+}
+    
+template<typename T>
+void test_container( std::initializer_list<T>& c )
+{
+    assert ( std::size(c)   == c.size());
+}
+
+template<typename T, size_t Sz>
+void test_const_array( const T (&array)[Sz] )
+{
+    assert ( std::size(array) == Sz );
+}
+
+int main()
+{
+    std::vector<int> v; v.push_back(1);
+    std::list<int>   l; l.push_back(2);
+    std::array<int, 1> a; a[0] = 3;
+    std::initializer_list<int> il = { 4 };
+    
+    test_container ( v );
+    test_container ( l );
+    test_container ( a );
+    test_container ( il );
+
+    test_const_container ( v );
+    test_const_container ( l );
+    test_const_container ( a );
+    test_const_container ( il );
+    
+    static constexpr int arrA [] { 1, 2, 3 };
+    test_const_array ( arrA );
+}
+
+#endif

Added: libcxx/trunk/test/std/iterators/iterator.primitives/iterator.basic/iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/iterator.basic/iterator.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/iterator.basic/iterator.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.primitives/iterator.basic/iterator.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,82 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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 Category, class T, class Distance = ptrdiff_t,
+//          class Pointer = T*, class Reference = T&>
+// struct iterator
+// {
+//   typedef T         value_type;
+//   typedef Distance  difference_type;
+//   typedef Pointer   pointer;
+//   typedef Reference reference;
+//   typedef Category  iterator_category;
+// };
+
+#include <iterator>
+#include <type_traits>
+
+struct A {};
+
+template <class T>
+void
+test2()
+{
+    typedef std::iterator<std::forward_iterator_tag, T> It;
+    static_assert((std::is_same<typename It::value_type, T>::value), "");
+    static_assert((std::is_same<typename It::difference_type, std::ptrdiff_t>::value), "");
+    static_assert((std::is_same<typename It::pointer, T*>::value), "");
+    static_assert((std::is_same<typename It::reference, T&>::value), "");
+    static_assert((std::is_same<typename It::iterator_category, std::forward_iterator_tag>::value), "");
+}
+
+template <class T>
+void
+test3()
+{
+    typedef std::iterator<std::bidirectional_iterator_tag, T, short> It;
+    static_assert((std::is_same<typename It::value_type, T>::value), "");
+    static_assert((std::is_same<typename It::difference_type, short>::value), "");
+    static_assert((std::is_same<typename It::pointer, T*>::value), "");
+    static_assert((std::is_same<typename It::reference, T&>::value), "");
+    static_assert((std::is_same<typename It::iterator_category, std::bidirectional_iterator_tag>::value), "");
+}
+
+template <class T>
+void
+test4()
+{
+    typedef std::iterator<std::random_access_iterator_tag, T, int, const T*> It;
+    static_assert((std::is_same<typename It::value_type, T>::value), "");
+    static_assert((std::is_same<typename It::difference_type, int>::value), "");
+    static_assert((std::is_same<typename It::pointer, const T*>::value), "");
+    static_assert((std::is_same<typename It::reference, T&>::value), "");
+    static_assert((std::is_same<typename It::iterator_category, std::random_access_iterator_tag>::value), "");
+}
+
+template <class T>
+void
+test5()
+{
+    typedef std::iterator<std::input_iterator_tag, T, long, const T*, const T&> It;
+    static_assert((std::is_same<typename It::value_type, T>::value), "");
+    static_assert((std::is_same<typename It::difference_type, long>::value), "");
+    static_assert((std::is_same<typename It::pointer, const T*>::value), "");
+    static_assert((std::is_same<typename It::reference, const T&>::value), "");
+    static_assert((std::is_same<typename It::iterator_category, std::input_iterator_tag>::value), "");
+}
+
+int main()
+{
+    test2<A>();
+    test3<A>();
+    test4<A>();
+    test5<A>();
+}

Added: libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/advance.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template <InputIterator Iter>
+//   void advance(Iter& i, Iter::difference_type n);
+//
+// template <BidirectionalIterator Iter>
+//   void advance(Iter& i, Iter::difference_type n);
+//
+// template <RandomAccessIterator Iter>
+//   void advance(Iter& i, Iter::difference_type n);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::difference_type n, It x)
+{
+    std::advance(i, n);
+    assert(i == x);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(input_iterator<const char*>(s), 10, input_iterator<const char*>(s+10));
+    test(forward_iterator<const char*>(s), 10, forward_iterator<const char*>(s+10));
+    test(bidirectional_iterator<const char*>(s+5), 5, bidirectional_iterator<const char*>(s+10));
+    test(bidirectional_iterator<const char*>(s+5), -5, bidirectional_iterator<const char*>(s));
+    test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s+10));
+    test(random_access_iterator<const char*>(s+5), -5, random_access_iterator<const char*>(s));
+    test(s+5, 5, s+10);
+    test(s+5, -5, s);
+}

Added: libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/distance.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 <InputIterator Iter>
+//   Iter::difference_type
+//   distance(Iter first, Iter last);
+//
+// template <RandomAccessIterator Iter>
+//   Iter::difference_type
+//   distance(Iter first, Iter last);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It first, It last, typename std::iterator_traits<It>::difference_type x)
+{
+    assert(std::distance(first, last) == x);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(input_iterator<const char*>(s), input_iterator<const char*>(s+10), 10);
+    test(forward_iterator<const char*>(s), forward_iterator<const char*>(s+10), 10);
+    test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s+10), 10);
+    test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+10), 10);
+    test(s, s+10, 10);
+}

Added: libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/next.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>
+
+// template <InputIterator Iter>
+//   Iter next(Iter x, Iter::difference_type n = 1);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::difference_type n, It x)
+{
+    assert(std::next(i, n) == x);
+}
+
+template <class It>
+void
+test(It i, It x)
+{
+    assert(std::next(i) == x);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(forward_iterator<const char*>(s), 10, forward_iterator<const char*>(s+10));
+    test(bidirectional_iterator<const char*>(s), 10, bidirectional_iterator<const char*>(s+10));
+    test(random_access_iterator<const char*>(s), 10, random_access_iterator<const char*>(s+10));
+    test(s, 10, s+10);
+
+    test(forward_iterator<const char*>(s), forward_iterator<const char*>(s+1));
+    test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s+1));
+    test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1));
+    test(s, s+1);
+}

Added: libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/prev.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 <BidirectionalIterator Iter>
+//   Iter prev(Iter x, Iter::difference_type n = 1);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::difference_type n, It x)
+{
+    assert(std::prev(i, n) == x);
+}
+
+template <class It>
+void
+test(It i, It x)
+{
+    assert(std::prev(i) == x);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(bidirectional_iterator<const char*>(s+10), 10, bidirectional_iterator<const char*>(s));
+    test(random_access_iterator<const char*>(s+10), 10, random_access_iterator<const char*>(s));
+    test(s+10, 10, s);
+
+    test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s));
+    test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s));
+    test(s+1, s);
+}

Added: libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/const_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/const_pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/const_pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/const_pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template<class T>
+// struct iterator_traits<const T*>
+// {
+//   typedef ptrdiff_t                  difference_type;
+//   typedef T                          value_type;
+//   typedef const T*                   pointer;
+//   typedef const T&                   reference;
+//   typedef random_access_iterator_tag iterator_category;
+// };
+
+#include <iterator>
+#include <type_traits>
+
+struct A {};
+
+int main()
+{
+    typedef std::iterator_traits<const A*> It;
+    static_assert((std::is_same<It::difference_type, std::ptrdiff_t>::value), "");
+    static_assert((std::is_same<It::value_type, A>::value), "");
+    static_assert((std::is_same<It::pointer, const A*>::value), "");
+    static_assert((std::is_same<It::reference, const A&>::value), "");
+    static_assert((std::is_same<It::iterator_category, std::random_access_iterator_tag>::value), "");
+}

Added: libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/empty.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/empty.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/empty.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/empty.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>
+
+// template<class NotAnIterator>
+// struct iterator_traits
+// {
+// };
+
+#include <iterator>
+
+struct not_an_iterator
+{
+};
+
+template <class _Tp>
+struct has_value_type
+{
+private:
+    struct two {char lx; char lxx;};
+    template <class _Up> static two test(...);
+    template <class _Up> static char test(typename _Up::value_type* = 0);
+public:
+    static const bool value = sizeof(test<_Tp>(0)) == 1;
+};
+
+int main()
+{
+    typedef std::iterator_traits<not_an_iterator> It;
+    static_assert(!(has_value_type<It>::value), "");
+}

Added: libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/iterator.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/iterator.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/iterator.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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 Iter>
+// struct iterator_traits
+// {
+//   typedef typename Iter::difference_type difference_type;
+//   typedef typename Iter::value_type value_type;
+//   typedef typename Iter::pointer pointer;
+//   typedef typename Iter::reference reference;
+//   typedef typename Iter::iterator_category iterator_category;
+// };
+
+#include <iterator>
+#include <type_traits>
+
+struct A {};
+
+struct test_iterator
+{
+    typedef int                       difference_type;
+    typedef A                         value_type;
+    typedef A*                        pointer;
+    typedef A&                        reference;
+    typedef std::forward_iterator_tag iterator_category;
+};
+
+int main()
+{
+    typedef std::iterator_traits<test_iterator> It;
+    static_assert((std::is_same<It::difference_type, int>::value), "");
+    static_assert((std::is_same<It::value_type, A>::value), "");
+    static_assert((std::is_same<It::pointer, A*>::value), "");
+    static_assert((std::is_same<It::iterator_category, std::forward_iterator_tag>::value), "");
+}

Added: libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/pointer.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/pointer.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.primitives/iterator.traits/pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template<class T>
+// struct iterator_traits<T*>
+// {
+//   typedef ptrdiff_t                  difference_type;
+//   typedef T                          value_type;
+//   typedef T*                         pointer;
+//   typedef T&                         reference;
+//   typedef random_access_iterator_tag iterator_category;
+// };
+
+#include <iterator>
+#include <type_traits>
+
+struct A {};
+
+int main()
+{
+    typedef std::iterator_traits<A*> It;
+    static_assert((std::is_same<It::difference_type, std::ptrdiff_t>::value), "");
+    static_assert((std::is_same<It::value_type, A>::value), "");
+    static_assert((std::is_same<It::pointer, A*>::value), "");
+    static_assert((std::is_same<It::reference, A&>::value), "");
+    static_assert((std::is_same<It::iterator_category, std::random_access_iterator_tag>::value), "");
+}

Added: libcxx/trunk/test/std/iterators/iterator.primitives/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.primitives/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/iterator.primitives/std.iterator.tags/bidirectional_iterator_tag.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/bidirectional_iterator_tag.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/bidirectional_iterator_tag.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/bidirectional_iterator_tag.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>
+
+// struct bidirectional_iterator_tag : public forward_iterator_tag {};
+
+#include <iterator>
+#include <type_traits>
+
+int main()
+{
+    std::bidirectional_iterator_tag tag;
+    static_assert((std::is_base_of<std::forward_iterator_tag,
+                                   std::bidirectional_iterator_tag>::value), "");
+    static_assert((!std::is_base_of<std::output_iterator_tag,
+                                    std::bidirectional_iterator_tag>::value), "");
+}

Added: libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/forward_iterator_tag.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/forward_iterator_tag.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/forward_iterator_tag.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/forward_iterator_tag.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>
+
+// struct forward_iterator_tag: public input_iterator_tag {};
+
+#include <iterator>
+#include <type_traits>
+
+int main()
+{
+    std::forward_iterator_tag tag;
+    static_assert((std::is_base_of<std::input_iterator_tag,
+                                   std::forward_iterator_tag>::value), "");
+    static_assert((!std::is_base_of<std::output_iterator_tag,
+                                    std::forward_iterator_tag>::value), "");
+}

Added: libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/input_iterator_tag.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/input_iterator_tag.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/input_iterator_tag.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/input_iterator_tag.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// struct input_iterator_tag {};
+
+#include <iterator>
+#include <type_traits>
+
+int main()
+{
+    std::input_iterator_tag tag;
+    static_assert((!std::is_base_of<std::output_iterator_tag,
+                                    std::input_iterator_tag>::value), "");
+}

Added: libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/output_iterator_tag.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/output_iterator_tag.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/output_iterator_tag.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/output_iterator_tag.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// struct output_iterator_tag {};
+
+#include <iterator>
+#include <type_traits>
+
+int main()
+{
+    std::output_iterator_tag tag;
+    static_assert((!std::is_base_of<std::input_iterator_tag,
+                                    std::output_iterator_tag>::value), "");
+}

Added: libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/random_access_iterator_tag.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/random_access_iterator_tag.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/random_access_iterator_tag.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.primitives/std.iterator.tags/random_access_iterator_tag.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>
+
+// struct random_access_iterator_tag : public bidirectional_iterator_tag {};
+
+#include <iterator>
+#include <type_traits>
+
+int main()
+{
+    std::random_access_iterator_tag tag;
+    static_assert((std::is_base_of<std::bidirectional_iterator_tag,
+                                   std::random_access_iterator_tag>::value), "");
+    static_assert((!std::is_base_of<std::output_iterator_tag,
+                                    std::random_access_iterator_tag>::value), "");
+}

Added: libcxx/trunk/test/std/iterators/iterator.range/begin-end.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.range/begin-end.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.range/begin-end.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.range/begin-end.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+// template <class C> auto begin(C& c) -> decltype(c.begin());
+// template <class C> auto begin(const C& c) -> decltype(c.begin());
+// template <class C> auto end(C& c) -> decltype(c.end());
+// template <class C> auto end(const C& c) -> decltype(c.end());
+// template <class E> reverse_iterator<const E*> rbegin(initializer_list<E> il);
+// template <class E> reverse_iterator<const E*> rend(initializer_list<E> il);
+
+#include <__config>
+
+#if __cplusplus >= 201103L
+#include <iterator>
+#include <cassert>
+#include <vector>
+#include <array>
+#include <list>
+#include <initializer_list>
+
+template<typename C>
+void test_const_container( const C & c, typename C::value_type val ) {
+    assert ( std::begin(c)   == c.begin());
+    assert (*std::begin(c)   ==  val );
+    assert ( std::begin(c)   != c.end());
+    assert ( std::end(c)     == c.end());
+#if _LIBCPP_STD_VER > 11
+    assert ( std::cbegin(c)  == c.cbegin());
+    assert ( std::cbegin(c)  != c.cend());
+    assert ( std::cend(c)    == c.cend());
+    assert ( std::rbegin(c)  == c.rbegin());
+    assert ( std::rbegin(c)  != c.rend());
+    assert ( std::rend(c)    == c.rend());
+    assert ( std::crbegin(c) == c.crbegin());
+    assert ( std::crbegin(c) != c.crend());
+    assert ( std::crend(c)   == c.crend());
+#endif
+    }
+
+template<typename T>
+void test_const_container( const std::initializer_list<T> & c, T val ) {
+    assert ( std::begin(c)   == c.begin());
+    assert (*std::begin(c)   ==  val );
+    assert ( std::begin(c)   != c.end());
+    assert ( std::end(c)     == c.end());
+#if _LIBCPP_STD_VER > 11
+//  initializer_list doesn't have cbegin/cend/rbegin/rend
+//  but std::cbegin(),etc work (b/c they're general fn templates)
+//     assert ( std::cbegin(c)  == c.cbegin());
+//     assert ( std::cbegin(c)  != c.cend());
+//     assert ( std::cend(c)    == c.cend());
+//     assert ( std::rbegin(c)  == c.rbegin());
+//     assert ( std::rbegin(c)  != c.rend());
+//     assert ( std::rend(c)    == c.rend());
+//     assert ( std::crbegin(c) == c.crbegin());
+//     assert ( std::crbegin(c) != c.crend());
+//     assert ( std::crend(c)   == c.crend());
+#endif
+    }
+
+template<typename C>
+void test_container( C & c, typename C::value_type val ) {
+    assert ( std::begin(c)   == c.begin());
+    assert (*std::begin(c)   ==  val );
+    assert ( std::begin(c)   != c.end());
+    assert ( std::end(c)     == c.end());
+#if _LIBCPP_STD_VER > 11
+    assert ( std::cbegin(c)  == c.cbegin());
+    assert ( std::cbegin(c)  != c.cend());
+    assert ( std::cend(c)    == c.cend());
+    assert ( std::rbegin(c)  == c.rbegin());
+    assert ( std::rbegin(c)  != c.rend());
+    assert ( std::rend(c)    == c.rend());
+    assert ( std::crbegin(c) == c.crbegin());
+    assert ( std::crbegin(c) != c.crend());
+    assert ( std::crend(c)   == c.crend());
+#endif
+    }
+    
+template<typename T>
+void test_container( std::initializer_list<T> & c, T val ) {
+    assert ( std::begin(c)   == c.begin());
+    assert (*std::begin(c)   ==  val );
+    assert ( std::begin(c)   != c.end());
+    assert ( std::end(c)     == c.end());
+#if _LIBCPP_STD_VER > 11
+//  initializer_list doesn't have cbegin/cend/rbegin/rend
+//     assert ( std::cbegin(c)  == c.cbegin());
+//     assert ( std::cbegin(c)  != c.cend());
+//     assert ( std::cend(c)    == c.cend());
+//     assert ( std::rbegin(c)  == c.rbegin());
+//     assert ( std::rbegin(c)  != c.rend());
+//     assert ( std::rend(c)    == c.rend());
+//     assert ( std::crbegin(c) == c.crbegin());
+//     assert ( std::crbegin(c) != c.crend());
+//     assert ( std::crend(c)   == c.crend());
+#endif
+    }
+
+template<typename T, size_t Sz>
+void test_const_array( const T (&array)[Sz] ) {
+    assert ( std::begin(array)  == array );
+    assert (*std::begin(array)  ==  array[0] );
+    assert ( std::begin(array)  != std::end(array));
+    assert ( std::end(array)    == array + Sz);
+#if _LIBCPP_STD_VER > 11
+    assert ( std::cbegin(array) == array );
+    assert (*std::cbegin(array) == array[0] );
+    assert ( std::cbegin(array) != std::cend(array));
+    assert ( std::cend(array)   == array + Sz);
+#endif
+    }
+
+int main(){
+    std::vector<int> v; v.push_back(1);
+    std::list<int> l;   l.push_back(2);
+    std::array<int, 1> a; a[0] = 3;
+    std::initializer_list<int> il = { 4 };
+    
+    test_container ( v, 1 );
+    test_container ( l, 2 );
+    test_container ( a, 3 );
+    test_container ( il, 4 );
+
+    test_const_container ( v, 1 );
+    test_const_container ( l, 2 );
+    test_const_container ( a, 3 );
+    test_const_container ( il, 4 );
+    
+    static constexpr int arrA [] { 1, 2, 3 };
+    test_const_array ( arrA );
+#if _LIBCPP_STD_VER > 11
+    constexpr const int *b = std::cbegin(arrA);
+    constexpr const int *e = std::cend(arrA);
+    static_assert(e - b == 3, "");
+#endif
+}
+
+#else
+int main(){}
+#endif

Added: libcxx/trunk/test/std/iterators/iterator.requirements/bidirectional.iterators/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.requirements/bidirectional.iterators/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.requirements/bidirectional.iterators/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.requirements/bidirectional.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/iterator.requirements/forward.iterators/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.requirements/forward.iterators/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.requirements/forward.iterators/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.requirements/forward.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/iterator.requirements/input.iterators/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.requirements/input.iterators/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.requirements/input.iterators/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.requirements/input.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/iterator.requirements/iterator.iterators/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.requirements/iterator.iterators/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.requirements/iterator.iterators/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.requirements/iterator.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/iterator.requirements/iterator.requirements.general/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.requirements/iterator.requirements.general/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.requirements/iterator.requirements.general/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.requirements/iterator.requirements.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/iterators/iterator.requirements/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.requirements/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.requirements/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.requirements/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/iterator.requirements/output.iterators/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.requirements/output.iterators/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.requirements/output.iterators/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.requirements/output.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/iterator.requirements/random.access.iterators/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.requirements/random.access.iterators/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.requirements/random.access.iterators/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.requirements/random.access.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/iterator.synopsis/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.synopsis/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterator.synopsis/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterator.synopsis/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/iterators.general/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterators.general/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/iterators.general/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/iterators.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/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.fail.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.fail.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>
+
+// back_insert_iterator
+
+// explicit back_insert_iterator(Cont& x);
+
+// test for explicit
+
+#include <iterator>
+#include <vector>
+
+int main()
+{
+    std::back_insert_iterator<std::vector<int> > i = std::vector<int>();
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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>
+
+// back_insert_iterator
+
+// explicit back_insert_iterator(Cont& x);
+
+#include <iterator>
+#include <vector>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c)
+{
+    std::back_insert_iterator<C> i(c);
+}
+
+int main()
+{
+    test(std::vector<int>());
+    test(nasty_vector<int>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/post.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op%2B%2B/post.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/post.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/post.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// back_insert_iterator
+
+// back_insert_iterator<Cont> operator++(int);
+
+#include <iterator>
+#include <vector>
+#include <cassert>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c)
+{
+    std::back_insert_iterator<C> i(c);
+    std::back_insert_iterator<C> r = i++;
+    r = 0;
+    assert(c.size() == 1);
+    assert(c.back() == 0);
+}
+
+int main()
+{
+    test(std::vector<int>());
+    test(nasty_vector<int>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/pre.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op%2B%2B/pre.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/pre.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/pre.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>
+
+// back_insert_iterator
+
+// back_insert_iterator<Cont>& operator++();
+
+#include <iterator>
+#include <vector>
+#include <cassert>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c)
+{
+    std::back_insert_iterator<C> i(c);
+    std::back_insert_iterator<C>& r = ++i;
+    assert(&r == &i);
+}
+
+int main()
+{
+    test(std::vector<int>());
+    test(nasty_vector<int>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/lv_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op%3D/lv_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/lv_value.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/lv_value.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>
+
+// back_insert_iterator
+
+// requires CopyConstructible<Cont::value_type>
+//   back_insert_iterator<Cont>&
+//   operator=(const Cont::value_type& value);
+
+#include <iterator>
+#include <vector>
+#include <cassert>
+
+template <class C>
+void
+test(C c)
+{
+    const typename C::value_type v = typename C::value_type();
+    std::back_insert_iterator<C> i(c);
+    i = v;
+    assert(c.back() == v);
+}
+
+class Copyable
+{
+    int data_;
+public:
+    Copyable() : data_(0) {}
+    ~Copyable() {data_ = -1;}
+
+    friend bool operator==(const Copyable& x, const Copyable& y)
+        {return x.data_ == y.data_;}
+};
+
+int main()
+{
+    test(std::vector<Copyable>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/rv_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op%3D/rv_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/rv_value.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/rv_value.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// back_insert_iterator
+
+// requires CopyConstructible<Cont::value_type>
+//   back_insert_iterator<Cont>&
+//   operator=(Cont::value_type&& value);
+
+#include <iterator>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#include <vector>
+#include <memory>
+#include <cassert>
+
+template <class C>
+void
+test(C c)
+{
+    std::back_insert_iterator<C> i(c);
+    i = typename C::value_type();
+    assert(c.back() == typename C::value_type());
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test(std::vector<std::unique_ptr<int> >());
+#endif
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op_astrk/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op_astrk/test.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op_astrk/test.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op_astrk/test.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>
+
+// back_insert_iterator
+
+// back_insert_iterator<Cont>& operator*();
+
+#include <iterator>
+#include <vector>
+#include <cassert>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c)
+{
+    std::back_insert_iterator<C> i(c);
+    std::back_insert_iterator<C>& r = *i;
+    assert(&r == &i);
+}
+
+int main()
+{
+    test(std::vector<int>());
+    test(nasty_vector<int>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.inserter/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.inserter/test.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.inserter/test.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.inserter/test.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template <BackInsertionContainer Cont>
+//   back_insert_iterator<Cont>
+//   back_inserter(Cont& x);
+
+#include <iterator>
+#include <vector>
+#include <cassert>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c)
+{
+    std::back_insert_iterator<C> i = std::back_inserter(c);
+    i = 0;
+    assert(c.size() == 1);
+    assert(c.back() == 0);
+}
+
+int main()
+{
+    test(std::vector<int>());
+    test(nasty_vector<int>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/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/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// back_insert_iterator
+
+// Test nested types and data member:
+
+// template <BackInsertionContainer Cont>
+// class back_insert_iterator {
+// protected:
+//   Cont* container;
+// public:
+//   typedef Cont                        container_type;
+//   typedef void                        value_type;
+//   typedef void                        difference_type;
+//   typedef back_insert_iterator<Cont>& reference;
+//   typedef void                        pointer;
+// };
+
+#include <iterator>
+#include <type_traits>
+#include <vector>
+
+template <class C>
+struct find_container
+    : private std::back_insert_iterator<C>
+{
+    explicit find_container(C& c) : std::back_insert_iterator<C>(c) {}
+    void test() {this->container = 0;}
+};
+
+template <class C>
+void
+test()
+{
+    typedef std::back_insert_iterator<C> R;
+    C c;
+    find_container<C> q(c);
+    q.test();
+    static_assert((std::is_same<typename R::container_type, C>::value), "");
+    static_assert((std::is_same<typename R::value_type, void>::value), "");
+    static_assert((std::is_same<typename R::difference_type, void>::value), "");
+    static_assert((std::is_same<typename R::reference, R&>::value), "");
+    static_assert((std::is_same<typename R::pointer, void>::value), "");
+    static_assert((std::is_same<typename R::iterator_category, std::output_iterator_tag>::value), "");
+}
+
+int main()
+{
+    test<std::vector<int> >();
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.fail.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.fail.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>
+
+// front_insert_iterator
+
+// explicit front_insert_iterator(Cont& x);
+
+// test for explicit
+
+#include <iterator>
+#include <list>
+
+int main()
+{
+    std::front_insert_iterator<std::list<int> > i = std::list<int>();
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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>
+
+// front_insert_iterator
+
+// explicit front_insert_iterator(Cont& x);
+
+#include <iterator>
+#include <list>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c)
+{
+    std::front_insert_iterator<C> i(c);
+}
+
+int main()
+{
+    test(std::list<int>());
+    test(nasty_list<int>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/post.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op%2B%2B/post.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/post.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/post.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// front_insert_iterator
+
+// front_insert_iterator<Cont> operator++(int);
+
+#include <iterator>
+#include <list>
+#include <cassert>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c)
+{
+    std::front_insert_iterator<C> i(c);
+    std::front_insert_iterator<C> r = i++;
+    r = 0;
+    assert(c.size() == 1);
+    assert(c.back() == 0);
+}
+
+int main()
+{
+    test(std::list<int>());
+    test(nasty_list<int>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/pre.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op%2B%2B/pre.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/pre.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/pre.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>
+
+// front_insert_iterator
+
+// front_insert_iterator<Cont>& operator++();
+
+#include <iterator>
+#include <list>
+#include <cassert>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c)
+{
+    std::front_insert_iterator<C> i(c);
+    std::front_insert_iterator<C>& r = ++i;
+    assert(&r == &i);
+}
+
+int main()
+{
+    test(std::list<int>());
+    test(nasty_list<int>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/lv_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op%3D/lv_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/lv_value.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/lv_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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>
+
+// front_insert_iterator
+
+// front_insert_iterator<Cont>&
+//   operator=(const Cont::value_type& value);
+
+#include <iterator>
+#include <list>
+#include <cassert>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c)
+{
+    const typename C::value_type v = typename C::value_type();
+    std::front_insert_iterator<C> i(c);
+    i = v;
+    assert(c.front() == v);
+}
+
+class Copyable
+{
+    int data_;
+public:
+    Copyable() : data_(0) {}
+    ~Copyable() {data_ = -1;}
+
+    friend bool operator==(const Copyable& x, const Copyable& y)
+        {return x.data_ == y.data_;}
+};
+
+int main()
+{
+    test(std::list<Copyable>());
+    test(nasty_list<Copyable>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/rv_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op%3D/rv_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/rv_value.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/rv_value.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// front_insert_iterator
+
+// front_insert_iterator<Cont>&
+//   operator=(Cont::value_type&& value);
+
+#include <iterator>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#include <list>
+#include <memory>
+#include <cassert>
+
+template <class C>
+void
+test(C c)
+{
+    std::front_insert_iterator<C> i(c);
+    i = typename C::value_type();
+    assert(c.front() == typename C::value_type());
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test(std::list<std::unique_ptr<int> >());
+#endif
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op_astrk/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op_astrk/test.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op_astrk/test.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op_astrk/test.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>
+
+// front_insert_iterator
+
+// front_insert_iterator<Cont>& operator*();
+
+#include <iterator>
+#include <list>
+#include <cassert>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c)
+{
+    std::front_insert_iterator<C> i(c);
+    std::front_insert_iterator<C>& r = *i;
+    assert(&r == &i);
+}
+
+int main()
+{
+    test(std::list<int>());
+    test(nasty_list<int>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template <BackInsertionContainer Cont>
+//   front_insert_iterator<Cont>
+//   front_inserter(Cont& x);
+
+#include <iterator>
+#include <list>
+#include <cassert>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c)
+{
+    std::front_insert_iterator<C> i = std::front_inserter(c);
+    i = 0;
+    assert(c.size() == 1);
+    assert(c.front() == 0);
+}
+
+int main()
+{
+    test(std::list<int>());
+    test(nasty_list<int>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/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/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// front_insert_iterator
+
+// Test nested types and data member:
+
+// template <class Container>
+// class front_insert_iterator {
+// protected:
+//   Container* container;
+// public:
+//   typedef Container                   container_type;
+//   typedef void                        value_type;
+//   typedef void                        difference_type;
+//   typedef front_insert_iterator<Cont>& reference;
+//   typedef void                        pointer;
+//   typedef output_iterator_tag         iterator_category;
+// };
+
+#include <iterator>
+#include <type_traits>
+#include <vector>
+
+template <class C>
+struct find_container
+    : private std::front_insert_iterator<C>
+{
+    explicit find_container(C& c) : std::front_insert_iterator<C>(c) {}
+    void test() {this->container = 0;}
+};
+
+template <class C>
+void
+test()
+{
+    typedef std::front_insert_iterator<C> R;
+    C c;
+    find_container<C> q(c);
+    q.test();
+    static_assert((std::is_same<typename R::container_type, C>::value), "");
+    static_assert((std::is_same<typename R::value_type, void>::value), "");
+    static_assert((std::is_same<typename R::difference_type, void>::value), "");
+    static_assert((std::is_same<typename R::reference, R&>::value), "");
+    static_assert((std::is_same<typename R::pointer, void>::value), "");
+    static_assert((std::is_same<typename R::iterator_category, std::output_iterator_tag>::value), "");
+}
+
+int main()
+{
+    test<std::vector<int> >();
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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>
+
+// insert_iterator
+
+// insert_iterator(Cont& x, Cont::iterator i);
+
+#include <iterator>
+#include <vector>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c)
+{
+    std::insert_iterator<C> i(c, c.begin());
+}
+
+int main()
+{
+    test(std::vector<int>());
+    test(nasty_vector<int>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/post.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op%2B%2B/post.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/post.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/post.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// insert_iterator
+
+// insert_iterator<Cont> operator++(int);
+
+#include <iterator>
+#include <vector>
+#include <cassert>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c)
+{
+    std::insert_iterator<C> i(c, c.end());
+    std::insert_iterator<C> r = i++;
+    r = 0;
+    assert(c.size() == 1);
+    assert(c.back() == 0);
+}
+
+int main()
+{
+    test(std::vector<int>());
+    test(nasty_vector<int>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/pre.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op%2B%2B/pre.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/pre.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/pre.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>
+
+// insert_iterator
+
+// insert_iterator<Cont>& operator++();
+
+#include <iterator>
+#include <vector>
+#include <cassert>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c)
+{
+    std::insert_iterator<C> i(c, c.end());
+    std::insert_iterator<C>& r = ++i;
+    assert(&r == &i);
+}
+
+int main()
+{
+    test(std::vector<int>());
+    test(nasty_vector<int>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/lv_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op%3D/lv_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/lv_value.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/lv_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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>
+
+// insert_iterator
+
+// requires CopyConstructible<Cont::value_type>
+//   insert_iterator<Cont>&
+//   operator=(const Cont::value_type& value);
+
+#include <iterator>
+#include <vector>
+#include <cassert>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c1, typename C::difference_type j,
+     typename C::value_type x1, typename C::value_type x2,
+     typename C::value_type x3, const C& c2)
+{
+    std::insert_iterator<C> q(c1, c1.begin() + j);
+    q = x1;
+    q = x2;
+    q = x3;
+    assert(c1 == c2);
+}
+
+template <class C>
+void
+insert3at(C& c, typename C::iterator i,
+     typename C::value_type x1, typename C::value_type x2,
+     typename C::value_type x3)
+{
+    i = c.insert(i, x1);
+    i = c.insert(++i, x2);
+    c.insert(++i, x3);
+}
+
+int main()
+{
+    {
+    typedef std::vector<int> C;
+    C c1;
+    for (int i = 0; i < 3; ++i)
+        c1.push_back(i);
+    C c2 = c1;
+    insert3at(c2, c2.begin(), 'a', 'b', 'c');
+    test(c1, 0, 'a', 'b', 'c', c2);
+    c2 = c1;
+    insert3at(c2, c2.begin()+1, 'a', 'b', 'c');
+    test(c1, 1, 'a', 'b', 'c', c2);
+    c2 = c1;
+    insert3at(c2, c2.begin()+2, 'a', 'b', 'c');
+    test(c1, 2, 'a', 'b', 'c', c2);
+    c2 = c1;
+    insert3at(c2, c2.begin()+3, 'a', 'b', 'c');
+    test(c1, 3, 'a', 'b', 'c', c2);
+    }
+    {
+    typedef nasty_vector<int> C;
+    C c1;
+    for (int i = 0; i < 3; ++i)
+        c1.push_back(i);
+    C c2 = c1;
+    insert3at(c2, c2.begin(), 'a', 'b', 'c');
+    test(c1, 0, 'a', 'b', 'c', c2);
+    c2 = c1;
+    insert3at(c2, c2.begin()+1, 'a', 'b', 'c');
+    test(c1, 1, 'a', 'b', 'c', c2);
+    c2 = c1;
+    insert3at(c2, c2.begin()+2, 'a', 'b', 'c');
+    test(c1, 2, 'a', 'b', 'c', c2);
+    c2 = c1;
+    insert3at(c2, c2.begin()+3, 'a', 'b', 'c');
+    test(c1, 3, 'a', 'b', 'c', c2);
+    }
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/rv_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op%3D/rv_value.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/rv_value.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/rv_value.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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>
+
+// insert_iterator
+
+// requires CopyConstructible<Cont::value_type>
+//   insert_iterator<Cont>&
+//   operator=(const Cont::value_type& value);
+
+#include <iterator>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#include <vector>
+#include <memory>
+#include <cassert>
+
+template <class C>
+void
+test(C c1, typename C::difference_type j,
+     typename C::value_type x1, typename C::value_type x2,
+     typename C::value_type x3, const C& c2)
+{
+    std::insert_iterator<C> q(c1, c1.begin() + j);
+    q = std::move(x1);
+    q = std::move(x2);
+    q = std::move(x3);
+    assert(c1 == c2);
+}
+
+template <class C>
+void
+insert3at(C& c, typename C::iterator i,
+     typename C::value_type x1, typename C::value_type x2,
+     typename C::value_type x3)
+{
+    i = c.insert(i, std::move(x1));
+    i = c.insert(++i, std::move(x2));
+    c.insert(++i, std::move(x3));
+}
+
+struct do_nothing
+{
+    void operator()(void*) const {}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    {
+    typedef std::unique_ptr<int, do_nothing> Ptr;
+    typedef std::vector<Ptr> C;
+    C c1;
+    int x[6] = {0};
+    for (int i = 0; i < 3; ++i)
+        c1.push_back(Ptr(x+i));
+    C c2;
+    for (int i = 0; i < 3; ++i)
+        c2.push_back(Ptr(x+i));
+    insert3at(c2, c2.begin(), Ptr(x+3), Ptr(x+4), Ptr(x+5));
+    test(std::move(c1), 0, Ptr(x+3), Ptr(x+4), Ptr(x+5), c2);
+    c1.clear();
+    for (int i = 0; i < 3; ++i)
+        c1.push_back(Ptr(x+i));
+    c2.clear();
+    for (int i = 0; i < 3; ++i)
+        c2.push_back(Ptr(x+i));
+    insert3at(c2, c2.begin()+1, Ptr(x+3), Ptr(x+4), Ptr(x+5));
+    test(std::move(c1), 1, Ptr(x+3), Ptr(x+4), Ptr(x+5), c2);
+    c1.clear();
+    for (int i = 0; i < 3; ++i)
+        c1.push_back(Ptr(x+i));
+    c2.clear();
+    for (int i = 0; i < 3; ++i)
+        c2.push_back(Ptr(x+i));
+    insert3at(c2, c2.begin()+2, Ptr(x+3), Ptr(x+4), Ptr(x+5));
+    test(std::move(c1), 2, Ptr(x+3), Ptr(x+4), Ptr(x+5), c2);
+    c1.clear();
+    for (int i = 0; i < 3; ++i)
+        c1.push_back(Ptr(x+i));
+    c2.clear();
+    for (int i = 0; i < 3; ++i)
+        c2.push_back(Ptr(x+i));
+    insert3at(c2, c2.begin()+3, Ptr(x+3), Ptr(x+4), Ptr(x+5));
+    test(std::move(c1), 3, Ptr(x+3), Ptr(x+4), Ptr(x+5), c2);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op_astrk/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op_astrk/test.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op_astrk/test.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op_astrk/test.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>
+
+// insert_iterator
+
+// insert_iterator<Cont>& operator*();
+
+#include <iterator>
+#include <vector>
+#include <cassert>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c)
+{
+    std::insert_iterator<C> i(c, c.end());
+    std::insert_iterator<C>& r = *i;
+    assert(&r == &i);
+}
+
+int main()
+{
+    test(std::vector<int>());
+    test(nasty_vector<int>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/inserter/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/inserter/test.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/inserter/test.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/inserter/test.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template <InsertionContainer Cont>
+//   insert_iterator<Cont>
+//   inserter(Cont& x, Cont::iterator i);
+
+#include <iterator>
+#include <vector>
+#include <cassert>
+#include "nasty_containers.hpp"
+
+template <class C>
+void
+test(C c)
+{
+    std::insert_iterator<C> i = std::inserter(c, c.end());
+    i = 0;
+    assert(c.size() == 1);
+    assert(c.back() == 0);
+}
+
+int main()
+{
+    test(std::vector<int>());
+    test(nasty_vector<int>());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/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/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// insert_iterator
+
+// Test nested types and data members:
+
+// template <InsertionContainer Cont>
+// class insert_iterator {
+// protected:
+//   Cont* container;
+//   Cont::iterator iter;
+// public:
+//   typedef Cont                   container_type;
+//   typedef void                   value_type;
+//   typedef void                   difference_type;
+//   typedef insert_iterator<Cont>& reference;
+//   typedef void                   pointer;
+// };
+
+#include <iterator>
+#include <type_traits>
+#include <vector>
+
+template <class C>
+struct find_members
+    : private std::insert_iterator<C>
+{
+    explicit find_members(C& c) : std::insert_iterator<C>(c, c.begin()) {}
+    void test()
+    {
+        this->container = 0;
+        (void)(this->iter == this->iter);
+    }
+};
+
+template <class C>
+void
+test()
+{
+    typedef std::insert_iterator<C> R;
+    C c;
+    find_members<C> q(c);
+    q.test();
+    static_assert((std::is_same<typename R::container_type, C>::value), "");
+    static_assert((std::is_same<typename R::value_type, void>::value), "");
+    static_assert((std::is_same<typename R::difference_type, void>::value), "");
+    static_assert((std::is_same<typename R::reference, R&>::value), "");
+    static_assert((std::is_same<typename R::pointer, void>::value), "");
+    static_assert((std::is_same<typename R::iterator_category, std::output_iterator_tag>::value), "");
+}
+
+int main()
+{
+    test<std::vector<int> >();
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/insert.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/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.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>
+
+// move_iterator
+
+// template <InputIterator Iter>
+//   move_iterator<Iter>
+//   make_move_iterator(const Iter& i);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i)
+{
+    const std::move_iterator<It> r(i);
+    assert(std::make_move_iterator(i) == r);
+}
+
+int main()
+{
+    {
+    char s[] = "1234567890";
+    test(input_iterator<char*>(s+5));
+    test(forward_iterator<char*>(s+5));
+    test(bidirectional_iterator<char*>(s+5));
+    test(random_access_iterator<char*>(s+5));
+    test(s+5);
+    }
+    {
+    int a[] = {1,2,3,4};
+    std::make_move_iterator(a+4);
+    std::make_move_iterator(a); // test for LWG issue 2061
+    }
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.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>
+
+// move_iterator
+
+// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
+//   requires HasMinus<Iter1, Iter2>
+//   auto
+//   operator-(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y)
+//   -> decltype(x.base() - y.base());
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It l, It r, typename std::iterator_traits<It>::difference_type x)
+{
+    const std::move_iterator<It> r1(l);
+    const std::move_iterator<It> r2(r);
+    assert(r1 - r2 == x);
+}
+
+int main()
+{
+    char s[] = "1234567890";
+    test(random_access_iterator<char*>(s+5), random_access_iterator<char*>(s), 5);
+    test(s+5, s, 5);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// move_iterator
+
+// template <RandomAccessIterator Iter>
+//   move_iterator<Iter>
+//   operator+(Iter::difference_type n, const move_iterator<Iter>& x);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::difference_type n, It x)
+{
+    const std::move_iterator<It> r(i);
+    std::move_iterator<It> rr = n + r;
+    assert(rr.base() == x);
+}
+
+int main()
+{
+    char s[] = "1234567890";
+    test(random_access_iterator<char*>(s+5), 5, random_access_iterator<char*>(s+10));
+    test(s+5, 5, s+10);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.%2B/difference_type.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// move_iterator
+
+// requires RandomAccessIterator<Iter>
+//   move_iterator operator+(difference_type n) const;
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::difference_type n, It x)
+{
+    const std::move_iterator<It> r(i);
+    std::move_iterator<It> rr = r + n;
+    assert(rr.base() == x);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s+10));
+    test(s+5, 5, s+10);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.%2B%3D/difference_type.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// move_iterator
+
+// requires RandomAccessIterator<Iter>
+//   move_iterator& operator+=(difference_type n);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::difference_type n, It x)
+{
+    std::move_iterator<It> r(i);
+    std::move_iterator<It>& rr = r += n;
+    assert(r.base() == x);
+    assert(&rr == &r);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s+10));
+    test(s+5, 5, s+10);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// move_iterator
+
+// requires RandomAccessIterator<Iter>
+//   move_iterator operator-(difference_type n) const;
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::difference_type n, It x)
+{
+    const std::move_iterator<It> r(i);
+    std::move_iterator<It> rr = r - n;
+    assert(rr.base() == x);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
+    test(s+5, 5, s);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-%3D/difference_type.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// move_iterator
+
+// requires RandomAccessIterator<Iter>
+//   move_iterator& operator-=(difference_type n);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::difference_type n, It x)
+{
+    std::move_iterator<It> r(i);
+    std::move_iterator<It>& rr = r -= n;
+    assert(r.base() == x);
+    assert(&rr == &r);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
+    test(s+5, 5, s);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.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>
+
+// move_iterator
+
+// template <InputIterator Iter1, InputIterator Iter2>
+//   requires HasEqualTo<Iter1, Iter2>
+//   bool
+//   operator==(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It l, It r, bool x)
+{
+    const std::move_iterator<It> r1(l);
+    const std::move_iterator<It> r2(r);
+    assert((r1 == r2) == x);
+}
+
+int main()
+{
+    char s[] = "1234567890";
+    test(input_iterator<char*>(s), input_iterator<char*>(s), true);
+    test(input_iterator<char*>(s), input_iterator<char*>(s+1), false);
+    test(forward_iterator<char*>(s), forward_iterator<char*>(s), true);
+    test(forward_iterator<char*>(s), forward_iterator<char*>(s+1), false);
+    test(bidirectional_iterator<char*>(s), bidirectional_iterator<char*>(s), true);
+    test(bidirectional_iterator<char*>(s), bidirectional_iterator<char*>(s+1), false);
+    test(random_access_iterator<char*>(s), random_access_iterator<char*>(s), true);
+    test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1), false);
+    test(s, s, true);
+    test(s, s+1, false);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// move_iterator
+
+// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
+//   requires HasLess<Iter2, Iter1>
+//   bool
+//   operator>(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It l, It r, bool x)
+{
+    const std::move_iterator<It> r1(l);
+    const std::move_iterator<It> r2(r);
+    assert((r1 > r2) == x);
+}
+
+int main()
+{
+    char s[] = "1234567890";
+    test(random_access_iterator<char*>(s), random_access_iterator<char*>(s), false);
+    test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1), false);
+    test(random_access_iterator<char*>(s+1), random_access_iterator<char*>(s), true);
+    test(s, s, false);
+    test(s, s+1, false);
+    test(s+1, s, true);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// move_iterator
+
+// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
+//   requires HasLess<Iter1, Iter2>
+//   bool
+//   operator>=(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It l, It r, bool x)
+{
+    const std::move_iterator<It> r1(l);
+    const std::move_iterator<It> r2(r);
+    assert((r1 >= r2) == x);
+}
+
+int main()
+{
+    char s[] = "1234567890";
+    test(random_access_iterator<char*>(s), random_access_iterator<char*>(s), true);
+    test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1), false);
+    test(random_access_iterator<char*>(s+1), random_access_iterator<char*>(s), true);
+    test(s, s, true);
+    test(s, s+1, false);
+    test(s+1, s, true);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// move_iterator
+
+// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
+//   requires HasLess<Iter1, Iter2>
+//   bool
+//   operator<(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It l, It r, bool x)
+{
+    const std::move_iterator<It> r1(l);
+    const std::move_iterator<It> r2(r);
+    assert((r1 < r2) == x);
+}
+
+int main()
+{
+    char s[] = "1234567890";
+    test(random_access_iterator<char*>(s), random_access_iterator<char*>(s), false);
+    test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1), true);
+    test(random_access_iterator<char*>(s+1), random_access_iterator<char*>(s), false);
+    test(s, s, false);
+    test(s, s+1, true);
+    test(s+1, s, false);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// move_iterator
+
+// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
+//   requires HasLess<Iter2, Iter1>
+//   bool
+//   operator<=(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It l, It r, bool x)
+{
+    const std::move_iterator<It> r1(l);
+    const std::move_iterator<It> r2(r);
+    assert((r1 <= r2) == x);
+}
+
+int main()
+{
+    char s[] = "1234567890";
+    test(random_access_iterator<char*>(s), random_access_iterator<char*>(s), true);
+    test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1), true);
+    test(random_access_iterator<char*>(s+1), random_access_iterator<char*>(s), false);
+    test(s, s, true);
+    test(s, s+1, true);
+    test(s+1, s, false);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.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>
+
+// move_iterator
+
+// template <InputIterator Iter1, InputIterator Iter2>
+//   requires HasEqualTo<Iter1, Iter2>
+//   bool
+//   operator!=(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It l, It r, bool x)
+{
+    const std::move_iterator<It> r1(l);
+    const std::move_iterator<It> r2(r);
+    assert((r1 != r2) == x);
+}
+
+int main()
+{
+    char s[] = "1234567890";
+    test(input_iterator<char*>(s), input_iterator<char*>(s), false);
+    test(input_iterator<char*>(s), input_iterator<char*>(s+1), true);
+    test(forward_iterator<char*>(s), forward_iterator<char*>(s), false);
+    test(forward_iterator<char*>(s), forward_iterator<char*>(s+1), true);
+    test(bidirectional_iterator<char*>(s), bidirectional_iterator<char*>(s), false);
+    test(bidirectional_iterator<char*>(s), bidirectional_iterator<char*>(s+1), true);
+    test(random_access_iterator<char*>(s), random_access_iterator<char*>(s), false);
+    test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1), true);
+    test(s, s, false);
+    test(s, s+1, true);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.fail.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.fail.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>
+
+// move_iterator
+
+// template <class U>
+//   requires HasConstructor<Iter, const U&>
+//   move_iterator(const move_iterator<U> &u);
+
+// test requires
+
+#include <iterator>
+
+template <class It, class U>
+void
+test(U u)
+{
+    std::move_iterator<U> r2(u);
+    std::move_iterator<It> r1 = r2;
+}
+
+struct base {};
+struct derived {};
+
+int main()
+{
+    derived d;
+
+    test<base*>(&d);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.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>
+
+// move_iterator
+
+// template <class U>
+//   requires HasConstructor<Iter, const U&>
+//   move_iterator(const move_iterator<U> &u);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It, class U>
+void
+test(U u)
+{
+    const std::move_iterator<U> r2(u);
+    std::move_iterator<It> r1 = r2;
+    assert(r1.base() == u);
+}
+
+struct Base {};
+struct Derived : Base {};
+
+int main()
+{
+    Derived d;
+
+    test<input_iterator<Base*> >(input_iterator<Derived*>(&d));
+    test<forward_iterator<Base*> >(forward_iterator<Derived*>(&d));
+    test<bidirectional_iterator<Base*> >(bidirectional_iterator<Derived*>(&d));
+    test<random_access_iterator<const Base*> >(random_access_iterator<Derived*>(&d));
+    test<Base*>(&d);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.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>
+
+// move_iterator
+
+// move_iterator();
+
+#include <iterator>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test()
+{
+    std::move_iterator<It> r;
+}
+
+int main()
+{
+    test<input_iterator<char*> >();
+    test<forward_iterator<char*> >();
+    test<bidirectional_iterator<char*> >();
+    test<random_access_iterator<char*> >();
+    test<char*>();
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.fail.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.fail.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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>
+
+// move_iterator
+
+// explicit move_iterator(Iter );
+
+// test explicit
+
+#include <iterator>
+
+template <class It>
+void
+test(It i)
+{
+    std::move_iterator<It> r = i;
+}
+
+int main()
+{
+    char s[] = "123";
+    test(s);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// move_iterator
+
+// explicit move_iterator(Iter i);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i)
+{
+    std::move_iterator<It> r(i);
+    assert(r.base() == i);
+}
+
+int main()
+{
+    char s[] = "123";
+    test(input_iterator<char*>(s));
+    test(forward_iterator<char*>(s));
+    test(bidirectional_iterator<char*>(s));
+    test(random_access_iterator<char*>(s));
+    test(s);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.conv/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.conv/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.conv/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.conv/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/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// move_iterator
+
+// move_iterator operator--(int);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, It x)
+{
+    std::move_iterator<It> r(i);
+    std::move_iterator<It> rr = r--;
+    assert(r.base() == x);
+    assert(rr.base() == i);
+}
+
+int main()
+{
+    char s[] = "123";
+    test(bidirectional_iterator<char*>(s+1), bidirectional_iterator<char*>(s));
+    test(random_access_iterator<char*>(s+1), random_access_iterator<char*>(s));
+    test(s+1, s);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// move_iterator
+
+// move_iterator& operator--();
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, It x)
+{
+    std::move_iterator<It> r(i);
+    std::move_iterator<It>& rr = --r;
+    assert(r.base() == x);
+    assert(&rr == &r);
+}
+
+int main()
+{
+    char s[] = "123";
+    test(bidirectional_iterator<char*>(s+1), bidirectional_iterator<char*>(s));
+    test(random_access_iterator<char*>(s+1), random_access_iterator<char*>(s));
+    test(s+1, s);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.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>
+
+// move_iterator
+
+// move_iterator operator++(int);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, It x)
+{
+    std::move_iterator<It> r(i);
+    std::move_iterator<It> rr = r++;
+    assert(r.base() == x);
+    assert(rr.base() == i);
+}
+
+int main()
+{
+    char s[] = "123";
+    test(input_iterator<char*>(s), input_iterator<char*>(s+1));
+    test(forward_iterator<char*>(s), forward_iterator<char*>(s+1));
+    test(bidirectional_iterator<char*>(s), bidirectional_iterator<char*>(s+1));
+    test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1));
+    test(s, s+1);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.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>
+
+// move_iterator
+
+// move_iterator& operator++();
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, It x)
+{
+    std::move_iterator<It> r(i);
+    std::move_iterator<It>& rr = ++r;
+    assert(r.base() == x);
+    assert(&rr == &r);
+}
+
+int main()
+{
+    char s[] = "123";
+    test(input_iterator<char*>(s), input_iterator<char*>(s+1));
+    test(forward_iterator<char*>(s), forward_iterator<char*>(s+1));
+    test(bidirectional_iterator<char*>(s), bidirectional_iterator<char*>(s+1));
+    test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1));
+    test(s, s+1);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// move_iterator
+
+// requires RandomAccessIterator<Iter>
+//   unspecified operator[](difference_type n) const;
+
+#include <iterator>
+#include <cassert>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#include <memory>
+#endif
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::difference_type n,
+     typename std::iterator_traits<It>::value_type x)
+{
+    typedef typename std::iterator_traits<It>::value_type value_type;
+    const std::move_iterator<It> r(i);
+    value_type rr = r[n];
+    assert(rr == x);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+struct do_nothing
+{
+    void operator()(void*) const {}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+    char s[] = "1234567890";
+    test(random_access_iterator<char*>(s+5), 4, '0');
+    test(s+5, 4, '0');
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    int i[5];
+    typedef std::unique_ptr<int, do_nothing> Ptr;
+    Ptr p[5];
+    for (unsigned j = 0; j < 5; ++j)
+        p[j].reset(i+j);
+    test(p, 3, Ptr(i+3));
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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>
+
+// move_iterator
+
+// pointer operator->() const;
+
+#include <iterator>
+#include <cassert>
+
+template <class It>
+void
+test(It i)
+{
+    std::move_iterator<It> r(i);
+    assert(r.operator->() == i);
+}
+
+int main()
+{
+    char s[] = "123";
+    test(s);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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>
+
+// move_iterator
+
+// reference operator*() const;
+
+#include <iterator>
+#include <cassert>
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#include <memory>
+#endif
+
+class A
+{
+    int data_;
+public:
+    A() : data_(1) {}
+    ~A() {data_ = -1;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.data_ == y.data_;}
+};
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::value_type x)
+{
+    std::move_iterator<It> r(i);
+    assert(*r == x);
+    typename std::iterator_traits<It>::value_type x2 = *r;
+    assert(x2 == x);
+}
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+struct do_nothing
+{
+    void operator()(void*) const {}
+};
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+    A a;
+    test(&a, A());
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    int i;
+    std::unique_ptr<int, do_nothing> p(&i);
+    test(&p, std::unique_ptr<int, do_nothing>(&i));
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op%3D/move_iterator.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.fail.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.fail.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>
+
+// move_iterator
+
+// template <class U>
+//   requires HasAssign<Iter, const U&>
+//   move_iterator&
+//   operator=(const move_iterator<U>& u);
+
+// test requires
+
+#include <iterator>
+
+template <class It, class U>
+void
+test(U u)
+{
+    const std::move_iterator<U> r2(u);
+    std::move_iterator<It> r1;
+    r1 = r2;
+}
+
+struct base {};
+struct derived {};
+
+int main()
+{
+    derived d;
+    test<base*>(&d);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op%3D/move_iterator.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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>
+
+// move_iterator
+
+// template <class U>
+//   requires HasAssign<Iter, const U&>
+//   move_iterator&
+//   operator=(const move_iterator<U>& u);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It, class U>
+void
+test(U u)
+{
+    const std::move_iterator<U> r2(u);
+    std::move_iterator<It> r1;
+    std::move_iterator<It>& rr = r1 = r2;
+    assert(r1.base() == u);
+    assert(&rr == &r1);
+}
+
+struct Base {};
+struct Derived : Base {};
+
+int main()
+{
+    Derived d;
+
+    test<input_iterator<Base*> >(input_iterator<Derived*>(&d));
+    test<forward_iterator<Base*> >(forward_iterator<Derived*>(&d));
+    test<bidirectional_iterator<Base*> >(bidirectional_iterator<Derived*>(&d));
+    test<random_access_iterator<const Base*> >(random_access_iterator<Derived*>(&d));
+    test<Base*>(&d);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/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/predef.iterators/move.iterators/move.iter.requirements/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.requirements/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.requirements/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.requirements/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/predef.iterators/move.iterators/move.iterator/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// move_iterator
+
+// Test nested types:
+
+// template <InputIterator Iter>
+// class move_iterator {
+// public:
+//   typedef Iter                  iterator_type;
+//   typedef Iter::difference_type difference_type;
+//   typedef Iterator              pointer;
+//   typedef Iter::value_type      value_type;
+//   typedef value_type&&          reference;
+// };
+
+#include <iterator>
+#include <type_traits>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test()
+{
+    typedef std::move_iterator<It> R;
+    typedef std::iterator_traits<It> T;
+    static_assert((std::is_same<typename R::iterator_type, It>::value), "");
+    static_assert((std::is_same<typename R::difference_type, typename T::difference_type>::value), "");
+    static_assert((std::is_same<typename R::pointer, typename T::pointer>::value), "");
+    static_assert((std::is_same<typename R::value_type, typename T::value_type>::value), "");
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    static_assert((std::is_same<typename R::reference, typename R::value_type&&>::value), "");
+#else
+    static_assert((std::is_same<typename R::reference, typename T::reference>::value), "");
+#endif
+    static_assert((std::is_same<typename R::iterator_category, typename T::iterator_category>::value), "");
+}
+
+int main()
+{
+    test<input_iterator<char*> >();
+    test<forward_iterator<char*> >();
+    test<bidirectional_iterator<char*> >();
+    test<random_access_iterator<char*> >();
+    test<char*>();
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.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/predef.iterators/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.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/predef.iterators/reverse.iterators/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.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/predef.iterators/reverse.iterators/reverse.iter.ops/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/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/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// reverse_iterator();
+
+#include <iterator>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test()
+{
+    std::reverse_iterator<It> r;
+}
+
+int main()
+{
+    test<bidirectional_iterator<const char*> >();
+    test<random_access_iterator<char*> >();
+    test<char*>();
+    test<const char*>();
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.fail.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.fail.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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>
+
+// reverse_iterator
+
+// explicit reverse_iterator(Iter x);
+
+// test explicit
+
+#include <iterator>
+
+template <class It>
+void
+test(It i)
+{
+    std::reverse_iterator<It> r = i;
+}
+
+int main()
+{
+    const char s[] = "123";
+    test(s);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// explicit reverse_iterator(Iter x);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i)
+{
+    std::reverse_iterator<It> r(i);
+    assert(r.base() == i);
+}
+
+int main()
+{
+    const char s[] = "123";
+    test(bidirectional_iterator<const char*>(s));
+    test(random_access_iterator<const char*>(s));
+    test(s);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.fail.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.fail.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>
+
+// reverse_iterator
+
+// template <class U>
+//   requires HasConstructor<Iter, const U&>
+//   reverse_iterator(const reverse_iterator<U> &u);
+
+// test requires
+
+#include <iterator>
+
+template <class It, class U>
+void
+test(U u)
+{
+    std::reverse_iterator<U> r2(u);
+    std::reverse_iterator<It> r1 = r2;
+}
+
+struct base {};
+struct derived {};
+
+int main()
+{
+    derived d;
+
+    test<base*>(&d);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// template <class U>
+//   requires HasConstructor<Iter, const U&>
+//   reverse_iterator(const reverse_iterator<U> &u);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It, class U>
+void
+test(U u)
+{
+    const std::reverse_iterator<U> r2(u);
+    std::reverse_iterator<It> r1 = r2;
+    assert(r1.base() == u);
+}
+
+struct Base {};
+struct Derived : Base {};
+
+int main()
+{
+    Derived d;
+
+    test<bidirectional_iterator<Base*> >(bidirectional_iterator<Derived*>(&d));
+    test<random_access_iterator<const Base*> >(random_access_iterator<Derived*>(&d));
+    test<Base*>(&d);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.conv/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.conv/tested_elsewhere.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.conv/tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.conv/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/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.make/make_reverse_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.make/make_reverse_iterator.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.make/make_reverse_iterator.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.make/make_reverse_iterator.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// template <class Iterator> reverse_iterator<Iterator>
+//     make_reverse_iterator(Iterator i);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+#if _LIBCPP_STD_VER > 11
+
+template <class It>
+void
+test(It i)
+{
+    const std::reverse_iterator<It> r = std::make_reverse_iterator(i);
+    assert(r.base() == i);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    random_access_iterator<const char*>b(s);
+    random_access_iterator<const char*>e(s+10);
+    while ( b != e )
+        test ( b++ );
+}
+#else
+int main () {}
+#endif

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op!=/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op%21%3D/test.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op!=/test.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op!=/test.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// template <BidirectionalIterator Iter1, BidirectionalIterator Iter2>
+//   requires HasEqualTo<Iter1, Iter2>
+//   bool
+//   operator!=(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It l, It r, bool x)
+{
+    const std::reverse_iterator<It> r1(l);
+    const std::reverse_iterator<It> r2(r);
+    assert((r1 != r2) == x);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s), false);
+    test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s+1), true);
+    test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s), false);
+    test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), true);
+    test(s, s, false);
+    test(s, s+1, true);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/post.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op%2B%2B/post.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/post.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/post.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// reverse_iterator operator++(int);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, It x)
+{
+    std::reverse_iterator<It> r(i);
+    std::reverse_iterator<It> rr = r++;
+    assert(r.base() == x);
+    assert(rr.base() == i);
+}
+
+int main()
+{
+    const char* s = "123";
+    test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s));
+    test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s));
+    test(s+1, s);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/pre.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op%2B%2B/pre.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/pre.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/pre.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// reverse_iterator& operator++();
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, It x)
+{
+    std::reverse_iterator<It> r(i);
+    std::reverse_iterator<It>& rr = ++r;
+    assert(r.base() == x);
+    assert(&rr == &r);
+}
+
+int main()
+{
+    const char* s = "123";
+    test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s));
+    test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s));
+    test(s+1, s);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op%2B/difference_type.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+/difference_type.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+/difference_type.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// requires RandomAccessIterator<Iter>
+//   reverse_iterator operator+(difference_type n) const;
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::difference_type n, It x)
+{
+    const std::reverse_iterator<It> r(i);
+    std::reverse_iterator<It> rr = r + n;
+    assert(rr.base() == x);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
+    test(s+5, 5, s);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+=/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op%2B%3D/difference_type.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+=/difference_type.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+=/difference_type.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// requires RandomAccessIterator<Iter>
+//   reverse_iterator& operator+=(difference_type n);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::difference_type n, It x)
+{
+    std::reverse_iterator<It> r(i);
+    std::reverse_iterator<It>& rr = r += n;
+    assert(r.base() == x);
+    assert(&rr == &r);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
+    test(s+5, 5, s);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/post.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/post.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/post.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/post.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// reverse_iterator operator--(int);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, It x)
+{
+    std::reverse_iterator<It> r(i);
+    std::reverse_iterator<It> rr = r--;
+    assert(r.base() == x);
+    assert(rr.base() == i);
+}
+
+int main()
+{
+    const char* s = "123";
+    test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s+2));
+    test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s+2));
+    test(s+1, s+2);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/pre.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/pre.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/pre.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/pre.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// reverse_iterator& operator--();
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, It x)
+{
+    std::reverse_iterator<It> r(i);
+    std::reverse_iterator<It>& rr = --r;
+    assert(r.base() == x);
+    assert(&rr == &r);
+}
+
+int main()
+{
+    const char* s = "123";
+    test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s+2));
+    test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s+2));
+    test(s+1, s+2);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-/difference_type.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-/difference_type.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-/difference_type.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// requires RandomAccessIterator<Iter>
+//   reverse_iterator operator-(difference_type n) const;
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::difference_type n, It x)
+{
+    const std::reverse_iterator<It> r(i);
+    std::reverse_iterator<It> rr = r - n;
+    assert(rr.base() == x);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s+10));
+    test(s+5, 5, s+10);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-=/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-%3D/difference_type.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-=/difference_type.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-=/difference_type.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// requires RandomAccessIterator<Iter>
+//   reverse_iterator& operator-=(difference_type n);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::difference_type n, It x)
+{
+    std::reverse_iterator<It> r(i);
+    std::reverse_iterator<It>& rr = r -= n;
+    assert(r.base() == x);
+    assert(&rr == &r);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s+10));
+    test(s+5, 5, s+10);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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>
+
+// reverse_iterator
+
+// reference operator*() const;
+
+// Be sure to respect LWG 198:
+//    http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#198
+// LWG 198 was superseded by LWG 2360
+//    http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2360
+
+#include <iterator>
+#include <cassert>
+
+class A
+{
+    int data_;
+public:
+    A() : data_(1) {}
+    ~A() {data_ = -1;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.data_ == y.data_;}
+};
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::value_type x)
+{
+    std::reverse_iterator<It> r(i);
+    assert(*r == x);
+}
+
+int main()
+{
+    A a;
+    test(&a+1, A());
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op%3D/reverse_iterator.fail.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.fail.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.fail.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>
+
+// reverse_iterator
+
+// template <class U>
+//   requires HasAssign<Iter, const U&>
+//   reverse_iterator&
+//   operator=(const reverse_iterator<U>& u);
+
+// test requires
+
+#include <iterator>
+
+template <class It, class U>
+void
+test(U u)
+{
+    const std::reverse_iterator<U> r2(u);
+    std::reverse_iterator<It> r1;
+    r1 = r2;
+}
+
+struct base {};
+struct derived {};
+
+int main()
+{
+    derived d;
+    test<base*>(&d);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op%3D/reverse_iterator.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// template <class U>
+//   requires HasAssign<Iter, const U&>
+//   reverse_iterator&
+//   operator=(const reverse_iterator<U>& u);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It, class U>
+void
+test(U u)
+{
+    const std::reverse_iterator<U> r2(u);
+    std::reverse_iterator<It> r1;
+    std::reverse_iterator<It>& rr = r1 = r2;
+    assert(r1.base() == u);
+    assert(&rr == &r1);
+}
+
+struct Base {};
+struct Derived : Base {};
+
+int main()
+{
+    Derived d;
+
+    test<bidirectional_iterator<Base*> >(bidirectional_iterator<Derived*>(&d));
+    test<random_access_iterator<const Base*> >(random_access_iterator<Derived*>(&d));
+    test<Base*>(&d);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op==/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op%3D%3D/test.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op==/test.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op==/test.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// template <BidirectionalIterator Iter1, BidirectionalIterator Iter2>
+//   requires HasEqualTo<Iter1, Iter2>
+//   bool
+//   operator==(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It l, It r, bool x)
+{
+    const std::reverse_iterator<It> r1(l);
+    const std::reverse_iterator<It> r2(r);
+    assert((r1 == r2) == x);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s), true);
+    test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s+1), false);
+    test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s), true);
+    test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), false);
+    test(s, s, true);
+    test(s, s+1, false);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opdiff/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opdiff/test.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opdiff/test.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opdiff/test.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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>
+
+// reverse_iterator
+
+// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
+//   requires HasMinus<Iter2, Iter1>
+//   auto operator-(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y)
+//   -> decltype(y.base() - x.base());
+
+#include <iterator>
+#include <cstddef>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It1, class It2>
+void
+test(It1 l, It2 r, std::ptrdiff_t x)
+{
+    const std::reverse_iterator<It1> r1(l);
+    const std::reverse_iterator<It2> r2(r);
+    assert((r1 - r2) == x);
+}
+
+int main()
+{
+    char s[3] = {0};
+    test(random_access_iterator<const char*>(s), random_access_iterator<char*>(s), 0);
+    test(random_access_iterator<char*>(s), random_access_iterator<const char*>(s+1), 1);
+    test(random_access_iterator<const char*>(s+1), random_access_iterator<char*>(s), -1);
+    test(s, s, 0);
+    test(s, s+1, 1);
+    test(s+1, s, -1);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt/test.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt/test.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt/test.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
+//   requires HasGreater<Iter1, Iter2>
+//   bool
+//   operator>(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It l, It r, bool x)
+{
+    const std::reverse_iterator<It> r1(l);
+    const std::reverse_iterator<It> r2(r);
+    assert((r1 > r2) == x);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s), false);
+    test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), true);
+    test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s), false);
+    test(s, s, false);
+    test(s, s+1, true);
+    test(s+1, s, false);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt=/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt%3D/test.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt=/test.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt=/test.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
+//   requires HasGreater<Iter1, Iter2>
+//   bool
+//   operator>=(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It l, It r, bool x)
+{
+    const std::reverse_iterator<It> r1(l);
+    const std::reverse_iterator<It> r2(r);
+    assert((r1 >= r2) == x);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s), true);
+    test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), true);
+    test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s), false);
+    test(s, s, true);
+    test(s, s+1, true);
+    test(s+1, s, false);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.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>
+
+// reverse_iterator
+
+// requires RandomAccessIterator<Iter>
+//   unspecified operator[](difference_type n) const;
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::difference_type n,
+     typename std::iterator_traits<It>::value_type x)
+{
+    typedef typename std::iterator_traits<It>::value_type value_type;
+    const std::reverse_iterator<It> r(i);
+    value_type rr = r[n];
+    assert(rr == x);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(random_access_iterator<const char*>(s+5), 4, '1');
+    test(s+5, 4, '1');
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt/test.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt/test.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt/test.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
+//   requires HasGreater<Iter1, Iter2>
+//   bool
+//   operator<(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It l, It r, bool x)
+{
+    const std::reverse_iterator<It> r1(l);
+    const std::reverse_iterator<It> r2(r);
+    assert((r1 < r2) == x);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s), false);
+    test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), false);
+    test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s), true);
+    test(s, s, false);
+    test(s, s+1, false);
+    test(s+1, s, true);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt=/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt%3D/test.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt=/test.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt=/test.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
+//   requires HasGreater<Iter1, Iter2>
+//   bool
+//   operator<=(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It l, It r, bool x)
+{
+    const std::reverse_iterator<It> r1(l);
+    const std::reverse_iterator<It> r2(r);
+    assert((r1 <= r2) == x);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s), true);
+    test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), false);
+    test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s), true);
+    test(s, s, true);
+    test(s, s+1, false);
+    test(s+1, s, true);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// pointer operator->() const;
+
+// Be sure to respect LWG 198:
+//    http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#198
+// LWG 198 was superseded by LWG 2360
+//    http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2360
+
+
+#include <iterator>
+#include <list>
+#include <cassert>
+
+class A
+{
+    int data_;
+public:
+    A() : data_(1) {}
+    ~A() {data_ = -1;}
+
+    int get() const {return data_;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.data_ == y.data_;}
+};
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::value_type x)
+{
+    std::reverse_iterator<It> r(i);
+    assert(r->get() == x.get());
+}
+
+class B
+{
+    int data_;
+public:
+    B(int d=1) : data_(d) {}
+    ~B() {data_ = -1;}
+
+    int get() const {return data_;}
+
+    friend bool operator==(const B& x, const B& y)
+        {return x.data_ == y.data_;}
+    const B *operator&() const { return nullptr; }
+    B       *operator&()       { return nullptr; }
+};
+
+int main()
+{
+    A a;
+    test(&a+1, A());
+    
+    {
+    std::list<B> l;
+    l.push_back(B(0));
+    l.push_back(B(1));
+    l.push_back(B(2));
+    
+    {
+    std::list<B>::const_iterator i = l.begin();
+    assert ( i->get() == 0 );  ++i;
+    assert ( i->get() == 1 );  ++i;
+    assert ( i->get() == 2 );  ++i;
+    assert ( i == l.end ());
+    }
+    
+    {
+    std::list<B>::const_reverse_iterator ri = l.rbegin();
+    assert ( ri->get() == 2 );  ++ri;
+    assert ( ri->get() == 1 );  ++ri;
+    assert ( ri->get() == 0 );  ++ri;
+    assert ( ri == l.rend ());
+    }
+    }
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opsum/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opsum/difference_type.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opsum/difference_type.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opsum/difference_type.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// reverse_iterator
+
+// template <RandomAccessIterator Iterator>
+//   reverse_iterator<Iter>
+//   operator+(Iter::difference_type n, const reverse_iterator<Iter>& x);
+
+#include <iterator>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class It>
+void
+test(It i, typename std::iterator_traits<It>::difference_type n, It x)
+{
+    const std::reverse_iterator<It> r(i);
+    std::reverse_iterator<It> rr = n + r;
+    assert(rr.base() == x);
+}
+
+int main()
+{
+    const char* s = "1234567890";
+    test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
+    test(s+5, 5, s);
+}

Added: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.requirements/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.requirements/nothing_to_do.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.requirements/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.requirements/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/predef.iterators/reverse.iterators/reverse.iterator/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iterator/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iterator/types.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iterator/types.pass.cpp Fri Dec 19 19:40:03 2014
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The 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>
+
+// reverse_iterator
+
+// Test nested types and data member:
+
+// template <BidirectionalIterator Iter>
+// class reverse_iterator {
+// protected:
+//   Iter current;
+// public:
+//   iterator<typename iterator_traits<Iterator>::iterator_category,
+//   typename iterator_traits<Iterator>::value_type,
+//   typename iterator_traits<Iterator>::difference_type,
+//   typename iterator_traits<Iterator>::pointer,
+//   typename iterator_traits<Iterator>::reference> {
+// };
+
+#include <iterator>
+#include <type_traits>
+
+#include "test_iterators.h"
+
+template <class It>
+struct find_current
+    : private std::reverse_iterator<It>
+{
+    void test() {++(this->current);}
+};
+
+template <class It>
+void
+test()
+{
+    typedef std::reverse_iterator<It> R;
+    typedef std::iterator_traits<It> T;
+    find_current<It> q;
+    q.test();
+    static_assert((std::is_same<typename R::iterator_type, It>::value), "");
+    static_assert((std::is_same<typename R::value_type, typename T::value_type>::value), "");
+    static_assert((std::is_same<typename R::difference_type, typename T::difference_type>::value), "");
+    static_assert((std::is_same<typename R::reference, typename T::reference>::value), "");
+    static_assert((std::is_same<typename R::pointer, typename std::iterator_traits<It>::pointer>::value), "");
+    static_assert((std::is_same<typename R::iterator_category, typename T::iterator_category>::value), "");
+}
+
+int main()
+{
+    test<bidirectional_iterator<char*> >();
+    test<random_access_iterator<char*> >();
+    test<char*>();
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// class istream_iterator
+
+// istream_iterator(const istream_iterator& x);
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::istream_iterator<int> io;
+        std::istream_iterator<int> i = io;
+        assert(i == std::istream_iterator<int>());
+    }
+    {
+        std::istringstream inf(" 1 23");
+        std::istream_iterator<int> io(inf);
+        std::istream_iterator<int> i = io;
+        assert(i != std::istream_iterator<int>());
+        int j = 0;
+        j = *i;
+        assert(j == 1);
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.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>
+
+// class istream_iterator
+
+// istream_iterator();
+
+#include <iterator>
+#include <cassert>
+
+int main()
+{
+    std::istream_iterator<int> i;
+    assert(i == std::istream_iterator<int>());
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/istream.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/istream.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/istream.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/istream.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 istream_iterator
+
+// istream_iterator(istream_type& s);
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    std::istringstream inf(" 1 23");
+    std::istream_iterator<int> i(inf);
+    assert(i != std::istream_iterator<int>());
+    assert(inf.peek() == ' ');
+    assert(inf.good());
+    int j = 0;
+    inf >> j;
+    assert(j == 23);
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/arrow.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/arrow.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/arrow.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/arrow.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// class istream_iterator
+
+// const T* operator->() const;
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+struct A
+{
+    double d_;
+    int i_;
+};
+
+std::istream& operator>>(std::istream& is, A& a)
+{
+    return is >> a.d_ >> a.i_;
+}
+
+int main()
+{
+    std::istringstream inf("1.5  23 ");
+    std::istream_iterator<A> i(inf);
+    assert(i->d_ == 1.5);
+    assert(i->i_ == 23);
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/dereference.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/dereference.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/dereference.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/dereference.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 istream_iterator
+
+// const T& operator*() const;
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    std::istringstream inf(" 1 23");
+    std::istream_iterator<int> i(inf);
+    int j = 0;
+    j = *i;
+    assert(j == 1);
+    j = *i;
+    assert(j == 1);
+    ++i;
+    j = *i;
+    assert(j == 23);
+    j = *i;
+    assert(j == 23);
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/equal.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/equal.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/equal.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// class istream_iterator
+
+// template <class T, class charT, class traits, class Distance>
+//   bool operator==(const istream_iterator<T,charT,traits,Distance> &x,
+//                   const istream_iterator<T,charT,traits,Distance> &y);
+//
+// template <class T, class charT, class traits, class Distance>
+//   bool operator!=(const istream_iterator<T,charT,traits,Distance> &x,
+//                   const istream_iterator<T,charT,traits,Distance> &y);
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    std::istringstream inf1(" 1 23");
+    std::istringstream inf2(" 1 23");
+    std::istream_iterator<int> i1(inf1);
+    std::istream_iterator<int> i2(inf1);
+    std::istream_iterator<int> i3(inf2);
+    std::istream_iterator<int> i4;
+    std::istream_iterator<int> i5;
+    assert(i1 == i1);
+    assert(i1 == i2);
+    assert(i1 != i3);
+    assert(i1 != i4);
+    assert(i1 != i5);
+
+    assert(i2 == i2);
+    assert(i2 != i3);
+    assert(i2 != i4);
+    assert(i2 != i5);
+
+    assert(i3 == i3);
+    assert(i3 != i4);
+    assert(i3 != i5);
+
+    assert(i4 == i4);
+    assert(i4 == i5);
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/post_increment.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/post_increment.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/post_increment.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/post_increment.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 istream_iterator
+
+// istream_iterator operator++(int);
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    std::istringstream inf(" 1 23");
+    std::istream_iterator<int> i(inf);
+    std::istream_iterator<int> icopy = i++;
+    assert(icopy == i);
+    int j = 0;
+    j = *i;
+    assert(j == 23);
+    j = 0;
+    j = *icopy;
+    assert(j == 1);
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/pre_increment.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/pre_increment.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/pre_increment.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.ops/pre_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 istream_iterator
+
+// istream_iterator& operator++();
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    std::istringstream inf(" 1 23");
+    std::istream_iterator<int> i(inf);
+    std::istream_iterator<int>& iref = ++i;
+    assert(&iref == &i);
+    int j = 0;
+    j = *i;
+    assert(j == 23);
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/types.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// template <class T, class charT = char, class traits = char_traits<charT>,
+//           class Distance = ptrdiff_t>
+// class istream_iterator
+//     : public iterator<input_iterator_tag, T, Distance, const T*, const T&>
+// {
+// 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::istream_iterator<double> I1;
+    static_assert((std::is_convertible<I1,
+        std::iterator<std::input_iterator_tag, double, std::ptrdiff_t,
+        const double*, const double&> >::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::istream_type, std::istream>::value), "");
+    typedef std::istream_iterator<unsigned, wchar_t> I2;
+    static_assert((std::is_convertible<I2,
+        std::iterator<std::input_iterator_tag, unsigned, std::ptrdiff_t,
+        const unsigned*, const unsigned&> >::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::istream_type, std::wistream>::value), "");
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/default.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/default.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/default.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>
+
+// istreambuf_iterator
+
+// istreambuf_iterator() throw();
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::istreambuf_iterator<char> i;
+        assert(i == std::istreambuf_iterator<char>());
+    }
+    {
+        std::istreambuf_iterator<wchar_t> i;
+        assert(i == std::istreambuf_iterator<wchar_t>());
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/istream.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/istream.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/istream.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/istream.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// istreambuf_iterator
+
+// istreambuf_iterator(basic_istream<charT,traits>& s) throw();
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::istringstream inf;
+        std::istreambuf_iterator<char> i(inf);
+        assert(i == std::istreambuf_iterator<char>());
+    }
+    {
+        std::istringstream inf("a");
+        std::istreambuf_iterator<char> i(inf);
+        assert(i != std::istreambuf_iterator<char>());
+    }
+    {
+        std::wistringstream inf;
+        std::istreambuf_iterator<wchar_t> i(inf);
+        assert(i == std::istreambuf_iterator<wchar_t>());
+    }
+    {
+        std::wistringstream inf(L"a");
+        std::istreambuf_iterator<wchar_t> i(inf);
+        assert(i != std::istreambuf_iterator<wchar_t>());
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/proxy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/proxy.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/proxy.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/proxy.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// istreambuf_iterator
+
+// istreambuf_iterator(const proxy& p) throw();
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::istringstream inf("abc");
+        std::istreambuf_iterator<char> j(inf);
+        std::istreambuf_iterator<char> i = j++;
+        assert(i != std::istreambuf_iterator<char>());
+        assert(*i == 'b');
+    }
+    {
+        std::wistringstream inf(L"abc");
+        std::istreambuf_iterator<wchar_t> j(inf);
+        std::istreambuf_iterator<wchar_t> i = j++;
+        assert(i != std::istreambuf_iterator<wchar_t>());
+        assert(*i == L'b');
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/streambuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/streambuf.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/streambuf.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/streambuf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// istreambuf_iterator
+
+// istreambuf_iterator(basic_streambuf<charT,traits>* s) throw();
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::istreambuf_iterator<char> i(nullptr);
+        assert(i == std::istreambuf_iterator<char>());
+    }
+    {
+        std::istringstream inf;
+        std::istreambuf_iterator<char> i(inf.rdbuf());
+        assert(i == std::istreambuf_iterator<char>());
+    }
+    {
+        std::istringstream inf("a");
+        std::istreambuf_iterator<char> i(inf.rdbuf());
+        assert(i != std::istreambuf_iterator<char>());
+    }
+    {
+        std::istreambuf_iterator<wchar_t> i(nullptr);
+        assert(i == std::istreambuf_iterator<wchar_t>());
+    }
+    {
+        std::wistringstream inf;
+        std::istreambuf_iterator<wchar_t> i(inf.rdbuf());
+        assert(i == std::istreambuf_iterator<wchar_t>());
+    }
+    {
+        std::wistringstream inf(L"a");
+        std::istreambuf_iterator<wchar_t> i(inf.rdbuf());
+        assert(i != std::istreambuf_iterator<wchar_t>());
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_equal/equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_equal/equal.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_equal/equal.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_equal/equal.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// istreambuf_iterator
+
+// bool equal(istreambuf_iterator<charT,traits>& b) const;
+
+#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.equal(i1));
+        assert( i1.equal(i2));
+        assert(!i1.equal(i3));
+        assert(!i1.equal(i4));
+
+        assert( i2.equal(i1));
+        assert( i2.equal(i2));
+        assert(!i2.equal(i3));
+        assert(!i2.equal(i4));
+
+        assert(!i3.equal(i1));
+        assert(!i3.equal(i2));
+        assert( i3.equal(i3));
+        assert( i3.equal(i4));
+
+        assert(!i4.equal(i1));
+        assert(!i4.equal(i2));
+        assert( i4.equal(i3));
+        assert( i4.equal(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.equal(i1));
+        assert( i1.equal(i2));
+        assert(!i1.equal(i3));
+        assert(!i1.equal(i4));
+
+        assert( i2.equal(i1));
+        assert( i2.equal(i2));
+        assert(!i2.equal(i3));
+        assert(!i2.equal(i4));
+
+        assert(!i3.equal(i1));
+        assert(!i3.equal(i2));
+        assert( i3.equal(i3));
+        assert( i3.equal(i4));
+
+        assert(!i4.equal(i1));
+        assert(!i4.equal(i2));
+        assert( i4.equal(i3));
+        assert( i4.equal(i4));
+    }
+}

Added: libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op!=/not_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op%21%3D/not_equal.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op!=/not_equal.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op!=/not_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++/dereference.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op%2B%2B/dereference.pass.cpp?rev=224658&view=auto
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op++/dereference.pass.cpp (added)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op++/dereference.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>
+
+// istreambuf_iterator
+
+// charT operator*() const
+
+#include <iterator>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    {
+        std::istringstream inf("abc");
+        std::istreambuf_iterator<char> i(inf);
+        assert(*i == 'a');
+        ++i;
+        assert(*i == 'b');
+        ++i;
+        assert(*i == 'c');
+    }
+    {
+        std::wistringstream inf(L"abc");
+        std::istreambuf_iterator<wchar_t> i(inf);
+        assert(*i == L'a');
+        ++i;
+        assert(*i == L'b');
+        ++i;
+        assert(*i == L'c');
+    }
+}





More information about the cfe-commits mailing list