]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/3.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 27_io / basic_ostream / inserters_arithmetic / wchar_t / 3.cc
CommitLineData
85ec4feb 1// Copyright (C) 2005-2018 Free Software Foundation, Inc.
ba4b172f
PC
2//
3// This file is part of the GNU ISO C++ Library. This library is free
4// software; you can redistribute it and/or modify it under the
5// terms of the GNU General Public License as published by the
748086b7 6// Free Software Foundation; either version 3, or (at your option)
ba4b172f
PC
7// any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License along
748086b7
JJ
15// with this library; see the file COPYING3. If not see
16// <http://www.gnu.org/licenses/>.
ba4b172f
PC
17
18#include <sstream>
19#include <limits>
20#include <testsuite_hooks.h>
21
22template<typename T>
fd0bf20c 23void
ba4b172f
PC
24test03_check(T n)
25{
26 using namespace std;
ba4b172f
PC
27
28 wstringbuf strbuf;
29 wostream o(&strbuf);
30 const wchar_t *expect;
31
32 if (numeric_limits<T>::digits + 1 == 16)
33 expect = L"177777 ffff";
34 else if (numeric_limits<T>::digits + 1 == 32)
35 expect = L"37777777777 ffffffff";
36 else if (numeric_limits<T>::digits + 1 == 64)
37 expect = L"1777777777777777777777 ffffffffffffffff";
38 else
39 expect = L"wow, you've got some big numbers here";
40
41 o << oct << n << L' ' << hex << n;
42 VERIFY ( strbuf.str() == expect );
ba4b172f
PC
43}
44
45void
46test03()
47{
48 short s = -1;
49 int i = -1;
50 long l = -1;
51
52 test03_check(s);
53 test03_check(i);
54 test03_check(l);
55}
56
57int
58main()
59{
60 test03();
61 return 0;
62}