This commit was manufactured by cvs2svn to create branch
[official-gcc.git] / libstdc++-v3 / testsuite / 22_locale / money_get / get / wchar_t / 7.cc
blobf7f3ae1d9929c72bc2f2beeffad3b1e611f6b9f3
1 // 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
3 // Copyright (C) 2001, 2002, 2003, 2004 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.6.1.1 money_get members
23 #include <locale>
24 #include <sstream>
25 #include <testsuite_hooks.h>
27 // We were appending to the string val passed by reference, instead
28 // of constructing a temporary candidate, eventually copied into
29 // val in case of successful parsing.
30 void test07()
32 using namespace std;
33 bool test __attribute__((unused)) = true;
35 typedef istreambuf_iterator<wchar_t> InIt;
36 InIt iend1, iend2, iend3;
38 locale loc_c = locale::classic();
39 wstring buffer1(L"123");
40 wstring buffer2(L"456");
41 wstring buffer3(L"Golgafrincham"); // From Nathan's original idea.
43 wstring val;
45 ios_base::iostate err;
47 const money_get<wchar_t, InIt>& mg = use_facet<money_get<wchar_t, InIt> >(loc_c);
49 wistringstream fmt1(buffer1);
50 fmt1.imbue(loc_c);
51 InIt ibeg1(fmt1);
52 mg.get(ibeg1, iend1, false, fmt1, err, val);
53 VERIFY( val == buffer1 );
55 wistringstream fmt2(buffer2);
56 fmt2.imbue(loc_c);
57 InIt ibeg2(fmt2);
58 mg.get(ibeg2, iend2, false, fmt2, err, val);
59 VERIFY( val == buffer2 );
61 val = buffer3;
62 wistringstream fmt3(buffer3);
63 fmt3.imbue(loc_c);
64 InIt ibeg3(fmt3);
65 mg.get(ibeg3, iend3, false, fmt3, err, val);
66 VERIFY( val == buffer3 );
69 int main()
71 test07();
72 return 0;