]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/22_locale/numpunct/members/pod/1.cc
1 // 2003-07-09 Benjamin Kosnik <bkoz@redhat.com>
3 // Copyright (C) 2003-2024 Free Software Foundation, Inc.
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 3, 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 COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
24 #include <testsuite_hooks.h>
25 #include <testsuite_character.h>
27 // Check for numpunct and ctype dependencies. Make sure that numpunct
28 // can be created without ctype.
32 using __gnu_test::pod_ushort
;
33 typedef pod_ushort::value_type value_type
;
34 typedef numpunct
<pod_ushort
>::string_type string_type
;
35 typedef basic_stringbuf
<pod_ushort
> stringbuf_type
;
36 typedef basic_ostream
<pod_ushort
> ostream_type
;
38 // Pre-cache sanity check.
39 const locale
loc(locale::classic(), new numpunct
<pod_ushort
>);
40 const numpunct
<pod_ushort
>& np
= use_facet
<numpunct
<pod_ushort
> >(loc
);
42 pod_ushort dp
= np
.decimal_point();
43 pod_ushort ts
= np
.thousands_sep();
44 string g
= np
.grouping();
45 string_type strue
= np
.truename();
46 string_type sfalse
= np
.falsename();
48 pod_ushort basedp
= { value_type('.') };
49 pod_ushort basets
= { value_type(',') };
51 string_type
basetrue(4, pod_ushort());
52 basetrue
[0].value
= value_type('t');
53 basetrue
[1].value
= value_type('r');
54 basetrue
[2].value
= value_type('u');
55 basetrue
[3].value
= value_type('e');
57 string_type
basefalse(5, pod_ushort());
58 basefalse
[0].value
= value_type('f');
59 basefalse
[1].value
= value_type('a');
60 basefalse
[2].value
= value_type('l');
61 basefalse
[3].value
= value_type('s');
62 basefalse
[4].value
= value_type('e');
64 VERIFY( char_traits
<pod_ushort
>::eq(dp
, basedp
) );
65 VERIFY( char_traits
<pod_ushort
>::eq(ts
, basets
) );
67 VERIFY( strue
== basetrue
);
68 VERIFY( sfalse
== basefalse
);