1 // 2005-06-28 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>
27 struct Punct
: std::numpunct
<char>
29 std::string
do_grouping() const { return "\1"; }
30 char do_thousands_sep() const { return '#'; }
37 typedef istreambuf_iterator
<char> iterator_type
;
39 bool test
__attribute__((unused
)) = true;
41 istringstream iss1
, iss2
;
42 iss1
.imbue(locale(iss1
.getloc(), new Punct
));
43 const num_get
<char>& ng1
= use_facet
<num_get
<char> >(iss1
.getloc());
45 ios_base::iostate err
= ios_base::goodbit
;
56 err
= ios_base::goodbit
;
57 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, l
);
58 VERIFY( err
== (ios_base::eofbit
| ios_base::failbit
) );
63 err
= ios_base::goodbit
;
64 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, l
);
65 VERIFY( err
== ios_base::failbit
);
66 VERIFY( *end
== '#' );
71 err
= ios_base::goodbit
;
72 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, l
);
73 VERIFY( err
== ios_base::eofbit
);
78 err
= ios_base::goodbit
;
79 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, d
);
80 VERIFY( err
== (ios_base::eofbit
| ios_base::failbit
) );
85 err
= ios_base::goodbit
;
86 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, d
);
87 VERIFY( err
== ios_base::failbit
);
88 VERIFY( *end
== '#' );
93 err
= ios_base::goodbit
;
94 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, d
);
95 VERIFY( err
== ios_base::eofbit
);
100 iss1
.unsetf(ios::basefield
);
101 err
= ios_base::goodbit
;
102 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, l
);
103 VERIFY( err
== ios_base::failbit
);
104 VERIFY( *end
== '#' );
109 err
= ios_base::goodbit
;
110 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, l
);
111 VERIFY( err
== ios_base::eofbit
);
116 err
= ios_base::goodbit
;
117 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, l
);
118 VERIFY( err
== (ios_base::eofbit
| ios_base::failbit
) );