]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/22_locale/numpunct_members_wchar_t.cc
1 // 2001-11-20 Benjamin Kosnik <bkoz@redhat.com>
3 // Copyright (C) 2001, 2002 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.3.1.1 nunpunct members
24 #include <testsuite_hooks.h>
26 // XXX This test is not working for non-glibc locale models.
27 // { dg-do run { xfail *-*-* } }
29 #ifdef _GLIBCPP_USE_WCHAR_T
37 locale loc_c
= locale::classic();
38 locale
loc_us("en_US");
39 locale
loc_fr("fr_FR");
40 locale
loc_de("de_DE");
41 VERIFY( loc_c
!= loc_de
);
42 VERIFY( loc_us
!= loc_fr
);
43 VERIFY( loc_us
!= loc_de
);
44 VERIFY( loc_de
!= loc_fr
);
46 // cache the numpunct facets
47 const numpunct
<wchar_t>& nump_c
= use_facet
<numpunct
<wchar_t> >(loc_c
);
48 const numpunct
<wchar_t>& nump_us
= use_facet
<numpunct
<wchar_t> >(loc_us
);
49 const numpunct
<wchar_t>& nump_fr
= use_facet
<numpunct
<wchar_t> >(loc_fr
);
50 const numpunct
<wchar_t>& nump_de
= use_facet
<numpunct
<wchar_t> >(loc_de
);
52 // sanity check the data is correct.
53 wchar_t dp1
= nump_c
.decimal_point();
54 wchar_t th1
= nump_c
.thousands_sep();
55 string g1
= nump_c
.grouping();
56 wstring t1
= nump_c
.truename();
57 wstring f1
= nump_c
.falsename();
59 wchar_t dp2
= nump_us
.decimal_point();
60 wchar_t th2
= nump_us
.thousands_sep();
61 string g2
= nump_us
.grouping();
62 wstring t2
= nump_us
.truename();
63 wstring f2
= nump_us
.falsename();
65 wchar_t dp3
= nump_fr
.decimal_point();
66 wchar_t th3
= nump_fr
.thousands_sep();
67 string g3
= nump_fr
.grouping();
68 wstring t3
= nump_fr
.truename();
69 wstring f3
= nump_fr
.falsename();
71 wchar_t dp4
= nump_de
.decimal_point();
72 wchar_t th4
= nump_de
.thousands_sep();
73 string g4
= nump_de
.grouping();
74 wstring t4
= nump_de
.truename();
75 wstring f4
= nump_de
.falsename();
87 #ifdef _GLIBCPP_HAVE_SETENV
88 // Set the global locale to non-"C".
89 std::locale
loc_de("de_DE");
90 std::locale::global(loc_de
);
92 // Set LANG environment variable to de_DE.
93 const char* oldLANG
= getenv("LANG");
94 if (!setenv("LANG", "de_DE", 1))
97 setenv("LANG", oldLANG
? oldLANG
: "", 1);
102 // http://gcc.gnu.org/ml/libstdc++/2002-05/msg00038.html
107 const char* tentLANG
= std::setlocale(LC_ALL
, "ja_JP.eucjp");
108 if (tentLANG
!= NULL
)
110 std::string preLANG
= tentLANG
;
112 std::string postLANG
= std::setlocale(LC_ALL
, NULL
);
113 VERIFY( preLANG
== postLANG
);
120 #ifdef _GLIBCPP_USE_WCHAR_T