]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/7.cc
1 // 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
3 // Copyright (C) 2001-2013 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/>.
20 // 22.2.6.1.1 money_get members
24 #include <testsuite_hooks.h>
26 // We were appending to the string val passed by reference, instead
27 // of constructing a temporary candidate, eventually copied into
28 // val in case of successful parsing.
32 bool test
__attribute__((unused
)) = true;
34 typedef istreambuf_iterator
<wchar_t> InIt
;
35 InIt iend1
, iend2
, iend3
;
37 locale loc_c
= locale::classic();
38 wstring
buffer1(L
"123");
39 wstring
buffer2(L
"456");
40 wstring
buffer3(L
"Golgafrincham"); // From Nathan's original idea.
44 ios_base::iostate err
;
46 const money_get
<wchar_t, InIt
>& mg
= use_facet
<money_get
<wchar_t, InIt
> >(loc_c
);
48 wistringstream
fmt1(buffer1
);
51 mg
.get(ibeg1
, iend1
, false, fmt1
, err
, val
);
52 VERIFY( val
== buffer1
);
54 wistringstream
fmt2(buffer2
);
57 mg
.get(ibeg2
, iend2
, false, fmt2
, err
, val
);
58 VERIFY( val
== buffer2
);
61 wistringstream
fmt3(buffer3
);
64 mg
.get(ibeg3
, iend3
, false, fmt3
, err
, val
);
65 VERIFY( val
== buffer3
);