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