1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <iterator> 10 11 // istreambuf_iterator 12 13 // istreambuf_iterator(basic_streambuf<charT,traits>* s) throw(); 14 15 #include <iterator> 16 #include <sstream> 17 #include <cassert> 18 19 #include "test_macros.h" 20 main(int,char **)21int main(int, char**) 22 { 23 { 24 std::istreambuf_iterator<char> i(nullptr); 25 assert(i == std::istreambuf_iterator<char>()); 26 } 27 { 28 std::istringstream inf; 29 std::istreambuf_iterator<char> i(inf.rdbuf()); 30 assert(i == std::istreambuf_iterator<char>()); 31 } 32 { 33 std::istringstream inf("a"); 34 std::istreambuf_iterator<char> i(inf.rdbuf()); 35 assert(i != std::istreambuf_iterator<char>()); 36 } 37 #ifndef TEST_HAS_NO_WIDE_CHARACTERS 38 { 39 std::istreambuf_iterator<wchar_t> i(nullptr); 40 assert(i == std::istreambuf_iterator<wchar_t>()); 41 } 42 { 43 std::wistringstream inf; 44 std::istreambuf_iterator<wchar_t> i(inf.rdbuf()); 45 assert(i == std::istreambuf_iterator<wchar_t>()); 46 } 47 { 48 std::wistringstream inf(L"a"); 49 std::istreambuf_iterator<wchar_t> i(inf.rdbuf()); 50 assert(i != std::istreambuf_iterator<wchar_t>()); 51 } 52 #endif // TEST_HAS_NO_WIDE_CHARACTERS 53 54 return 0; 55 } 56