Dead
[official-gcc.git] / gomp-20050608-branch / libstdc++-v3 / testsuite / 22_locale / numpunct / members / pod / 1.cc
blob558dc0ca2cda8ba9a3aa8b7d67a5ebaf0997b709
1 // 2003-07-09 Benjamin Kosnik <bkoz@redhat.com>
3 // Copyright (C) 2003, 2005 Free Software Foundation, Inc.
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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19 // USA.
21 #include <locale>
22 #include <sstream>
23 #include <ostream>
24 #include <stdexcept>
25 #include <testsuite_hooks.h>
26 #include <testsuite_character.h>
28 // Check for numpunct and ctype dependencies. Make sure that numpunct
29 // can be created without ctype.
30 void test01()
32 using namespace std;
33 using __gnu_test::pod_ushort;
34 typedef pod_ushort::value_type value_type;
35 typedef numpunct<pod_ushort>::string_type string_type;
36 typedef basic_stringbuf<pod_ushort> stringbuf_type;
37 typedef basic_ostream<pod_ushort> ostream_type;
39 bool test __attribute__((unused)) = true;
41 // Pre-cache sanity check.
42 const locale loc(locale::classic(), new numpunct<pod_ushort>);
43 const numpunct<pod_ushort>& np = use_facet<numpunct<pod_ushort> >(loc);
45 pod_ushort dp = np.decimal_point();
46 pod_ushort ts = np.thousands_sep();
47 string g = np.grouping();
48 string_type strue = np.truename();
49 string_type sfalse = np.falsename();
51 pod_ushort basedp = { value_type('.') };
52 pod_ushort basets = { value_type(',') };
54 string_type basetrue(4, pod_ushort());
55 basetrue[0].value = value_type('t');
56 basetrue[1].value = value_type('r');
57 basetrue[2].value = value_type('u');
58 basetrue[3].value = value_type('e');
60 string_type basefalse(5, pod_ushort());
61 basefalse[0].value = value_type('f');
62 basefalse[1].value = value_type('a');
63 basefalse[2].value = value_type('l');
64 basefalse[3].value = value_type('s');
65 basefalse[4].value = value_type('e');
67 VERIFY( char_traits<pod_ushort>::eq(dp, basedp) );
68 VERIFY( char_traits<pod_ushort>::eq(ts, basets) );
69 VERIFY( g == "" );
70 VERIFY( strue == basetrue );
71 VERIFY( sfalse == basefalse );
74 int main()
76 test01();
77 return 0;