]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/22_locale/moneypunct/members/char/1.cc
1 // 2001-08-23 Benjamin Kosnik <bkoz@redhat.com>
3 // Copyright (C) 2001-2018 Free Software Foundation, Inc.
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)
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 COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
20 // 22.2.6.3.1 moneypunct members
24 #include <testsuite_hooks.h>
29 typedef money_base::part part
;
30 typedef money_base::pattern pattern
;
33 locale loc_c
= locale::classic();
35 // cache the moneypunct facets
36 typedef moneypunct
<char, true> __money_true
;
37 typedef moneypunct
<char, false> __money_false
;
38 const __money_true
& monp_c_t
= use_facet
<__money_true
>(loc_c
);
39 const __money_false
& monp_c_f
= use_facet
<__money_false
>(loc_c
);
41 // quick sanity check for data.
42 char q1
= monp_c_t
.decimal_point();
43 char q2
= monp_c_t
.thousands_sep();
44 char q3
= monp_c_f
.decimal_point();
45 char q4
= monp_c_f
.thousands_sep();
46 string g1
= monp_c_t
.grouping();
47 string g2
= monp_c_f
.grouping();
48 string cs1
= monp_c_t
.curr_symbol();
49 string cs2
= monp_c_f
.curr_symbol();
50 string ps1
= monp_c_t
.positive_sign();
51 string ns1
= monp_c_t
.negative_sign();
52 string ps2
= monp_c_f
.positive_sign();
53 string ns2
= monp_c_f
.negative_sign();
54 int fd1
= monp_c_t
.frac_digits();
55 int fd2
= monp_c_f
.frac_digits();
56 pattern pos1
= monp_c_t
.pos_format();
57 pattern neg1
= monp_c_t
.neg_format();
58 pattern pos2
= monp_c_f
.pos_format();
59 pattern neg2
= monp_c_f
.neg_format();
78 VERIFY(static_cast<part
>(pos1
.field
[0]) == static_cast<part
>(pos2
.field
[0]));
79 VERIFY(static_cast<part
>(pos1
.field
[1]) == static_cast<part
>(pos2
.field
[1]));
80 VERIFY(static_cast<part
>(pos1
.field
[2]) == static_cast<part
>(pos2
.field
[2]));
81 VERIFY(static_cast<part
>(pos1
.field
[3]) == static_cast<part
>(pos2
.field
[3]));
84 VERIFY( pos1
[0] == money_base::_S_default_pattern
[0] );
85 VERIFY( pos1
[1] == money_base::_S_default_pattern
[1] );
86 VERIFY( pos1
[2] == money_base::_S_default_pattern
[2] );
87 VERIFY( pos1
[3] == money_base::_S_default_pattern
[3] );
88 VERIFY( pos2
== money_base::_S_default_pattern
);
89 VERIFY( neg1
== money_base::_S_default_pattern
);
90 VERIFY( neg2
== money_base::_S_default_pattern
);