]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/22_locale/moneypunct/members/wchar_t/2.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 22_locale / moneypunct / members / wchar_t / 2.cc
CommitLineData
4216708a 1// { dg-require-namedlocale "de_DE.ISO8859-15" }
f63a8495 2
5f8d36fe 3// 2001-08-23 Benjamin Kosnik <bkoz@redhat.com>
69971cd8 4
cbe34bb5 5// Copyright (C) 2001-2017 Free Software Foundation, Inc.
69971cd8
BK
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
748086b7 10// Free Software Foundation; either version 3, or (at your option)
69971cd8
BK
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
748086b7
JJ
19// with this library; see the file COPYING3. If not see
20// <http://www.gnu.org/licenses/>.
69971cd8
BK
21
22// 22.2.6.3.1 moneypunct members
23
24#include <locale>
5f8d36fe 25#include <string>
69971cd8
BK
26#include <testsuite_hooks.h>
27
5f8d36fe 28void test02()
69971cd8
BK
29{
30 using namespace std;
31 typedef money_base::part part;
32 typedef money_base::pattern pattern;
33
69971cd8
BK
34 // basic construction
35 locale loc_c = locale::classic();
4216708a 36 locale loc_de = locale(ISO_8859(15,de_DE));
69971cd8
BK
37
38 // cache the moneypunct facets
39 typedef moneypunct<wchar_t, true> __money_true;
40 typedef moneypunct<wchar_t, false> __money_false;
41 const __money_true& monp_c_t = use_facet<__money_true>(loc_c);
69971cd8 42 const __money_false& monp_c_f = use_facet<__money_false>(loc_c);
5f8d36fe 43 const __money_true& monp_de_t = use_facet<__money_true>(loc_de);
69971cd8
BK
44
45 // quick sanity check for data.
46 wchar_t q1 = monp_c_t.decimal_point();
47 wchar_t q2 = monp_c_t.thousands_sep();
48 wchar_t q3 = monp_c_f.decimal_point();
49 wchar_t q4 = monp_c_f.thousands_sep();
50 VERIFY( q1 != wchar_t() );
51 VERIFY( q2 != wchar_t() );
52 VERIFY( q3 != wchar_t() );
53 VERIFY( q4 != wchar_t() );
54
55 // sanity check the data is correct.
56 wchar_t dp1 = monp_c_t.decimal_point();
57 wchar_t th1 = monp_c_t.thousands_sep();
58 string g1 = monp_c_t.grouping();
59 wstring cs1 = monp_c_t.curr_symbol();
60 wstring ps1 = monp_c_t.positive_sign();
61 wstring ns1 = monp_c_t.negative_sign();
62 int fd1 = monp_c_t.frac_digits();
63 pattern pos1 = monp_c_t.pos_format();
64 pattern neg1 = monp_c_t.neg_format();
65
66 wchar_t dp2 = monp_de_t.decimal_point();
67 wchar_t th2 = monp_de_t.thousands_sep();
68 string g2 = monp_de_t.grouping();
69 wstring cs2 = monp_de_t.curr_symbol();
70 wstring ps2 = monp_de_t.positive_sign();
71 wstring ns2 = monp_de_t.negative_sign();
72 int fd2 = monp_de_t.frac_digits();
73 pattern pos2 = monp_de_t.pos_format();
74 pattern neg2 = monp_de_t.neg_format();
75
76 VERIFY( dp1 != dp2 );
77 VERIFY( th1 != th2 );
78 VERIFY( g1 != g2 );
79 VERIFY( cs1 != cs2 );
80 // VERIFY( ps1 != ps2 );
81 VERIFY( ns1 != ns2 );
82 VERIFY( fd1 != fd2 );
83 VERIFY(static_cast<part>(pos1.field[0]) != static_cast<part>(pos2.field[0]));
84 VERIFY(static_cast<part>(pos1.field[1]) != static_cast<part>(pos2.field[1]));
85 VERIFY(static_cast<part>(pos1.field[2]) != static_cast<part>(pos2.field[2]));
86 VERIFY(static_cast<part>(pos1.field[3]) != static_cast<part>(pos2.field[3]));
87
88 VERIFY(static_cast<part>(neg1.field[0]) != static_cast<part>(neg2.field[0]));
89 VERIFY(static_cast<part>(neg1.field[1]) != static_cast<part>(neg2.field[1]));
90 VERIFY(static_cast<part>(neg1.field[2]) != static_cast<part>(neg2.field[2]));
91 VERIFY(static_cast<part>(neg1.field[3]) != static_cast<part>(neg2.field[3]));
92}
4b9aaf63 93
69971cd8
BK
94int main()
95{
4b9aaf63 96 test02();
69971cd8
BK
97 return 0;
98}