OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [libstdc++-v3/] [testsuite/] [22_locale/] [num_put/] [put/] [wchar_t/] [10.cc] - Blame information for rev 424

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 424 jeremybenn
// 2005-07-11  Paolo Carlini  <pcarlini@suse.de>
2
 
3
// Copyright (C) 2005, 2009 Free Software Foundation
4
//
5
// This file is part of the GNU ISO C++ Library.  This library is free
6
// software; you can redistribute it and/or modify it under the
7
// terms of the GNU General Public License as published by the
8
// Free Software Foundation; either version 3, or (at your option)
9
// any later version.
10
 
11
// This library is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
// GNU General Public License for more details.
15
 
16
// You should have received a copy of the GNU General Public License along
17
// with this library; see the file COPYING3.  If not see
18
// <http://www.gnu.org/licenses/>.
19
 
20
// 22.2.2.2.1  num_put members
21
 
22
#include <locale>
23
#include <sstream>
24
#include <testsuite_hooks.h>
25
 
26
void test01()
27
{
28
  using namespace std;
29
  bool test __attribute__((unused)) = true;
30
 
31
  locale loc_c = locale::classic();
32
 
33
  const wstring empty;
34
 
35
  wstringstream ss;
36
  ss.imbue(loc_c);
37
  const num_put<wchar_t>& np = use_facet<num_put<wchar_t> >(ss.getloc());
38
 
39
  long l = -1;
40
  unsigned long ul = 0;
41
 
42
  ss.setf(ios::hex, ios::basefield);
43
  np.put(ss.rdbuf(), ss, L'+', l);
44
  VERIFY( ss.str() != L"1" );
45
  ss >> ul;
46
  VERIFY( ul == static_cast<unsigned long>(l) );
47
 
48
#ifdef _GLIBCXX_USE_LONG_LONG  
49
  long long ll = -1LL;
50
  unsigned long long ull = 0ULL;
51
 
52
  ss.str(empty);
53
  ss.clear();
54
  np.put(ss.rdbuf(), ss, L'+', ll);
55
  VERIFY( ss.str() != L"1" );
56
  ss >> ull;
57
  VERIFY( ull == static_cast<unsigned long long>(ll) );
58
#endif
59
}
60
 
61
int main()
62
{
63
  test01();
64
  return 0;
65
}
66
 
67
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.