]>
Commit | Line | Data |
---|---|---|
5f8d36fe | 1 | // 2001-08-23 Benjamin Kosnik <bkoz@redhat.com> |
69971cd8 | 2 | |
5f8d36fe | 3 | // Copyright (C) 2001, 2002, 2003 Free Software Foundation |
69971cd8 BK |
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 2, 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 COPYING. If not, write to the Free | |
18 | // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
19 | // USA. | |
20 | ||
21 | // 22.2.6.3.1 moneypunct members | |
22 | ||
23 | #include <locale> | |
5f8d36fe | 24 | #include <string> |
69971cd8 BK |
25 | #include <testsuite_hooks.h> |
26 | ||
5f8d36fe | 27 | void test02() |
69971cd8 BK |
28 | { |
29 | using namespace std; | |
30 | typedef money_base::part part; | |
31 | typedef money_base::pattern pattern; | |
32 | ||
33 | bool test = true; | |
69971cd8 BK |
34 | |
35 | // basic construction | |
36 | locale loc_c = locale::classic(); | |
aecf642c | 37 | locale loc_de = __gnu_test::try_named_locale("de_DE"); |
69971cd8 BK |
38 | |
39 | // cache the moneypunct facets | |
40 | typedef moneypunct<wchar_t, true> __money_true; | |
41 | typedef moneypunct<wchar_t, false> __money_false; | |
42 | const __money_true& monp_c_t = use_facet<__money_true>(loc_c); | |
69971cd8 | 43 | const __money_false& monp_c_f = use_facet<__money_false>(loc_c); |
5f8d36fe | 44 | const __money_true& monp_de_t = use_facet<__money_true>(loc_de); |
69971cd8 BK |
45 | const __money_false& monp_de_f = use_facet<__money_false>(loc_de); |
46 | ||
47 | // quick sanity check for data. | |
48 | wchar_t q1 = monp_c_t.decimal_point(); | |
49 | wchar_t q2 = monp_c_t.thousands_sep(); | |
50 | wchar_t q3 = monp_c_f.decimal_point(); | |
51 | wchar_t q4 = monp_c_f.thousands_sep(); | |
52 | VERIFY( q1 != wchar_t() ); | |
53 | VERIFY( q2 != wchar_t() ); | |
54 | VERIFY( q3 != wchar_t() ); | |
55 | VERIFY( q4 != wchar_t() ); | |
56 | ||
57 | // sanity check the data is correct. | |
58 | wchar_t dp1 = monp_c_t.decimal_point(); | |
59 | wchar_t th1 = monp_c_t.thousands_sep(); | |
60 | string g1 = monp_c_t.grouping(); | |
61 | wstring cs1 = monp_c_t.curr_symbol(); | |
62 | wstring ps1 = monp_c_t.positive_sign(); | |
63 | wstring ns1 = monp_c_t.negative_sign(); | |
64 | int fd1 = monp_c_t.frac_digits(); | |
65 | pattern pos1 = monp_c_t.pos_format(); | |
66 | pattern neg1 = monp_c_t.neg_format(); | |
67 | ||
68 | wchar_t dp2 = monp_de_t.decimal_point(); | |
69 | wchar_t th2 = monp_de_t.thousands_sep(); | |
70 | string g2 = monp_de_t.grouping(); | |
71 | wstring cs2 = monp_de_t.curr_symbol(); | |
72 | wstring ps2 = monp_de_t.positive_sign(); | |
73 | wstring ns2 = monp_de_t.negative_sign(); | |
74 | int fd2 = monp_de_t.frac_digits(); | |
75 | pattern pos2 = monp_de_t.pos_format(); | |
76 | pattern neg2 = monp_de_t.neg_format(); | |
77 | ||
78 | VERIFY( dp1 != dp2 ); | |
79 | VERIFY( th1 != th2 ); | |
80 | VERIFY( g1 != g2 ); | |
81 | VERIFY( cs1 != cs2 ); | |
82 | // VERIFY( ps1 != ps2 ); | |
83 | VERIFY( ns1 != ns2 ); | |
84 | VERIFY( fd1 != fd2 ); | |
85 | VERIFY(static_cast<part>(pos1.field[0]) != static_cast<part>(pos2.field[0])); | |
86 | VERIFY(static_cast<part>(pos1.field[1]) != static_cast<part>(pos2.field[1])); | |
87 | VERIFY(static_cast<part>(pos1.field[2]) != static_cast<part>(pos2.field[2])); | |
88 | VERIFY(static_cast<part>(pos1.field[3]) != static_cast<part>(pos2.field[3])); | |
89 | ||
90 | VERIFY(static_cast<part>(neg1.field[0]) != static_cast<part>(neg2.field[0])); | |
91 | VERIFY(static_cast<part>(neg1.field[1]) != static_cast<part>(neg2.field[1])); | |
92 | VERIFY(static_cast<part>(neg1.field[2]) != static_cast<part>(neg2.field[2])); | |
93 | VERIFY(static_cast<part>(neg1.field[3]) != static_cast<part>(neg2.field[3])); | |
94 | } | |
4b9aaf63 | 95 | |
69971cd8 BK |
96 | int main() |
97 | { | |
4b9aaf63 | 98 | test02(); |
69971cd8 BK |
99 | return 0; |
100 | } |