1 // Copyright (C) 2003 Free Software Foundation
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 2, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING. If not, write to the Free
16 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19 // 22.2.2.1.1 num_get members
23 #include <testsuite_hooks.h>
25 struct Punct1
: std::numpunct
<char>
27 std::string
do_grouping() const { return "\1"; }
28 char do_thousands_sep() const { return '2'; }
29 char do_decimal_point() const { return '4'; }
32 struct Punct2
: std::numpunct
<char>
34 std::string
do_grouping() const { return "\1"; }
35 char do_thousands_sep() const { return '2'; }
36 char do_decimal_point() const { return '2'; }
39 // http://gcc.gnu.org/ml/libstdc++/2003-12/msg00201.html
43 typedef istreambuf_iterator
<char> iterator_type
;
45 bool test
__attribute__((unused
)) = true;
47 istringstream iss1
, iss2
;
48 iss1
.imbue(locale(iss1
.getloc(), new Punct1
));
49 iss2
.imbue(locale(iss2
.getloc(), new Punct2
));
50 const num_get
<char>& ng1
= use_facet
<num_get
<char> >(iss1
.getloc());
51 const num_get
<char>& ng2
= use_facet
<num_get
<char> >(iss2
.getloc());
53 ios_base::iostate err
= ios_base::goodbit
;
64 err
= ios_base::goodbit
;
65 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, d
);
66 VERIFY( err
== ios_base::eofbit
);
71 err
= ios_base::goodbit
;
72 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, d
);
73 VERIFY( err
== ios_base::goodbit
);
78 err
= ios_base::goodbit
;
79 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, d
);
80 VERIFY( err
== ios_base::goodbit
);
85 err
= ios_base::goodbit
;
86 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, l
);
87 VERIFY( err
== ios_base::goodbit
);
91 err
= ios_base::goodbit
;
92 end
= ng2
.get(iss2
.rdbuf(), 0, iss2
, err
, d
);
93 VERIFY( err
== ios_base::eofbit
);
98 err
= ios_base::goodbit
;
99 end
= ng2
.get(iss2
.rdbuf(), 0, iss2
, err
, l
);
100 VERIFY( err
== ios_base::eofbit
);