]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/22_locale/locale/cons/7.cc
1 // { dg-require-namedlocale "is_IS.ISO8859-1" }
3 // 2001-01-19 Benjamin Kosnik <bkoz@redhat.com>
5 // Copyright (C) 2001-2020 Free Software Foundation, Inc.
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 3, or (at your option)
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.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
22 // 22.1.1 - Class locale [lib.locale]
26 #include <testsuite_hooks.h>
32 const string
name_c("C");
33 const string
name_no("*");
36 // construct a locale object with the specialized facet.
37 locale loc_c
= locale::classic();
38 locale loc_is
= locale(ISO_8859(1,is_IS
));
39 locale
loc_1(locale::classic(),
40 new numpunct_byname
<char>(ISO_8859(1,is_IS
)));
43 VERIFY( loc_c
.name() == name_c
);
44 VERIFY( loc_1
.name() == name_no
);
46 // sanity check the constructed locale has the specialized facet.
47 VERIFY( has_facet
<numpunct
<char> >(loc_1
) );
48 VERIFY( has_facet
<numpunct
<char> >(loc_c
) );
50 // attempt to re-synthesize classic locale
51 locale loc_2
= loc_1
.combine
<numpunct
<char> >(loc_c
);
52 VERIFY( loc_2
.name() == name_no
);
53 VERIFY( loc_2
!= loc_c
);
56 const numpunct
<char>& nump_1
= use_facet
<numpunct
<char> >(loc_1
);
57 const numpunct
<char>& nump_2
= use_facet
<numpunct
<char> >(loc_2
);
58 const numpunct
<char>& nump_c
= use_facet
<numpunct
<char> >(loc_c
);
59 const numpunct
<char>& nump_is
= use_facet
<numpunct
<char> >(loc_is
);
61 // sanity check the data is correct.
62 char dp1
= nump_c
.decimal_point();
63 char th1
= nump_c
.thousands_sep();
64 string g1
= nump_c
.grouping();
65 string t1
= nump_c
.truename();
66 string f1
= nump_c
.falsename();
68 char dp2
= nump_1
.decimal_point();
69 char th2
= nump_1
.thousands_sep();
70 string g2
= nump_1
.grouping();
71 string t2
= nump_1
.truename();
72 string f2
= nump_1
.falsename();
74 char dp3
= nump_2
.decimal_point();
75 char th3
= nump_2
.thousands_sep();
76 string g3
= nump_2
.grouping();
77 string t3
= nump_2
.truename();
78 string f3
= nump_2
.falsename();
80 char dp4
= nump_is
.decimal_point();
81 char th4
= nump_is
.thousands_sep();
82 string g4
= nump_is
.grouping();
83 string t4
= nump_is
.truename();
84 string f4
= nump_is
.falsename();