1 // 2005-09-30 Paolo Carlini <pcarlini@suse.de>
3 // Copyright (C) 2005 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 // 22.2.2.1.1 num_get members
25 #include <testsuite_hooks.h>
29 struct Punct1
: numpunct
<char>
30 { string
do_grouping() const { return string(1, char(-1)); } };
32 struct Punct2
: numpunct
<char>
33 { string
do_grouping() const { return string("\002") + char(-1); } };
35 struct Punct3
: numpunct
<char>
36 { string
do_grouping() const { return string("\001\002") + char(-1); } };
41 bool test
__attribute__((unused
)) = true;
42 typedef istreambuf_iterator
<char> iterator_type
;
44 istringstream iss1
, iss2
, iss3
;
45 iss1
.imbue(locale(iss1
.getloc(), new Punct1
));
46 iss2
.imbue(locale(iss2
.getloc(), new Punct2
));
47 iss3
.imbue(locale(iss3
.getloc(), new Punct3
));
48 const num_get
<char>& ng1
= use_facet
<num_get
<char> >(iss1
.getloc());
49 const num_get
<char>& ng2
= use_facet
<num_get
<char> >(iss2
.getloc());
50 const num_get
<char>& ng3
= use_facet
<num_get
<char> >(iss3
.getloc());
52 ios_base::iostate err
= ios_base::goodbit
;
58 double d1
= 1234567.0;
61 err
= ios_base::goodbit
;
62 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, l
);
63 VERIFY( err
== ios_base::eofbit
);
66 iss2
.str("123456,78");
67 err
= ios_base::goodbit
;
68 end
= ng2
.get(iss2
.rdbuf(), 0, iss2
, err
, l
);
69 VERIFY( err
== ios_base::eofbit
);
72 iss3
.str("1234,56,7.0");
73 err
= ios_base::goodbit
;
74 end
= ng3
.get(iss3
.rdbuf(), 0, iss3
, err
, d
);
75 VERIFY( err
== ios_base::eofbit
);