OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libstdc++-v3/] [testsuite/] [22_locale/] [moneypunct/] [members/] [char/] [2.cc] - Blame information for rev 19

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 jlechner
// { dg-require-namedlocale "" }
2
 
3
// 2001-08-23 Benjamin Kosnik  <bkoz@redhat.com>
4
 
5
// Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation
6
//
7
// This file is part of the GNU ISO C++ Library.  This library is free
8
// software; you can redistribute it and/or modify it under the
9
// terms of the GNU General Public License as published by the
10
// Free Software Foundation; either version 2, or (at your option)
11
// any later version.
12
 
13
// This library is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
// GNU General Public License for more details.
17
 
18
// You should have received a copy of the GNU General Public License along
19
// with this library; see the file COPYING.  If not, write to the Free
20
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21
// USA.
22
 
23
// 22.2.6.3.1 moneypunct members
24
 
25
#include <locale>
26
#include <string>
27
#include <testsuite_hooks.h>
28
 
29
void test02()
30
{
31
  using namespace std;
32
  typedef money_base::part part;
33
  typedef money_base::pattern pattern;
34
 
35
  bool test __attribute__((unused)) = true;
36
 
37
  // basic construction
38
  locale loc_c = locale::classic();
39
  locale loc_de = locale("de_DE");
40
 
41
  // cache the moneypunct facets
42
  typedef moneypunct<char, true> __money_true;
43
  typedef moneypunct<char, false> __money_false;
44
  const __money_true& monp_c_t = use_facet<__money_true>(loc_c);
45
  const __money_false& monp_c_f = use_facet<__money_false>(loc_c);
46
  const __money_true& monp_de_t = use_facet<__money_true>(loc_de);
47
 
48
  // quick sanity check for data.
49
  char q1 = monp_c_t.decimal_point();
50
  char q2 = monp_c_t.thousands_sep();
51
  char q3 = monp_c_f.decimal_point();
52
  char q4 = monp_c_f.thousands_sep();
53
  VERIFY( q1 != char() );
54
  VERIFY( q2 != char() );
55
  VERIFY( q3 != char() );
56
  VERIFY( q4 != char() );
57
 
58
  // sanity check the data is correct.
59
  char dp1 = monp_c_t.decimal_point();
60
  char th1 = monp_c_t.thousands_sep();
61
  string g1 = monp_c_t.grouping();
62
  string cs1 = monp_c_t.curr_symbol();
63
  string ps1 = monp_c_t.positive_sign();
64
  string ns1 = monp_c_t.negative_sign();
65
  int fd1 = monp_c_t.frac_digits();
66
  pattern pos1 = monp_c_t.pos_format();
67
  pattern neg1 = monp_c_t.neg_format();
68
 
69
  char dp2 = monp_de_t.decimal_point();
70
  char th2 = monp_de_t.thousands_sep();
71
  string g2 = monp_de_t.grouping();
72
  string cs2 = monp_de_t.curr_symbol();
73
  string ps2 = monp_de_t.positive_sign();
74
  string ns2 = monp_de_t.negative_sign();
75
  int fd2 = monp_de_t.frac_digits();
76
  pattern pos2 = monp_de_t.pos_format();
77
  pattern neg2 = monp_de_t.neg_format();
78
 
79
  VERIFY( dp1 != dp2 );
80
  VERIFY( th1 != th2 );
81
  VERIFY( g1 != g2 );
82
  VERIFY( cs1 != cs2 );
83
  //  VERIFY( ps1 != ps2 );
84
  VERIFY( ns1 != ns2 );
85
  VERIFY( fd1 != fd2 );
86
  VERIFY(static_cast<part>(pos1.field[0]) != static_cast<part>(pos2.field[0]));
87
  VERIFY(static_cast<part>(pos1.field[1]) != static_cast<part>(pos2.field[1]));
88
  VERIFY(static_cast<part>(pos1.field[2]) != static_cast<part>(pos2.field[2]));
89
  VERIFY(static_cast<part>(pos1.field[3]) != static_cast<part>(pos2.field[3]));
90
 
91
  VERIFY(static_cast<part>(neg1.field[0]) != static_cast<part>(neg2.field[0]));
92
  VERIFY(static_cast<part>(neg1.field[1]) != static_cast<part>(neg2.field[1]));
93
  VERIFY(static_cast<part>(neg1.field[2]) != static_cast<part>(neg2.field[2]));
94
  VERIFY(static_cast<part>(neg1.field[3]) != static_cast<part>(neg2.field[3]));
95
}
96
 
97
int main()
98
{
99
  test02();
100
  return 0;
101
}

powered by: WebSVN 2.1.0

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