libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

istream.pass.cpp (1144B)


      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <iterator>
     11 
     12 // istreambuf_iterator
     13 
     14 // istreambuf_iterator(basic_istream<charT,traits>& s) throw();
     15 
     16 #include <iterator>
     17 #include <sstream>
     18 #include <cassert>
     19 
     20 int main()
     21 {
     22     {
     23         std::istringstream inf;
     24         std::istreambuf_iterator<char> i(inf);
     25         assert(i == std::istreambuf_iterator<char>());
     26     }
     27     {
     28         std::istringstream inf("a");
     29         std::istreambuf_iterator<char> i(inf);
     30         assert(i != std::istreambuf_iterator<char>());
     31     }
     32     {
     33         std::wistringstream inf;
     34         std::istreambuf_iterator<wchar_t> i(inf);
     35         assert(i == std::istreambuf_iterator<wchar_t>());
     36     }
     37     {
     38         std::wistringstream inf(L"a");
     39         std::istreambuf_iterator<wchar_t> i(inf);
     40         assert(i != std::istreambuf_iterator<wchar_t>());
     41     }
     42 }