blob: be2065c3f2464af9c5fc258b7135947cdd195996 [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnant5b08a8a2010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnant3e519522010-05-11 19:42:16 +00004//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <iomanip>
11
12// T5 setprecision(int n);
13
14#include <iomanip>
15#include <cassert>
16
17template <class CharT>
18struct testbuf
19 : public std::basic_streambuf<CharT>
20{
21 testbuf() {}
22};
23
24int main()
25{
26 {
27 testbuf<char> sb;
28 std::istream is(&sb);
29 is >> std::setprecision(10);
30 assert(is.precision() == 10);
31 }
32 {
33 testbuf<char> sb;
34 std::ostream os(&sb);
35 os << std::setprecision(10);
36 assert(os.precision() == 10);
37 }
38 {
39 testbuf<wchar_t> sb;
40 std::wistream is(&sb);
41 is >> std::setprecision(10);
42 assert(is.precision() == 10);
43 }
44 {
45 testbuf<wchar_t> sb;
46 std::wostream os(&sb);
47 os << std::setprecision(10);
48 assert(os.precision() == 10);
49 }
50}