1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // XFAIL: apple-darwin
11
12 // REQUIRES: locale.fr_FR.UTF-8
13
14 // <locale>
15
16 // class money_get<charT, InputIterator>
17
18 // iter_type get(iter_type b, iter_type e, bool intl, ios_base& iob,
19 // ios_base::iostate& err, long double& v) const;
20
21 #include <locale>
22 #include <ios>
23 #include <streambuf>
24 #include <cassert>
25 #include "test_iterators.h"
26
27 #include "platform_support.h" // locale name macros
28
29 typedef std::money_get<char, input_iterator<const char*> > Fn;
30
31 class my_facet
32 : public Fn
33 {
34 public:
my_facet(std::size_t refs=0)35 explicit my_facet(std::size_t refs = 0)
36 : Fn(refs) {}
37 };
38
39 typedef std::money_get<wchar_t, input_iterator<const wchar_t*> > Fw;
40
41 class my_facetw
42 : public Fw
43 {
44 public:
my_facetw(std::size_t refs=0)45 explicit my_facetw(std::size_t refs = 0)
46 : Fw(refs) {}
47 };
48
main()49 int main()
50 {
51 std::ios ios(0);
52 std::string loc_name(LOCALE_fr_FR_UTF_8);
53 ios.imbue(std::locale(ios.getloc(),
54 new std::moneypunct_byname<char, false>(loc_name)));
55 ios.imbue(std::locale(ios.getloc(),
56 new std::moneypunct_byname<char, true>(loc_name)));
57 ios.imbue(std::locale(ios.getloc(),
58 new std::moneypunct_byname<wchar_t, false>(loc_name)));
59 ios.imbue(std::locale(ios.getloc(),
60 new std::moneypunct_byname<wchar_t, true>(loc_name)));
61 {
62 const my_facet f(1);
63 // char, national
64 { // zero
65 std::string v = "0,00";
66 typedef input_iterator<const char*> I;
67 long double ex;
68 std::ios_base::iostate err = std::ios_base::goodbit;
69 I iter = f.get(I(v.data()), I(v.data() + v.size()),
70 false, ios, err, ex);
71 assert(iter.base() == v.data() + v.size());
72 assert(err == std::ios_base::eofbit);
73 assert(ex == 0);
74 }
75 { // negative one
76 std::string v = "-0,01";
77 typedef input_iterator<const char*> I;
78 long double ex;
79 std::ios_base::iostate err = std::ios_base::goodbit;
80 I iter = f.get(I(v.data()), I(v.data() + v.size()),
81 false, ios, err, ex);
82 assert(iter.base() == v.data() + v.size());
83 assert(err == std::ios_base::eofbit);
84 assert(ex == -1);
85 }
86 { // positive
87 std::string v = "1 234 567,89 ";
88 typedef input_iterator<const char*> I;
89 long double ex;
90 std::ios_base::iostate err = std::ios_base::goodbit;
91 I iter = f.get(I(v.data()), I(v.data() + v.size()),
92 false, ios, err, ex);
93 assert(iter.base() == v.data() + v.size());
94 assert(err == std::ios_base::eofbit);
95 assert(ex == 123456789);
96 }
97 { // negative
98 std::string v = "-1 234 567,89";
99 typedef input_iterator<const char*> I;
100 long double ex;
101 std::ios_base::iostate err = std::ios_base::goodbit;
102 I iter = f.get(I(v.data()), I(v.data() + v.size()),
103 false, ios, err, ex);
104 assert(iter.base() == v.data() + v.size());
105 assert(err == std::ios_base::eofbit);
106 assert(ex == -123456789);
107 }
108 { // negative
109 std::string v = "-1234567,89";
110 typedef input_iterator<const char*> I;
111 long double ex;
112 std::ios_base::iostate err = std::ios_base::goodbit;
113 I iter = f.get(I(v.data()), I(v.data() + v.size()),
114 false, ios, err, ex);
115 assert(iter.base() == v.data() + v.size());
116 assert(err == std::ios_base::eofbit);
117 assert(ex == -123456789);
118 }
119 { // zero, showbase
120 std::string v = "0,00 \u20ac"; // €
121 showbase(ios);
122 typedef input_iterator<const char*> I;
123 long double ex;
124 std::ios_base::iostate err = std::ios_base::goodbit;
125 I iter = f.get(I(v.data()), I(v.data() + v.size()),
126 false, ios, err, ex);
127 assert(iter.base() == v.data() + v.size());
128 assert(err == std::ios_base::eofbit);
129 assert(ex == 0);
130 }
131 { // zero, showbase
132 std::string v = "0,00 \u20ac"; // €
133 showbase(ios);
134 typedef input_iterator<const char*> I;
135 long double ex;
136 std::ios_base::iostate err = std::ios_base::goodbit;
137 I iter = f.get(I(v.data()), I(v.data() + v.size()),
138 false, ios, err, ex);
139 assert(iter.base() == v.data() + v.size());
140 assert(err == std::ios_base::eofbit);
141 assert(ex == 0);
142 }
143 { // negative one, showbase
144 std::string v = "-0,01 \u20ac";
145 typedef input_iterator<const char*> I;
146 long double ex;
147 std::ios_base::iostate err = std::ios_base::goodbit;
148 I iter = f.get(I(v.data()), I(v.data() + v.size()),
149 false, ios, err, ex);
150 assert(iter.base() == v.data() + v.size());
151 assert(err == std::ios_base::eofbit);
152 assert(ex == -1);
153 }
154 { // negative one, showbase
155 std::string v = "-0,01 \u20ac";
156 showbase(ios);
157 typedef input_iterator<const char*> I;
158 long double ex;
159 std::ios_base::iostate err = std::ios_base::goodbit;
160 I iter = f.get(I(v.data()), I(v.data() + v.size()),
161 false, ios, err, ex);
162 assert(iter.base() == v.data() + v.size());
163 assert(err == std::ios_base::eofbit);
164 assert(ex == -1);
165 }
166 { // positive, showbase
167 std::string v = "1 234 567,89 \u20ac";
168 typedef input_iterator<const char*> I;
169 long double ex;
170 std::ios_base::iostate err = std::ios_base::goodbit;
171 I iter = f.get(I(v.data()), I(v.data() + v.size()),
172 false, ios, err, ex);
173 assert(iter.base() == v.data() + v.size());
174 assert(err == std::ios_base::eofbit);
175 assert(ex == 123456789);
176 }
177 { // positive, showbase
178 std::string v = "1 234 567,89 \u20ac";
179 showbase(ios);
180 typedef input_iterator<const char*> I;
181 long double ex;
182 std::ios_base::iostate err = std::ios_base::goodbit;
183 I iter = f.get(I(v.data()), I(v.data() + v.size()),
184 false, ios, err, ex);
185 assert(iter.base() == v.data() + v.size());
186 assert(err == std::ios_base::eofbit);
187 assert(ex == 123456789);
188 noshowbase(ios);
189 }
190 { // negative, showbase
191 std::string v = "-1 234 567,89 \u20ac";
192 showbase(ios);
193 typedef input_iterator<const char*> I;
194 long double ex;
195 std::ios_base::iostate err = std::ios_base::goodbit;
196 I iter = f.get(I(v.data()), I(v.data() + v.size()),
197 false, ios, err, ex);
198 assert(iter.base() == v.data() + v.size());
199 assert(err == std::ios_base::eofbit);
200 assert(ex == -123456789);
201 noshowbase(ios);
202 }
203 { // negative, showbase
204 std::string v = "1 234 567,89 EUR -";
205 showbase(ios);
206 typedef input_iterator<const char*> I;
207 long double ex;
208 std::ios_base::iostate err = std::ios_base::goodbit;
209 I iter = f.get(I(v.data()), I(v.data() + v.size()),
210 false, ios, err, ex);
211 assert(iter.base() == v.data() + 13);
212 assert(err == std::ios_base::failbit);
213 noshowbase(ios);
214 }
215 { // negative, showbase
216 std::string v = "1 234 567,89 EUR -";
217 typedef input_iterator<const char*> I;
218 long double ex;
219 std::ios_base::iostate err = std::ios_base::goodbit;
220 I iter = f.get(I(v.data()), I(v.data() + v.size()),
221 false, ios, err, ex);
222 assert(iter.base() == v.data() + 13);
223 assert(err == std::ios_base::goodbit);
224 assert(ex == 123456789);
225 }
226 noshowbase(ios);
227 }
228 {
229 const my_facet f(1);
230 // char, international
231 { // zero
232 std::string v = "0,00";
233 typedef input_iterator<const char*> I;
234 long double ex;
235 std::ios_base::iostate err = std::ios_base::goodbit;
236 I iter = f.get(I(v.data()), I(v.data() + v.size()),
237 true, ios, err, ex);
238 assert(iter.base() == v.data() + v.size());
239 assert(err == std::ios_base::eofbit);
240 assert(ex == 0);
241 }
242 { // negative one
243 std::string v = "-0,01";
244 typedef input_iterator<const char*> I;
245 long double ex;
246 std::ios_base::iostate err = std::ios_base::goodbit;
247 I iter = f.get(I(v.data()), I(v.data() + v.size()),
248 true, ios, err, ex);
249 assert(iter.base() == v.data() + v.size());
250 assert(err == std::ios_base::eofbit);
251 assert(ex == -1);
252 }
253 { // positive
254 std::string v = "1 234 567,89 ";
255 typedef input_iterator<const char*> I;
256 long double ex;
257 std::ios_base::iostate err = std::ios_base::goodbit;
258 I iter = f.get(I(v.data()), I(v.data() + v.size()),
259 true, ios, err, ex);
260 assert(iter.base() == v.data() + v.size());
261 assert(err == std::ios_base::eofbit);
262 assert(ex == 123456789);
263 }
264 { // negative
265 std::string v = "-1 234 567,89";
266 typedef input_iterator<const char*> I;
267 long double ex;
268 std::ios_base::iostate err = std::ios_base::goodbit;
269 I iter = f.get(I(v.data()), I(v.data() + v.size()),
270 true, ios, err, ex);
271 assert(iter.base() == v.data() + v.size());
272 assert(err == std::ios_base::eofbit);
273 assert(ex == -123456789);
274 }
275 { // negative
276 std::string v = "-1234567,89";
277 typedef input_iterator<const char*> I;
278 long double ex;
279 std::ios_base::iostate err = std::ios_base::goodbit;
280 I iter = f.get(I(v.data()), I(v.data() + v.size()),
281 true, ios, err, ex);
282 assert(iter.base() == v.data() + v.size());
283 assert(err == std::ios_base::eofbit);
284 assert(ex == -123456789);
285 }
286 { // zero, showbase
287 std::string v = "0,00 EUR";
288 showbase(ios);
289 typedef input_iterator<const char*> I;
290 long double ex;
291 std::ios_base::iostate err = std::ios_base::goodbit;
292 I iter = f.get(I(v.data()), I(v.data() + v.size()),
293 true, ios, err, ex);
294 assert(iter.base() == v.data() + v.size());
295 assert(err == std::ios_base::eofbit);
296 assert(ex == 0);
297 }
298 { // zero, showbase
299 std::string v = "0,00 EUR";
300 showbase(ios);
301 typedef input_iterator<const char*> I;
302 long double ex;
303 std::ios_base::iostate err = std::ios_base::goodbit;
304 I iter = f.get(I(v.data()), I(v.data() + v.size()),
305 true, ios, err, ex);
306 assert(iter.base() == v.data() + v.size());
307 assert(err == std::ios_base::eofbit);
308 assert(ex == 0);
309 }
310 { // negative one, showbase
311 std::string v = "-0,01 EUR";
312 typedef input_iterator<const char*> I;
313 long double ex;
314 std::ios_base::iostate err = std::ios_base::goodbit;
315 I iter = f.get(I(v.data()), I(v.data() + v.size()),
316 true, ios, err, ex);
317 assert(iter.base() == v.data() + v.size());
318 assert(err == std::ios_base::eofbit);
319 assert(ex == -1);
320 }
321 { // negative one, showbase
322 std::string v = "-0,01 EUR";
323 showbase(ios);
324 typedef input_iterator<const char*> I;
325 long double ex;
326 std::ios_base::iostate err = std::ios_base::goodbit;
327 I iter = f.get(I(v.data()), I(v.data() + v.size()),
328 true, ios, err, ex);
329 assert(iter.base() == v.data() + v.size());
330 assert(err == std::ios_base::eofbit);
331 assert(ex == -1);
332 }
333 { // positive, showbase
334 std::string v = "1 234 567,89 EUR";
335 typedef input_iterator<const char*> I;
336 long double ex;
337 std::ios_base::iostate err = std::ios_base::goodbit;
338 I iter = f.get(I(v.data()), I(v.data() + v.size()),
339 true, ios, err, ex);
340 assert(iter.base() == v.data() + v.size());
341 assert(err == std::ios_base::eofbit);
342 assert(ex == 123456789);
343 }
344 { // positive, showbase
345 std::string v = "1 234 567,89 EUR";
346 showbase(ios);
347 typedef input_iterator<const char*> I;
348 long double ex;
349 std::ios_base::iostate err = std::ios_base::goodbit;
350 I iter = f.get(I(v.data()), I(v.data() + v.size()),
351 true, ios, err, ex);
352 assert(iter.base() == v.data() + v.size());
353 assert(err == std::ios_base::eofbit);
354 assert(ex == 123456789);
355 noshowbase(ios);
356 }
357 { // negative, showbase
358 std::string v = "-1 234 567,89 EUR";
359 showbase(ios);
360 typedef input_iterator<const char*> I;
361 long double ex;
362 std::ios_base::iostate err = std::ios_base::goodbit;
363 I iter = f.get(I(v.data()), I(v.data() + v.size()),
364 true, ios, err, ex);
365 assert(iter.base() == v.data() + v.size());
366 assert(err == std::ios_base::eofbit);
367 assert(ex == -123456789);
368 noshowbase(ios);
369 }
370 { // negative, showbase
371 std::string v = "1 234 567,89 Eu-";
372 showbase(ios);
373 typedef input_iterator<const char*> I;
374 long double ex;
375 std::ios_base::iostate err = std::ios_base::goodbit;
376 I iter = f.get(I(v.data()), I(v.data() + v.size()),
377 true, ios, err, ex);
378 assert(iter.base() == v.data() + 14);
379 assert(err == std::ios_base::failbit);
380 noshowbase(ios);
381 }
382 { // negative, showbase
383 std::string v = "1 234 567,89 Eu-";
384 typedef input_iterator<const char*> I;
385 long double ex;
386 std::ios_base::iostate err = std::ios_base::goodbit;
387 I iter = f.get(I(v.data()), I(v.data() + v.size()),
388 true, ios, err, ex);
389 assert(iter.base() == v.data() + 13);
390 assert(err == std::ios_base::goodbit);
391 assert(ex == 123456789);
392 }
393 }
394 {
395 const my_facetw f(1);
396 // wchar_t, national
397 { // zero
398 std::wstring v = L"0,00";
399 typedef input_iterator<const wchar_t*> I;
400 long double ex;
401 std::ios_base::iostate err = std::ios_base::goodbit;
402 I iter = f.get(I(v.data()), I(v.data() + v.size()),
403 false, ios, err, ex);
404 assert(iter.base() == v.data() + v.size());
405 assert(err == std::ios_base::eofbit);
406 assert(ex == 0);
407 }
408 { // negative one
409 std::wstring v = L"-0,01";
410 typedef input_iterator<const wchar_t*> I;
411 long double ex;
412 std::ios_base::iostate err = std::ios_base::goodbit;
413 I iter = f.get(I(v.data()), I(v.data() + v.size()),
414 false, ios, err, ex);
415 assert(iter.base() == v.data() + v.size());
416 assert(err == std::ios_base::eofbit);
417 assert(ex == -1);
418 }
419 { // positive
420 std::wstring v = L"1 234 567,89 ";
421 typedef input_iterator<const wchar_t*> I;
422 long double ex;
423 std::ios_base::iostate err = std::ios_base::goodbit;
424 I iter = f.get(I(v.data()), I(v.data() + v.size()),
425 false, ios, err, ex);
426 assert(iter.base() == v.data() + v.size());
427 assert(err == std::ios_base::eofbit);
428 assert(ex == 123456789);
429 }
430 { // negative
431 std::wstring v = L"-1 234 567,89";
432 typedef input_iterator<const wchar_t*> I;
433 long double ex;
434 std::ios_base::iostate err = std::ios_base::goodbit;
435 I iter = f.get(I(v.data()), I(v.data() + v.size()),
436 false, ios, err, ex);
437 assert(iter.base() == v.data() + v.size());
438 assert(err == std::ios_base::eofbit);
439 assert(ex == -123456789);
440 }
441 { // negative
442 std::wstring v = L"-1234567,89";
443 typedef input_iterator<const wchar_t*> I;
444 long double ex;
445 std::ios_base::iostate err = std::ios_base::goodbit;
446 I iter = f.get(I(v.data()), I(v.data() + v.size()),
447 false, ios, err, ex);
448 assert(iter.base() == v.data() + v.size());
449 assert(err == std::ios_base::eofbit);
450 assert(ex == -123456789);
451 }
452 { // zero, showbase
453 std::wstring v = L"0,00 \u20ac";
454 showbase(ios);
455 typedef input_iterator<const wchar_t*> I;
456 long double ex;
457 std::ios_base::iostate err = std::ios_base::goodbit;
458 I iter = f.get(I(v.data()), I(v.data() + v.size()),
459 false, ios, err, ex);
460 assert(iter.base() == v.data() + v.size());
461 assert(err == std::ios_base::eofbit);
462 assert(ex == 0);
463 }
464 { // zero, showbase
465 std::wstring v = L"0,00 \u20ac";
466 showbase(ios);
467 typedef input_iterator<const wchar_t*> I;
468 long double ex;
469 std::ios_base::iostate err = std::ios_base::goodbit;
470 I iter = f.get(I(v.data()), I(v.data() + v.size()),
471 false, ios, err, ex);
472 assert(iter.base() == v.data() + v.size());
473 assert(err == std::ios_base::eofbit);
474 assert(ex == 0);
475 }
476 { // negative one, showbase
477 std::wstring v = L"-0,01 \u20ac";
478 typedef input_iterator<const wchar_t*> I;
479 long double ex;
480 std::ios_base::iostate err = std::ios_base::goodbit;
481 I iter = f.get(I(v.data()), I(v.data() + v.size()),
482 false, ios, err, ex);
483 assert(iter.base() == v.data() + v.size());
484 assert(err == std::ios_base::eofbit);
485 assert(ex == -1);
486 }
487 { // negative one, showbase
488 std::wstring v = L"-0,01 \u20ac";
489 showbase(ios);
490 typedef input_iterator<const wchar_t*> I;
491 long double ex;
492 std::ios_base::iostate err = std::ios_base::goodbit;
493 I iter = f.get(I(v.data()), I(v.data() + v.size()),
494 false, ios, err, ex);
495 assert(iter.base() == v.data() + v.size());
496 assert(err == std::ios_base::eofbit);
497 assert(ex == -1);
498 }
499 { // positive, showbase
500 std::wstring v = L"1 234 567,89 \u20ac";
501 typedef input_iterator<const wchar_t*> I;
502 long double ex;
503 std::ios_base::iostate err = std::ios_base::goodbit;
504 I iter = f.get(I(v.data()), I(v.data() + v.size()),
505 false, ios, err, ex);
506 assert(iter.base() == v.data() + v.size());
507 assert(err == std::ios_base::eofbit);
508 assert(ex == 123456789);
509 }
510 { // positive, showbase
511 std::wstring v = L"1 234 567,89 \u20ac";
512 showbase(ios);
513 typedef input_iterator<const wchar_t*> I;
514 long double ex;
515 std::ios_base::iostate err = std::ios_base::goodbit;
516 I iter = f.get(I(v.data()), I(v.data() + v.size()),
517 false, ios, err, ex);
518 assert(iter.base() == v.data() + v.size());
519 assert(err == std::ios_base::eofbit);
520 assert(ex == 123456789);
521 noshowbase(ios);
522 }
523 { // negative, showbase
524 std::wstring v = L"-1 234 567,89 \u20ac";
525 showbase(ios);
526 typedef input_iterator<const wchar_t*> I;
527 long double ex;
528 std::ios_base::iostate err = std::ios_base::goodbit;
529 I iter = f.get(I(v.data()), I(v.data() + v.size()),
530 false, ios, err, ex);
531 assert(iter.base() == v.data() + v.size());
532 assert(err == std::ios_base::eofbit);
533 assert(ex == -123456789);
534 noshowbase(ios);
535 }
536 { // negative, showbase
537 std::wstring v = L"1 234 567,89 EUR -";
538 showbase(ios);
539 typedef input_iterator<const wchar_t*> I;
540 long double ex;
541 std::ios_base::iostate err = std::ios_base::goodbit;
542 I iter = f.get(I(v.data()), I(v.data() + v.size()),
543 false, ios, err, ex);
544 assert(iter.base() == v.data() + 13);
545 assert(err == std::ios_base::failbit);
546 noshowbase(ios);
547 }
548 { // negative, showbase
549 std::wstring v = L"1 234 567,89 EUR -";
550 typedef input_iterator<const wchar_t*> I;
551 long double ex;
552 std::ios_base::iostate err = std::ios_base::goodbit;
553 I iter = f.get(I(v.data()), I(v.data() + v.size()),
554 false, ios, err, ex);
555 assert(iter.base() == v.data() + 13);
556 assert(err == std::ios_base::goodbit);
557 assert(ex == 123456789);
558 }
559 }
560 {
561 const my_facetw f(1);
562 // wchar_t, international
563 { // zero
564 std::wstring v = L"0,00";
565 typedef input_iterator<const wchar_t*> I;
566 long double ex;
567 std::ios_base::iostate err = std::ios_base::goodbit;
568 I iter = f.get(I(v.data()), I(v.data() + v.size()),
569 true, ios, err, ex);
570 assert(iter.base() == v.data() + v.size());
571 assert(err == std::ios_base::eofbit);
572 assert(ex == 0);
573 }
574 { // negative one
575 std::wstring v = L"-0,01";
576 typedef input_iterator<const wchar_t*> I;
577 long double ex;
578 std::ios_base::iostate err = std::ios_base::goodbit;
579 I iter = f.get(I(v.data()), I(v.data() + v.size()),
580 true, ios, err, ex);
581 assert(iter.base() == v.data() + v.size());
582 assert(err == std::ios_base::eofbit);
583 assert(ex == -1);
584 }
585 { // positive
586 std::wstring v = L"1 234 567,89 ";
587 typedef input_iterator<const wchar_t*> I;
588 long double ex;
589 std::ios_base::iostate err = std::ios_base::goodbit;
590 I iter = f.get(I(v.data()), I(v.data() + v.size()),
591 true, ios, err, ex);
592 assert(iter.base() == v.data() + v.size());
593 assert(err == std::ios_base::eofbit);
594 assert(ex == 123456789);
595 }
596 { // negative
597 std::wstring v = L"-1 234 567,89";
598 typedef input_iterator<const wchar_t*> I;
599 long double ex;
600 std::ios_base::iostate err = std::ios_base::goodbit;
601 I iter = f.get(I(v.data()), I(v.data() + v.size()),
602 true, ios, err, ex);
603 assert(iter.base() == v.data() + v.size());
604 assert(err == std::ios_base::eofbit);
605 assert(ex == -123456789);
606 }
607 { // negative
608 std::wstring v = L"-1234567,89";
609 typedef input_iterator<const wchar_t*> I;
610 long double ex;
611 std::ios_base::iostate err = std::ios_base::goodbit;
612 I iter = f.get(I(v.data()), I(v.data() + v.size()),
613 true, ios, err, ex);
614 assert(iter.base() == v.data() + v.size());
615 assert(err == std::ios_base::eofbit);
616 assert(ex == -123456789);
617 }
618 { // zero, showbase
619 std::wstring v = L"0,00 EUR";
620 showbase(ios);
621 typedef input_iterator<const wchar_t*> I;
622 long double ex;
623 std::ios_base::iostate err = std::ios_base::goodbit;
624 I iter = f.get(I(v.data()), I(v.data() + v.size()),
625 true, ios, err, ex);
626 assert(iter.base() == v.data() + v.size());
627 assert(err == std::ios_base::eofbit);
628 assert(ex == 0);
629 }
630 { // zero, showbase
631 std::wstring v = L"0,00 EUR";
632 showbase(ios);
633 typedef input_iterator<const wchar_t*> I;
634 long double ex;
635 std::ios_base::iostate err = std::ios_base::goodbit;
636 I iter = f.get(I(v.data()), I(v.data() + v.size()),
637 true, ios, err, ex);
638 assert(iter.base() == v.data() + v.size());
639 assert(err == std::ios_base::eofbit);
640 assert(ex == 0);
641 }
642 { // negative one, showbase
643 std::wstring v = L"-0,01 EUR";
644 typedef input_iterator<const wchar_t*> I;
645 long double ex;
646 std::ios_base::iostate err = std::ios_base::goodbit;
647 I iter = f.get(I(v.data()), I(v.data() + v.size()),
648 true, ios, err, ex);
649 assert(iter.base() == v.data() + v.size());
650 assert(err == std::ios_base::eofbit);
651 assert(ex == -1);
652 }
653 { // negative one, showbase
654 std::wstring v = L"-0,01 EUR";
655 showbase(ios);
656 typedef input_iterator<const wchar_t*> I;
657 long double ex;
658 std::ios_base::iostate err = std::ios_base::goodbit;
659 I iter = f.get(I(v.data()), I(v.data() + v.size()),
660 true, ios, err, ex);
661 assert(iter.base() == v.data() + v.size());
662 assert(err == std::ios_base::eofbit);
663 assert(ex == -1);
664 }
665 { // positive, showbase
666 std::wstring v = L"1 234 567,89 EUR";
667 typedef input_iterator<const wchar_t*> I;
668 long double ex;
669 std::ios_base::iostate err = std::ios_base::goodbit;
670 I iter = f.get(I(v.data()), I(v.data() + v.size()),
671 true, ios, err, ex);
672 assert(iter.base() == v.data() + v.size());
673 assert(err == std::ios_base::eofbit);
674 assert(ex == 123456789);
675 }
676 { // positive, showbase
677 std::wstring v = L"1 234 567,89 EUR";
678 showbase(ios);
679 typedef input_iterator<const wchar_t*> I;
680 long double ex;
681 std::ios_base::iostate err = std::ios_base::goodbit;
682 I iter = f.get(I(v.data()), I(v.data() + v.size()),
683 true, ios, err, ex);
684 assert(iter.base() == v.data() + v.size());
685 assert(err == std::ios_base::eofbit);
686 assert(ex == 123456789);
687 noshowbase(ios);
688 }
689 { // negative, showbase
690 std::wstring v = L"-1 234 567,89 EUR";
691 showbase(ios);
692 typedef input_iterator<const wchar_t*> I;
693 long double ex;
694 std::ios_base::iostate err = std::ios_base::goodbit;
695 I iter = f.get(I(v.data()), I(v.data() + v.size()),
696 true, ios, err, ex);
697 assert(iter.base() == v.data() + v.size());
698 assert(err == std::ios_base::eofbit);
699 assert(ex == -123456789);
700 noshowbase(ios);
701 }
702 { // negative, showbase
703 std::wstring v = L"1 234 567,89 Eu-";
704 showbase(ios);
705 typedef input_iterator<const wchar_t*> I;
706 long double ex;
707 std::ios_base::iostate err = std::ios_base::goodbit;
708 I iter = f.get(I(v.data()), I(v.data() + v.size()),
709 true, ios, err, ex);
710 assert(iter.base() == v.data() + 14);
711 assert(err == std::ios_base::failbit);
712 noshowbase(ios);
713 }
714 { // negative, showbase
715 std::wstring v = L"1 234 567,89 Eu-";
716 typedef input_iterator<const wchar_t*> I;
717 long double ex;
718 std::ios_base::iostate err = std::ios_base::goodbit;
719 I iter = f.get(I(v.data()), I(v.data() + v.size()),
720 true, ios, err, ex);
721 assert(iter.base() == v.data() + 13);
722 assert(err == std::ios_base::goodbit);
723 assert(ex == 123456789);
724 }
725 }
726 }
727