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 // <ios>
11 
12 // template <class charT, class traits> class basic_ios
13 
14 // explicit basic_ios(basic_streambuf<charT,traits>* sb);
15 
16 #include <ios>
17 #include <streambuf>
18 #include <cassert>
19 
main()20 int main()
21 {
22     {
23         std::streambuf* sb = 0;
24         std::basic_ios<char> ios(sb);
25         assert(ios.rdbuf() == sb);
26         assert(ios.tie() == 0);
27         assert(ios.rdstate() == std::ios::badbit);
28         assert(ios.exceptions() == std::ios::goodbit);
29         assert(ios.flags() == (std::ios::skipws | std::ios::dec));
30         assert(ios.width() == 0);
31         assert(ios.precision() == 6);
32         assert(ios.fill() == ' ');
33         assert(ios.getloc() == std::locale());
34     }
35     {
36         std::streambuf* sb = (std::streambuf*)1;
37         std::basic_ios<char> ios(sb);
38         assert(ios.rdbuf() == sb);
39         assert(ios.tie() == 0);
40         assert(ios.rdstate() == std::ios::goodbit);
41         assert(ios.exceptions() == std::ios::goodbit);
42         assert(ios.flags() == (std::ios::skipws | std::ios::dec));
43         assert(ios.width() == 0);
44         assert(ios.precision() == 6);
45         assert(ios.fill() == ' ');
46         assert(ios.getloc() == std::locale());
47     }
48 }
49