]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/22_locale/moneypunct/members/char/2.cc
1 // 2001-08-23 Benjamin Kosnik <bkoz@redhat.com>
3 // Copyright (C) 2001, 2002, 2003 Free Software Foundation
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 2, or (at your option)
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.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
21 // 22.2.6.3.1 moneypunct members
25 #include <testsuite_hooks.h>
30 typedef money_base::part part
;
31 typedef money_base::pattern pattern
;
33 bool test
__attribute__((unused
)) = true;
36 locale loc_c
= locale::classic();
37 locale loc_de
= __gnu_test::try_named_locale("de_DE");
39 // cache the moneypunct facets
40 typedef moneypunct
<char, true> __money_true
;
41 typedef moneypunct
<char, false> __money_false
;
42 const __money_true
& monp_c_t
= use_facet
<__money_true
>(loc_c
);
43 const __money_false
& monp_c_f
= use_facet
<__money_false
>(loc_c
);
44 const __money_true
& monp_de_t
= use_facet
<__money_true
>(loc_de
);
46 // quick sanity check for data.
47 char q1
= monp_c_t
.decimal_point();
48 char q2
= monp_c_t
.thousands_sep();
49 char q3
= monp_c_f
.decimal_point();
50 char q4
= monp_c_f
.thousands_sep();
51 VERIFY( q1
!= char() );
52 VERIFY( q2
!= char() );
53 VERIFY( q3
!= char() );
54 VERIFY( q4
!= char() );
56 // sanity check the data is correct.
57 char dp1
= monp_c_t
.decimal_point();
58 char th1
= monp_c_t
.thousands_sep();
59 string g1
= monp_c_t
.grouping();
60 string cs1
= monp_c_t
.curr_symbol();
61 string ps1
= monp_c_t
.positive_sign();
62 string ns1
= monp_c_t
.negative_sign();
63 int fd1
= monp_c_t
.frac_digits();
64 pattern pos1
= monp_c_t
.pos_format();
65 pattern neg1
= monp_c_t
.neg_format();
67 char dp2
= monp_de_t
.decimal_point();
68 char th2
= monp_de_t
.thousands_sep();
69 string g2
= monp_de_t
.grouping();
70 string cs2
= monp_de_t
.curr_symbol();
71 string ps2
= monp_de_t
.positive_sign();
72 string ns2
= monp_de_t
.negative_sign();
73 int fd2
= monp_de_t
.frac_digits();
74 pattern pos2
= monp_de_t
.pos_format();
75 pattern neg2
= monp_de_t
.neg_format();
81 // VERIFY( ps1 != ps2 );
84 VERIFY(static_cast<part
>(pos1
.field
[0]) != static_cast<part
>(pos2
.field
[0]));
85 VERIFY(static_cast<part
>(pos1
.field
[1]) != static_cast<part
>(pos2
.field
[1]));
86 VERIFY(static_cast<part
>(pos1
.field
[2]) != static_cast<part
>(pos2
.field
[2]));
87 VERIFY(static_cast<part
>(pos1
.field
[3]) != static_cast<part
>(pos2
.field
[3]));
89 VERIFY(static_cast<part
>(neg1
.field
[0]) != static_cast<part
>(neg2
.field
[0]));
90 VERIFY(static_cast<part
>(neg1
.field
[1]) != static_cast<part
>(neg2
.field
[1]));
91 VERIFY(static_cast<part
>(neg1
.field
[2]) != static_cast<part
>(neg2
.field
[2]));
92 VERIFY(static_cast<part
>(neg1
.field
[3]) != static_cast<part
>(neg2
.field
[3]));