]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/22131.cc
1 // 2005-06-28 Paolo Carlini <pcarlini@suse.de>
3 // Copyright (C) 2005-2016 Free Software Foundation, Inc.
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 3, 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 COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
20 // 22.2.2.1.1 num_get members
24 #include <testsuite_hooks.h>
26 struct Punct
: std::numpunct
<wchar_t>
28 std::string
do_grouping() const { return "\1"; }
29 wchar_t do_thousands_sep() const { return L
'#'; }
36 typedef istreambuf_iterator
<wchar_t> iterator_type
;
38 wistringstream iss1
, iss2
;
39 iss1
.imbue(locale(iss1
.getloc(), new Punct
));
40 const num_get
<wchar_t>& ng1
= use_facet
<num_get
<wchar_t> >(iss1
.getloc());
42 ios_base::iostate err
= ios_base::goodbit
;
53 err
= ios_base::goodbit
;
54 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, l
);
55 VERIFY( err
== (ios_base::eofbit
| ios_base::failbit
) );
60 err
= ios_base::goodbit
;
61 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, l
);
62 VERIFY( err
== ios_base::failbit
);
63 VERIFY( *end
== L
'#' );
68 err
= ios_base::goodbit
;
69 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, l
);
70 VERIFY( err
== ios_base::eofbit
);
75 err
= ios_base::goodbit
;
76 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, d
);
77 VERIFY( err
== (ios_base::eofbit
| ios_base::failbit
) );
82 err
= ios_base::goodbit
;
83 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, d
);
84 VERIFY( err
== ios_base::failbit
);
85 VERIFY( *end
== L
'#' );
90 err
= ios_base::goodbit
;
91 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, d
);
92 VERIFY( err
== ios_base::eofbit
);
97 iss1
.unsetf(ios::basefield
);
98 err
= ios_base::goodbit
;
99 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, l
);
100 VERIFY( err
== ios_base::failbit
);
101 VERIFY( *end
== L
'#' );
106 err
= ios_base::goodbit
;
107 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, l
);
108 VERIFY( err
== ios_base::eofbit
);
113 err
= ios_base::goodbit
;
114 end
= ng1
.get(iss1
.rdbuf(), 0, iss1
, err
, l
);
115 VERIFY( err
== (ios_base::eofbit
| ios_base::failbit
) );