]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/22_locale/money_get/get/char/7.cc
1 // 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
3 // Copyright (C) 2001, 2002, 2003 Free Software Foundation
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)
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,
21 // 22.2.6.1.1 money_get members
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.
35 typedef istreambuf_iterator
<char> InIt
;
36 InIt iend1
, iend2
, iend3
;
38 locale loc_c
= locale::classic();
39 string
buffer1("123");
40 string
buffer2("456");
41 string
buffer3("Golgafrincham"); // From Nathan's original idea.
45 ios_base::iostate err
;
47 const money_get
<char,InIt
>& mg
= use_facet
<money_get
<char, InIt
> >(loc_c
);
49 istringstream
fmt1(buffer1
);
51 mg
.get(ibeg1
,iend1
,false,fmt1
,err
,val
);
52 VERIFY( val
== buffer1
);
54 istringstream
fmt2(buffer2
);
56 mg
.get(ibeg2
,iend2
,false,fmt2
,err
,val
);
57 VERIFY( val
== buffer2
);
60 istringstream
fmt3(buffer3
);
62 mg
.get(ibeg3
,iend3
,false,fmt3
,err
,val
);
63 VERIFY( val
== buffer3
);