OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libstdc++-v3/] [testsuite/] [22_locale/] [numpunct/] [members/] [char/] [2.cc] - Blame information for rev 19

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 jlechner
// { dg-require-namedlocale "" }
2
 
3
// 2001-01-17 Benjamin Kosnik  <bkoz@redhat.com>
4
 
5
// Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation
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
10
// Free Software Foundation; either version 2, or (at your option)
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
19
// with this library; see the file COPYING.  If not, write to the Free
20
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21
// USA.
22
 
23
// 22.2.3.1.1 nunpunct members
24
 
25
#include <locale>
26
#include <testsuite_hooks.h>
27
 
28
void test02()
29
{
30
  using namespace std;
31
 
32
  bool test __attribute__((unused)) = true;
33
 
34
  // basic construction
35
  locale loc_c = locale::classic();
36
  locale loc_us = locale("en_US");
37
  locale loc_fr = locale("fr_FR");
38
  locale loc_de = locale("de_DE");
39
  VERIFY( loc_c != loc_de );
40
  VERIFY( loc_us != loc_fr );
41
  VERIFY( loc_us != loc_de );
42
  VERIFY( loc_de != loc_fr );
43
 
44
  // cache the numpunct facets
45
  const numpunct<char>& nump_c = use_facet<numpunct<char> >(loc_c);
46
  const numpunct<char>& nump_us = use_facet<numpunct<char> >(loc_us);
47
  const numpunct<char>& nump_fr = use_facet<numpunct<char> >(loc_fr);
48
  const numpunct<char>& nump_de = use_facet<numpunct<char> >(loc_de);
49
 
50
  // sanity check the data is correct.
51
  string g1 = nump_c.grouping();
52
  string t1 = nump_c.truename();
53
  string f1 = nump_c.falsename();
54
 
55
  char dp2 = nump_us.decimal_point();
56
  char th2 = nump_us.thousands_sep();
57
  string g2 = nump_us.grouping();
58
  string t2 = nump_us.truename();
59
  string f2 = nump_us.falsename();
60
 
61
  char dp3 = nump_fr.decimal_point();
62
  char th3 = nump_fr.thousands_sep();
63
  string g3 = nump_fr.grouping();
64
  string t3 = nump_fr.truename();
65
  string f3 = nump_fr.falsename();
66
 
67
  char dp4 = nump_de.decimal_point();
68
  char th4 = nump_de.thousands_sep();
69
  string g4 = nump_de.grouping();
70
  string t4 = nump_de.truename();
71
  string f4 = nump_de.falsename();
72
 
73
  VERIFY( dp2 != dp3 );
74
  VERIFY( th2 != th3 );
75
 
76
  VERIFY( dp2 != dp4 );
77
  VERIFY( th2 != th4 );
78
  // XXX This isn't actually supported right now.
79
  // VERIFY( t2 != t3 );
80
  // VERIFY( f2 != f3 );
81
}
82
 
83
int main()
84
{
85
  test02();
86
  return 0;
87
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.