2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libstdc++-v3 / testsuite / 22_locale / numpunct / members / char / 2.cc
blobcbff78e57409ff671038806747b77136ed3f6687
1 // 2001-01-17 Benjamin Kosnik <bkoz@redhat.com>
3 // Copyright (C) 2001, 2002, 2003 Free Software Foundation
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.
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,
19 // USA.
21 // 22.2.3.1.1 nunpunct members
23 #include <locale>
24 #include <testsuite_hooks.h>
26 void test02()
28 using namespace std;
30 bool test __attribute__((unused)) = true;
32 // basic construction
33 locale loc_c = locale::classic();
34 locale loc_us = __gnu_test::try_named_locale("en_US");
35 locale loc_fr = __gnu_test::try_named_locale("fr_FR");
36 locale loc_de = __gnu_test::try_named_locale("de_DE");
37 VERIFY( loc_c != loc_de );
38 VERIFY( loc_us != loc_fr );
39 VERIFY( loc_us != loc_de );
40 VERIFY( loc_de != loc_fr );
42 // cache the numpunct facets
43 const numpunct<char>& nump_c = use_facet<numpunct<char> >(loc_c);
44 const numpunct<char>& nump_us = use_facet<numpunct<char> >(loc_us);
45 const numpunct<char>& nump_fr = use_facet<numpunct<char> >(loc_fr);
46 const numpunct<char>& nump_de = use_facet<numpunct<char> >(loc_de);
48 // sanity check the data is correct.
49 string g1 = nump_c.grouping();
50 string t1 = nump_c.truename();
51 string f1 = nump_c.falsename();
53 char dp2 = nump_us.decimal_point();
54 char th2 = nump_us.thousands_sep();
55 string g2 = nump_us.grouping();
56 string t2 = nump_us.truename();
57 string f2 = nump_us.falsename();
59 char dp3 = nump_fr.decimal_point();
60 char th3 = nump_fr.thousands_sep();
61 string g3 = nump_fr.grouping();
62 string t3 = nump_fr.truename();
63 string f3 = nump_fr.falsename();
65 char dp4 = nump_de.decimal_point();
66 char th4 = nump_de.thousands_sep();
67 string g4 = nump_de.grouping();
68 string t4 = nump_de.truename();
69 string f4 = nump_de.falsename();
71 VERIFY( dp2 != dp3 );
72 VERIFY( th2 != th3 );
74 VERIFY( dp2 != dp4 );
75 VERIFY( th2 != th4 );
76 // XXX This isn't actually supported right now.
77 // VERIFY( t2 != t3 );
78 // VERIFY( f2 != f3 );
81 int main()
83 test02();
84 return 0;