Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
22.locale.money.get.cpp
Go to the documentation of this file.
1
29#include <ios>
30#include <locale>
31
32#include <cstdio> // for sscanf()
33
34#include <rw_cmdopt.h> // for rw_enabled()
35#include <rw_driver.h> // for rw_assert(), rw_test(), ...
36#include <rw_char.h> // for rw_expand()
37#include <rw_valcmp.h> // for rw_ldblcmp()
38
39
40#ifndef _RWSTD_NO_LONG_DOUBLE
41# define LongDouble long double
42#else
43# define LongDouble double
44# define rw_ldblcmp rw_dblcmp
45#endif // _RWSTD_NO_LONG_DOUBLE
46
47
49// set to non-zero value when the basic_string overloads
50// of moneY-put::put() shouldn't be exercised
51static int no_basic_string;
52
53
55// replacement ctype facet
56
57template <class charT>
58struct Ctype: std::ctype<charT>
59{
60 typedef std::ctype<charT> Base;
61
62 typedef typename Base::char_type char_type;
63
64 static int n_widen_;
65
66 Ctype (): Base (0, 0, 1) { }
67
68 virtual char_type do_widen (char c) const {
69 ++n_widen_;
70
71 switch (c) {
72 case '0': c = '9'; break;
73 case '1': c = '8'; break;
74 case '2': c = '7'; break;
75 case '3': c = '6'; break;
76 case '4': c = '5'; break;
77 case '5': c = '4'; break;
78 case '6': c = '3'; break;
79 case '7': c = '2'; break;
80 case '8': c = '1'; break;
81 case '9': c = '0'; break;
82 default: break;
83 }
84
85 return char_type (c);
86 }
87
88 virtual const char_type*
89 do_widen (const char *lo, const char *hi, char_type *dst) const {
90 return Base::do_widen (lo, hi, dst);
91 }
92};
93
94template <class charT>
96
97int foo ()
98{
99 static int i;
100
101 return ++i;
102}
103
104
106template <class charT>
108{
111 static const char *grouping_ [2];
112 static const charT *curr_symbol_ [2];
113 static const charT *positive_sign_ [2];
114 static const charT *negative_sign_ [2];
115 static std::money_base::pattern format_ [2][2];
116 static int frac_digits_ [2];
117};
118
119
120template <class charT>
121const char*
122PunctData<charT>::grouping_ [2] = { "", "" };
123
124template <class charT>
125charT
126PunctData<charT>::decimal_point_ [2] = { '.', '.' };
127
128template <class charT>
129charT
130PunctData<charT>::thousands_sep_ [2] = { ',', ',' };
131
132template <class charT>
133const charT*
135
136template <class charT>
137const charT*
139
140template <class charT>
141const charT*
143
144template <class charT>
145std::money_base::pattern PunctData<charT>::format_ [2][2] = {
146 { // local
147 { { // positive
148 std::money_base::symbol, std::money_base::sign,
149 std::money_base::none, std::money_base::value
150 } },
151 { { // negative
152 std::money_base::symbol, std::money_base::sign,
153 std::money_base::none, std::money_base::value
154 } }
155 },
156
157 { // international
158 { { // positive
159 std::money_base::symbol, std::money_base::sign,
160 std::money_base::none, std::money_base::value
161 } },
162 { { // negative
163 std::money_base::symbol, std::money_base::sign,
164 std::money_base::none, std::money_base::value
165 } }
166 }
167};
168
169template <class charT>
171
172
173template <class charT, bool Intl>
174struct Punct: std::moneypunct<charT, Intl>, PunctData<charT>
175{
176 typedef std::moneypunct<charT, Intl> Base;
177 typedef typename Base::char_type char_type;
178 typedef typename Base::string_type string_type;
179
180 static int n_thousands_sep_; // number of calls to do_thousands_sep()
181
182 Punct (std::size_t ref): Base (ref) { }
183
185 return this->decimal_point_ [Intl];
186 }
187
188 int do_frac_digits () const {
189 return this->frac_digits_ [Intl];
190 }
191
192 virtual string_type do_curr_symbol () const {
193 foo ();
194 return this->curr_symbol_ [Intl] ?
195 this->curr_symbol_ [Intl] : string_type ();
196 }
197
198 virtual std::string do_grouping () const {
199 return this->grouping_ [Intl] ? this->grouping_ [Intl] : "";
200 }
201
202 virtual char_type do_thousands_sep () const {
204 return this->thousands_sep_ [Intl];
205 }
206
207 virtual string_type do_positive_sign () const {
208 return this->positive_sign_ [Intl] ?
209 this->positive_sign_ [Intl] : string_type ();
210 }
211
212 virtual string_type do_negative_sign () const {
213 return this->negative_sign_ [Intl] ?
214 this->negative_sign_ [Intl] : string_type ();
215 }
216
217 virtual std::money_base::pattern do_pos_format () const {
218 return this->format_ [Intl][0];
219 }
220
221 virtual std::money_base::pattern do_neg_format () const {
222 return this->format_ [Intl][1];
223 }
224};
225
226template <class charT, bool Intl>
228
229
230
232template <class charT>
233struct Ios: std::basic_ios<charT>
234{
235 Ios () { this->init (0); }
236};
237
238
239template <class charT>
240struct MoneyGet: std::money_get<charT, const charT*> { };
241
242
244std::money_base::pattern
245set_pattern (const char *format)
246{
247 std::money_base::pattern pat;
248
249 for (unsigned i = 0; i != sizeof pat.field / sizeof *pat.field; ++i) {
250 switch (format [i]) {
251 case '\0': case '@': pat.field [i] = std::money_base::none; break;
252 case '\1': case ' ': pat.field [i] = std::money_base::space; break;
253 case '\2': case '$': pat.field [i] = std::money_base::symbol; break;
254 case '\3': case '-': pat.field [i] = std::money_base::sign; break;
255 case '\4': case '1': pat.field [i] = std::money_base::value; break;
256 default:
257 _RWSTD_ASSERT (!!"bad format specifier");
258 }
259 }
260
261 return pat;
262}
263
264
265template <class charT>
266void do_test (bool intl, // international?
267 charT which, // which overload to exercise
268 const char *cname, // the name of the charT type
269 const char *tname, // the name of the floating point type
270 int lineno, // line number
271 LongDouble val, // the expected extracted value
272 const char *str, // the sequence to extract from
273 int consumed = -1, // expected number extractions
274 int flags = 0, // initial ios flags
275 int err_expect = -1, // expected final state
276 int frac_digits = 0, // fractional digits
277 const char *fmat = 0, // money_base::pattern
278 const char *cursym = 0, // currency symbol
279 const char *grouping = "") // grouping string
280{
281 if (!rw_enabled (lineno)) {
282 rw_note (0, __FILE__, __LINE__, "test on line %d disabled", lineno);
283 return;
284 }
285
286 if (!fmat) {
287 // if fmat isn't set, use the default pattern
288 static const std::money_base::pattern pat = { {
289 std::money_base::symbol, std::money_base::sign,
290 std::money_base::none, std::money_base::value
291 } };
292
293 fmat = pat.field;
294 }
295 else
296 fmat = set_pattern (fmat).field;
297
298 // local format? (the opposite of interantional)
299 const bool locl = !intl;
300
301 // take care to initialize Punct static data before installing
302 // the facet in case locale or the base facet calls the overridden
303 // virtuals early to cache the results
304 PunctData<charT>::format_ [intl][1].field [0] = fmat [0];
305 PunctData<charT>::format_ [intl][1].field [1] = fmat [1];
306 PunctData<charT>::format_ [intl][1].field [2] = fmat [2];
307 PunctData<charT>::format_ [intl][1].field [3] = fmat [3];
308
309 PunctData<charT>::format_ [locl][1].field [0] = fmat [3];
310 PunctData<charT>::format_ [locl][1].field [1] = fmat [2];
311 PunctData<charT>::format_ [locl][1].field [2] = fmat [1];
312 PunctData<charT>::format_ [locl][1].field [3] = fmat [0];
313
314 // zero out positive format (not used by money_get)
315 PunctData<charT>::format_ [intl][0] = std::money_base::pattern ();
316 PunctData<charT>::format_ [locl][0] = std::money_base::pattern ();
317
318 // expand (widen) currency symbol
319 PunctData<charT>::curr_symbol_ [intl] = rw_expand ((charT*)0, cursym);
321
322 PunctData<charT>::grouping_ [intl] = grouping;
324
325 PunctData<charT>::frac_digits_ [intl] = frac_digits;
326 PunctData<charT>::frac_digits_ [locl] = frac_digits + 1;
327
328 Ios<charT> io;
330
331 // create distinct punctuation facets for each iteration to make sure
332 // any data cached in between successive calls to the facet's public
333 // member functions are flushed
334 if (intl) {
335 const std::moneypunct<charT, true> *pf = new Punct<charT, true>(0);
336 io.imbue (std::locale (io.getloc (), pf));
337 }
338 else {
339 const std::moneypunct<charT, false> *pf = new Punct<charT, false>(0);
340 io.imbue (std::locale (io.getloc (), pf));
341 }
342
343 io.flags (std::ios_base::fmtflags (flags));
344
345 // expand (widen) input sequence
346 const charT* const next = rw_expand ((charT*)0, str);
347
348 std::ios_base::iostate err = std::ios_base::goodbit;
349
350 const charT *last;
351
352 if (0 == which) { // exercise get (..., long double)
353
354 last = next + std::char_traits<charT>::length (next);
355
356 LongDouble x = 0;
357
358 last = mg.get (next, last, intl, io, err, x);
359
360 if (-1 == err_expect)
361 err_expect = err;
362
363 const int success =
364 !((-1 != consumed && last - next != consumed) || err != err_expect);
365
366 rw_assert (success, __FILE__, lineno,
367 "money_get<%s>::get (%{*Ac}, ..., %b, ..., %s&), "
368 "ate %d, expected %d, frac_digits = %d, "
369 "flags = %{If}, grouping = %#s, pattern = %{LM}, "
370 "state = %{Is}, expected %{Is}",
371 cname, int (sizeof *next), next, intl, tname,
372 last - next, consumed, frac_digits,
373 flags, grouping, fmat,
374 err, err_expect);
375
376 rw_assert (2 > rw_ldblcmp (x, val), __FILE__, lineno,
377 "money_get<%s>::get (%{*Ac}, ..., %b, ..., %s&), "
378 "got %Lg, expected %Lg, frac_digits = %d, "
379 "flags = %{If}s, grouping = %#s, pattern = %{LM}, "
380 "state = %{Is}, expected %{Is}",
381 cname, int (sizeof *next), next, intl, tname,
382 x, val, frac_digits,
383 flags, grouping, fmat,
384 err, err_expect);
385 }
386 else { // exercise get (..., string_type)
387
388 static const charT initial[] = { '*', '*', '*', '\0' };
389 typename std::money_get<charT, const charT*>::string_type bs (initial);
390
391 last = next + std::char_traits<charT>::length (next);
392
393 last = mg.get (next, last, intl, io, err, bs);
394
395 int success =
396 !((-1 != consumed && last - next != consumed) || err != err_expect);
397
398 rw_assert (success, __FILE__, lineno,
399 "money_get<%s>::get (%{*Ac}, ..., %b, ..., "
400 "basic_string<%s>&), ate %d, expected %d, "
401 "frac_digits = %d, flags = %{If}, grouping = %#s"
402 ", format = %{LM}, state = %{Is}, expected %{Is}",
403 cname, int (sizeof *next), next, intl,
404 cname, last - next, consumed,
405 frac_digits, flags, grouping,
406 fmat, err, err_expect);
407
408 if (success) {
409
410 char narrow_buf [4096];
411 rw_narrow (narrow_buf, bs.c_str ());
412
413 LongDouble x = 0;
414
415 // prevent gcc warning: ANSI C does not support
416 // the `L' length modifier
417 const char fmt[] = "%" _RWSTD_LDBL_PRINTF_PREFIX "g";
418 int n = std::sscanf (narrow_buf, fmt, &x);
419
420 success =
421 !( ( err_expect & std::ios::failbit && !*grouping
422 && (1 == n || bs != initial))
423 || ( !(err_expect & std::ios::failbit)
424 && 1 < rw_ldblcmp (x, val)));
425
426 rw_assert (success, __FILE__, lineno,
427 "money_get<%s>::get (%{*Ac}, ..., %b, ..., "
428 "basic_string<%s>&), got %s, expected %Lg, "
429 "frac_digits = %d, flags = %{If}, grouping = %#s,"
430 " pattern = %{LM}, iostate = %{Is}, expected %{Is}",
431 cname, int (sizeof *next), next, intl,
432 cname, bs.c_str (), val,
433 frac_digits, flags, grouping,
434 fmat, err, err_expect);
435 }
436 }
437
438 delete[] PunctData<charT>::curr_symbol_ [intl];
439 delete[] next;
440}
441
442
444// for convenience
445#define boolalpha std::ios_base::boolalpha
446#define dec std::ios_base::dec
447#define fixed std::ios_base::fixed
448#define hex std::ios_base::hex
449#define internal std::ios_base::internal
450#define left std::ios_base::left
451#define oct std::ios_base::oct
452#define right std::ios_base::right
453#define scientific std::ios_base::scientific
454#define showbase std::ios_base::showbase
455#define showpoint std::ios_base::showpoint
456#define showpos std::ios_base::showpos
457#define skipws std::ios_base::skipws
458#define unitbuf std::ios_base::unitbuf
459#define uppercase std::ios_base::uppercase
460#define bin std::ios_base::bin
461#define adjustfield std::ios_base::adjustfield
462#define basefield std::ios_base::basefield
463#define floatfield std::ios_base::floatfield
464#define nolock std::ios_base::nolock
465#define nolockbuf std::ios_base::nolockbuf
466
467#define badbit std::ios_base::badbit
468#define eofbit std::ios_base::eofbit
469#define failbit std::ios_base::failbit
470#define goodbit std::ios_base::goodbit
471
472
473template <class charT>
474void test_get (charT opt, const char *cname, const char *tname, bool intl)
475{
476#define T intl, opt, cname, tname, __LINE__
477#define TEST do_test
478
479 const bool locl = !intl;
480
481 rw_info (0, 0, 0,
482 "money_get<%s, istreambuf_iterator<%s> >::get "
483 "(..., %s&) const", cname, cname, tname);
484
485 // 22.2.6.3, p3:
486 // The format of the numeric monetary value is a decimal number:
487 // value ::= units [ decimalpoint [ digits ]] | decimalpoint digits
488 // If frac_digits() returns a positive value, or
489 // value ::= units
490 // otherwise. The symbol decimalpoint indicates the character returned
491 // by decimal_point(). The other symbols are defined as follows:
492 // units ::= digits [ thousandssep units ] digits ::= adigit [ digits ]
493
500
501 // parsing zero, no curr_symbol or sign, default pattern, 0 frac_digits
502 TEST (T, 0.0, "0", 1, 0, eofbit);
503 TEST (T, 0.0, "0 ", 1, 0, goodbit);
504 TEST (T, 0.0, "00", 2, 0, eofbit);
505 TEST (T, 0.0, "000", 3, 0, eofbit);
506
507 // optional whitespace is consumed where none or space appears
508 TEST (T, 0.0, " 0", 2, 0, eofbit);
509 TEST (T, 0.0, " 0 ", 3, 0, goodbit);
510
511 // verify that decimal point isn't extracted (frac_digits == 0)
512 TEST (T, 0.0, "0.", 1, 0, goodbit);
513 TEST (T, 0.0, "0.0", 1, 0, goodbit);
514 TEST (T, 0.0, "0.00", 1, 0, goodbit);
515 TEST (T, 0.0, "00.0", 2, 0, goodbit);
516 TEST (T, 0.0, "000.0", 3, 0, goodbit);
517
518 // parsing zero, non-zero frac_digits
519 TEST (T, 0.0, "0.", 2, 0, eofbit, 1);
520 TEST (T, 0.0, "0. ", 2, 0, goodbit, 2);
521 TEST (T, 0.0, ".0", 2, 0, eofbit, 3);
522 TEST (T, 0.0, "0.0", 3, 0, eofbit, 4);
523 TEST (T, 0.0, "0.00", 4, 0, eofbit, 5);
524 TEST (T, 0.0, "00.0", 4, 0, eofbit, 6);
525 TEST (T, 0.0, "00.00", 5, 0, eofbit, 7);
526
527 // parsing zero, bad format
528 TEST (T, 0.0, "$0", 0, 0, failbit);
529 TEST (T, 0.0, "+0", 0, 0, failbit);
530 TEST (T, 0.0, "-0", 0, 0, failbit);
531 TEST (T, 0.0, ".0", 0, 0, failbit);
532 TEST (T, 0.0, ".1", 0, 0, failbit);
533 TEST (T, 0.0, ".", 0, 0, failbit);
534 TEST (T, 0.0, "", 0, 0, eofbit | failbit);
535
536 // parsing non-zero, no curr_symbol or sign, default pattern, 0 frac_digits
537 TEST (T, 1.0, "1", 1, 0, eofbit);
538 TEST (T, 2.0, "2", 1, 0, eofbit);
539 TEST (T, 3.0, "3", 1, 0, eofbit);
540 TEST (T, 4.0, "4", 1, 0, eofbit);
541 TEST (T, 5.0, "5.1", 1, 0, goodbit);
542 TEST (T, 6.0, "6.23", 1, 0, goodbit);
543 TEST (T, 73.0, "73.4", 2, 0, goodbit);
544 TEST (T, 845.0, "845.", 3, 0, goodbit);
545
546 // parsing non-zero, frac_digits == 1
547 TEST (T, 100.0, "10", 2, 0, eofbit, 1);
548 TEST (T, 90.0, "9", 1, 0, eofbit, 1);
549 TEST (T, 80.0, "8.", 2, 0, eofbit, 1);
550 TEST (T, 7.0, "0.7", 3, 0, eofbit, 1);
551 TEST (T, 6.0, ".6", 2, 0, eofbit, 1);
552 TEST (T, 0.0, ".05", 3, 0, eofbit, 1);
553
554 // parsing non-zero, frac_digits > 1
555 TEST (T, 4.0, ".04", 3, 0, eofbit, 2);
556 TEST (T, 32.0, ".32", 3, 0, eofbit, 2);
557 TEST (T, 210.0, "2.10", 4, 0, eofbit, 2);
558 TEST (T, 1098.0, "10.98", 5, 0, eofbit, 2);
559 TEST (T, 987.0, "09.876", 6, 0, eofbit, 2);
560 TEST (T, 9876.0, "98.765", 6, 0, eofbit, 2);
561 TEST (T, 87654.0, "876.5432", 8, 0, eofbit, 2);
562 TEST (T, 765432.0, "765.4321", 8, 0, eofbit, 3);
563 TEST (T, 6543210.0, "654.32109", 9, 0, eofbit, 4);
564 TEST (T, 54321098.0, "5432.1098", 9, 0, eofbit, 4);
565 TEST (T, 432109870.0, "43210.987", 9, 0, eofbit, 4);
566
569
570 // parsing with thousands_sep and/or grouping
571 TEST (T, 0.0, "0", 1, 0, eofbit, 0, 0, "", "\1");
572 TEST (T, 0.0, "0,0", 3, 0, eofbit, 0, 0, "", "\1");
573 TEST (T, 0.0, "0,", 1, 0, goodbit, 0, 0, "", "\0");
574 TEST (T, 0.0, "0,0,0", 5, 0, eofbit, 0, 0, "", "\1");
575 TEST (T, 1.0, "0,0,1", 5, 0, eofbit, 0, 0, "", "\1");
576 TEST (T, 2.0, "0,0,2.", 5, 0, goodbit, 0, 0, "", "\1");
577 TEST (T, 30.0, "0,0,3.", 6, 0, eofbit, 1, 0, "", "\1");
578 TEST (T, 4.0, "0,0.4", 5, 0, eofbit, 1, 0, "", "\1");
579 TEST (T, 5670.0, "5,67.0", 6, 0, eofbit, 1, 0, "", "\2");
580 TEST (T, 6789.0, "678.9", 5, 0, eofbit, 1, 0, "", "\3");
581 TEST (T, 789012.0, "7,890.12", 8, 0, eofbit, 2, 0, "", "\3");
582
583 // 22.2.6.1.2, p1: thousands_sep-arators are optional
584 TEST (T, 890123.0, "890.123", 7, 0, eofbit, 3, 0, "", "\1");
585 TEST (T, 901234.0, "901.234", 7, 0, eofbit, 3, 0, "", "\2");
586 TEST (T, 123450.0, "0123.45", 7, 0, eofbit, 3, 0, "", "\3");
587
588 // invalid use of thousands_sep with empty grouping
589 // the first thousands_sep terminates parsing in grouping is empty
590 TEST (T, 0.0, ",", 0, 0, failbit, 0, 0, "", "\0");
591 TEST (T, 0.0, ",0", 0, 0, failbit, 0, 0, "", "\0");
592
593 // invalid grouping
594 TEST (T, 1.0, ",1", 2, 0, eofbit | failbit, 0, 0, "", "\1");
595 TEST (T, 2.0, "2,", 2, 0, eofbit | failbit, 0, 0, "", "\1");
596 TEST (T, 3.0, ",3,", 3, 0, eofbit | failbit, 0, 0, "", "\1");
597 TEST (T, 4.0, ",,4", 3, 0, eofbit | failbit, 0, 0, "", "\1");
598 TEST (T, 5.0, "5,,", 3, 0, eofbit | failbit, 0, 0, "", "\1");
599 TEST (T, 6.0, ",6,,", 4, 0, eofbit | failbit, 0, 0, "", "\2");
600 TEST (T, 7.0, ",,7,", 4, 0, eofbit | failbit, 0, 0, "", "\2");
601 TEST (T, 8.0, "0,,8", 4, 0, eofbit | failbit, 0, 0, "", "\2");
602 TEST (T, 9.0, "0,0,9", 5, 0, eofbit | failbit, 0, 0, "", "\2");
603 TEST (T, 10.0, "0,10,", 5, 0, eofbit | failbit, 0, 0, "", "\2");
604
605
606 // default pattern: { symbol sign none value }, e.g., "$-1"
607
608 // parsing with a required curr_symbol, no sign, and default pattern
609 TEST (T, 0.0, "$0", 2, showbase, eofbit, 0, 0, "$");
610 TEST (T, 1.0, "$1", 2, showbase, eofbit, 0, 0, "$");
611 TEST (T, 2.0, "$ 2", 3, showbase, eofbit, 0, 0, "$");
612 TEST (T, 3.0, "$ 3", 4, showbase, eofbit, 0, 0, "$");
613 TEST (T, 456.0, "$456", 4, showbase, eofbit, 0, 0, "$");
614 TEST (T, 56.0, "$56$", 3, showbase, goodbit, 0, 0, "$");
615 TEST (T, 6.0, "$6$7", 2, showbase, goodbit, 0, 0, "$");
616 TEST (T, 7.0, "L7", 2, showbase, eofbit, 0, 0, "L");
617 TEST (T, 8.0, "DM 8", 5, showbase, eofbit, 0, 0, "DM");
618 TEST (T, 9.0, "USD9", 4, showbase, eofbit, 0, 0, "USD");
619 TEST (T, 10.0, "YEN 10", 6, showbase, eofbit, 0, 0, "YEN");
620 TEST (T, 11.0, "$CAN11$", 6, showbase, goodbit, 0, 0, "$CAN");
621 TEST (T, 121.0, "kr12.1", 6, showbase, eofbit, 1, 0, "kr");
622 TEST (T, 132.0, "FT13.21", 7, showbase, eofbit, 1, 0, "FT");
623
624 // invalid input with a required (showbase set) curr_symbol
625 TEST (T, 0.0, "FLU", 3, showbase, eofbit | failbit, 0, 0, "FLUX");
626 TEST (T, 0.0, "Fr. +1", 4, showbase, failbit, 0, 0, "Fr.");
627 TEST (T, 0.0, "Pts1", 3, showbase, failbit, 0, 0, "Pts.");
628 TEST (T, 0.0, " Kn1", 0, showbase, failbit, 0, 0, "Kn");
629 TEST (T, 0.0, "L.1", 2, showbase, failbit, 0, 0, "L. ");
630 TEST (T, 0.0, "1", 0, showbase, failbit, 0, 0, "TL");
631
632 // parsing with an optional (showbase clear) curr_symbol
633 TEST (T, 12.0, "12", 2, 0, eofbit, 0, 0, "mk");
634 TEST (T, 13.0, "din13", 5, 0, eofbit, 0, 0, "din");
635 TEST (T, 14.0, "Esc 14", 6, 0, eofbit, 0, 0, "Esc");
636
637 // parsing with a simple non-empty sign
638
639 static const charT plus[][2] = { { '+', '\0' }, { '\0' } };
640 static const charT minus[][2] = { { '-', '\0' }, { '\0' } };
641
646
647 TEST (T, 15.0, "+15", 3, 0, eofbit, 0, 0, "");
648 TEST (T, 16.0, "+ 16", 4, 0, eofbit, 0, 0, "");
649 TEST (T, 17.0, "+ 17.0", 5, 0, goodbit, 0, 0, "");
650 TEST (T, 18.0, "+ 18+", 5, 0, goodbit, 0, 0, "");
651 TEST (T, 19.0, "19+", 2, 0, goodbit, 0, 0, "");
652
653 TEST (T, -20.0, "-20", 3, 0, eofbit, 0, 0, "");
654 TEST (T, -21.0, "- 21", 4, 0, eofbit, 0, 0, "");
655 TEST (T, -22.0, "- 22.1", 5, 0, goodbit, 0, 0, "");
656 TEST (T, -23.0, "- 23-", 4, 0, goodbit, 0, 0, "");
657 TEST (T, 24.0, "24+", 2, 0, goodbit, 0, 0, "");
658 TEST (T, -25.0, "-25+", 3, 0, goodbit, 0, 0, "");
659 TEST (T, 26.0, "+26-", 3, 0, goodbit, 0, 0, "");
660
661 // invalid input
662 TEST (T, 0.0, "++1.23", 1, 0, failbit, 0, 0, "");
663 TEST (T, 0.0, "--2.34", 1, 0, failbit, 0, 0, "");
664 TEST (T, 0.0, "+-3.45", 1, 0, failbit, 0, 0, "");
665 TEST (T, 0.0, "-+4.56", 1, 0, failbit, 0, 0, "");
666 TEST (T, 0.0, "- +5.67", 2, 0, failbit, 0, 0, "");
667 TEST (T, 0.0, "+", 1, 0, eofbit | failbit, 0, 0, "");
668 TEST (T, 0.0, "-", 1, 0, eofbit | failbit, 0, 0, "");
669
670 // parsing with a multi-char non-empty sign
671
672 static const charT plus_plus[][3] = { { '+', '+', '\0' }, { '\0' } };
673 static const charT minus_minus[][3] = { { '-', '-', '\0' }, { '\0' } };
674
675 PunctData<charT>::positive_sign_ [intl] = plus_plus [0];
676 PunctData<charT>::negative_sign_ [intl] = minus_minus [0];
677 PunctData<charT>::positive_sign_ [locl] = plus_plus [1];
678 PunctData<charT>::negative_sign_ [locl] = minus_minus [1];
679
680 TEST (T, 27.0, "+27+", 4, 0, eofbit, 0, 0, "");
681 TEST (T, 28.0, "+ 28+", 6, 0, eofbit, 0, 0, "");
682 TEST (T, -29.0, "-2.99-", 6, 0, eofbit, 1, 0, "");
683 TEST (T, -30.0, "- 3.09-", 7, 0, eofbit, 1, 0, "");
684
685 // with a simple currency symbol
686 TEST (T, 31.0, "$+31+", 5, 0, eofbit, 0, 0, "$");
687 TEST (T, 32.0, "$+ 32+", 7, 0, eofbit, 0, 0, "$");
688 TEST (T, -33.0, "$-3.30-", 7, 0, eofbit, 1, 0, "$");
689 TEST (T, -34.0, "$- 3.41-", 8, 0, eofbit, 1, 0, "$");
690
691 // with a multi-char currency symbol
692 TEST (T, 35.0, "USD+35+", 7, 0, eofbit, 0, 0, "USD");
693 TEST (T, 36.0, "USD+ 36+", 9, 0, eofbit, 0, 0, "USD");
694 TEST (T, -37.0, "USD-3.70-", 9, 0, eofbit, 1, 0, "USD");
695 TEST (T, -38.0, "USD- 3.81-", 10, 0, eofbit, 1, 0, "USD");
696
697 // invalid input
698 TEST (T, 0.0, "+31 +", 3, 0, failbit, 0, 0, "");
699 TEST (T, 0.0, "+ 32 +", 5, 0, failbit, 0, 0, "");
700 TEST (T, 0.0, "-33.9 -", 3, 0, failbit, 0, 0, "");
701 TEST (T, 0.0, "- 3.49 -", 6, 0, failbit, 1, 0, "");
702 TEST (T, 0.0, "$+35 +", 4, 0, failbit, 0, 0, "$");
703 // the space below is read since the optional sign is considered missing
704 TEST (T, 0.0, "$ +36+", 2, 0, failbit, 0, 0, "$");
705 TEST (T, 0.0, "$+ 37 +", 6, 0, failbit, 0, 0, "$");
706 TEST (T, 0.0, "$-3.80 -", 3, 0, failbit, 0, 0, "$");
707 TEST (T, 0.0, "$- 3.91 -", 7, 0, failbit, 1, 0, "$");
708
709 static const charT plus_minus[][3] = { { '+', '-', '\0' }, { '\0' } };
710
711 PunctData<charT>::positive_sign_ [intl] = plus_plus [0];
712 PunctData<charT>::positive_sign_ [locl] = plus_plus [1];
713 PunctData<charT>::negative_sign_ [intl] = plus_minus [0];
714 PunctData<charT>::negative_sign_ [locl] = plus_minus [1];
715
716 // 22.2.6.1.2, p3: if the first character of positive
717 // and negative sign is the same, the result is positive
718 TEST (T, 40.0, "+40+", 4, 0, eofbit, 0, 0, "");
719 TEST (T, 41.0, "+41-", 4, 0, eofbit, 0, 0, "");
720 TEST (T, 42.0, "+42+ ", 4, 0, goodbit, 0, 0, "");
721 TEST (T, 43.0, "+43- ", 4, 0, goodbit, 0, 0, "");
722 TEST (T, 44.0, "+44 $+", 6, showbase, eofbit, 0, "-1@$", "$");
723 TEST (T, 45.0, "+45 $-", 6, showbase, eofbit, 0, "-1@$", "$");
724 TEST (T, 46.0, "+46$+ ", 5, showbase, goodbit, 0, "-1$@", "$");
725 TEST (T, 47.0, "+47$- ", 5, showbase, goodbit, 0, "-1$@", "$");
726
727 // none = 0, space = 1, symbol = 2, sign = 3, value = 4
728
729 // test various patterns
734
735 TEST (T, -100.0, "$-1", 3, showbase, eofbit, 2, "$-1@", "$");
736 TEST (T, -200.0, "$-2 ", 3, showbase, goodbit, 2, "$-1@", "$");
737 // where none appears in the pattern, whitespace is optional
738 TEST (T, -300.0, "-3$", 3, showbase, eofbit, 2, "-1@$", "$");
739 TEST (T, -400.0, "-4 $", 4, showbase, eofbit, 2, "-1@$", "$");
740 // where space appears in the pattern, a whitespace character is required
741 TEST (T, 0.0, "-5$", 2, showbase, failbit, 2, "-1 $", "$");
742 TEST (T, -600.0, "-6 $", 4, showbase, eofbit, 2, "-1 $", "$");
743 TEST (T, -700.0, "-7\t$", 4, showbase, eofbit, 2, "-1 $", "$");
744
745 TEST (T, 0.0, "-8$", 1, showbase, failbit, 2, "- 1$", "$");
746 TEST (T, -900.0, "-\n9$", 4, showbase, eofbit, 2, "- 1$", "$");
747 TEST (T, -1000.0, "- 10$", 5, showbase, eofbit, 2, "- 1$", "$");
748 // white space is required even at the beginning of input
749 // (if the optional sign or symbol is missing)
750 TEST (T, 0.0, "11$", 0, showbase, failbit, 2, "- 1$", "$");
751
752 TEST (T, -1200.0, "12$-", 4, showbase, eofbit, 2, "1@$-", "$");
753 TEST (T, -1300.0, "13 $-", 5, showbase, eofbit, 2, "1@$-", "$");
754 TEST (T, 0.0, "14$-", 2, showbase, failbit, 2, "1 $-", "$");
755 TEST (T, -1500.0, "15 $-", 5, showbase, eofbit, 2, "1 $-", "$");
756
757 const charT parens[][3] = { { '(', ')', '\0' }, { '\0' } };
758 PunctData<charT>::negative_sign_ [intl] = parens [0];
759 PunctData<charT>::negative_sign_ [locl] = parens [1];
760
761 // { sign, space, value, symbol }, with symbol required
762 TEST (T, -90.0, "( 9$)", 5, showbase, eofbit, 1, "- 1$", "$");
763 TEST (T, -80.0, "( 8SIT)", 7, showbase, eofbit, 1, "- 1$", "SIT");
764 TEST (T, -81.0, "( 8.1Fr)", 8, showbase, eofbit, 1, "- 1$", "Fr");
765 TEST (T, 70.0, " 7Ptas", 6, showbase, eofbit, 1, "- 1$", "Ptas");
766 TEST (T, 61.0, " 6.1Lek", 7, showbase, eofbit, 1, "- 1$", "Lek");
767
768 // { sign, value, none, symbol }
769 TEST (T, 101.0, "101 ", 3, 0, goodbit, 0, "-1@$", "");
770 // trailing space not extracted since currency symbol is optional
771 TEST (T, 102.0, "102 ", 3, 0, goodbit, 0, "-1@$", " ");
772 // all spaces extracted since currency symbol (last) is mandatory
773 // verify that the facet doesn't extract too many optional spaces
774 // leaving none for the final required currency symbol
775 TEST (T, 103.0, "103 ", 4, showbase, eofbit, 0, "-1@$", " ");
776
777 // 22.2.6.1.2, p3: [Example: If showbase is off, then for
778 // a negative sign value of "()" and a currency symbol of "L",
779 // in "(100 L)" the "L" is consumed; but if negative sign is "­",
780 // the "L" in "­100 L" is not consumed. ]
781 TEST (T, -104.0, "(104 L)", 7, 0, eofbit, 0, "-1@$", "L");
782 TEST (T, -105.0, "(105 L)", 7, showbase, eofbit, 0, "-1@$", "L");
783
788
789 // { sign, value, none, symbol }
790 // trailing optional curr_symbol or whitespace preceding it (regardless
791 // of whether the latter is required or optional) is not consumed)
792 TEST (T, -101.0, "-101 $", 4, 0, goodbit, 0, "-1@$", "$");
793 TEST (T, -102.0, "-102 $", 6, showbase, eofbit, 0, "-1@$", "$");
794
795 TEST (T, -103.0, "-103 $", 4, 0, goodbit, 0, "-1 $", "$");
796 TEST (T, -104.0, "-104 $", 6, showbase, eofbit, 0, "-1 $", "$");
797
798 // { sign, value, symbol, none }
799 TEST (T, -105.0, "-105 $", 4, 0, goodbit, 0, "-1$@", "$");
800 TEST (T, -106.0, "-106$ ", 5, showbase, goodbit, 0, "-1$@", "$");
801
802 // { value, none, sign, symbol }
803 // trailing whitespace may need to be extracted if characters may
804 // be needed to complete the pattern (e.g., sign or symbol)
805 TEST (T, 107.0, "107 $", 4, 0, goodbit, 0, "1@-$", "$");
806 // trailing optional curr_symbol is not consumed
807 TEST (T, -108.0, "108-$", 4, 0, goodbit, 0, "1@-$", "$");
808 // trailing required curr_symbol is consumed
809 TEST (T, -109.0, "109-$", 5, showbase, eofbit, 0, "1@-$", "$");
810
811 const charT minus_space[][3] = { { '-', ' ', '\0' }, { '\0' } };
812 PunctData<charT>::negative_sign_ [intl] = minus_space [0];
813 PunctData<charT>::negative_sign_ [locl] = minus_space [1];
814
815 // { sign, value, none, symbol }
816 // negative_sign is "- ", (note the single trailing space)
817 // verify that the extraction suceeds, i.e., that the money_base::none
818 // specifier that's last in the pattern doesn't confuse the facet into
819 // extracting all the optional whitespace, leaving none to complete
820 // the negative_sign
821 TEST (T, -109.1, "-109 ", 6, 0, eofbit, 0, "-1@$", "");
822
823 // verify that optional space after value and before currency
824 // symbol is treated correctly
825 PunctData<charT>::positive_sign_ [intl] = plus_plus [0];
829
830 // { sign, value, none, symbol }
831 TEST (T, 1090.0, "1090 $", 6, showbase, eofbit, 0, "-1@$", "$");
832 TEST (T, 1091.0, "1091 $", 6, showbase, eofbit, 0, "-1@$", "$");
833 TEST (T, +1092.0, "+1092 $+", 8, showbase, eofbit, 0, "-1@$", "$");
834
837 PunctData<charT>::negative_sign_ [intl] = parens [0];
839
840 TEST (T, 1093.0, "1093 $", 6, showbase, eofbit, 0, "-1@$", "$");
841 TEST (T, 1094.0, "1094 $", 6, showbase, eofbit, 0, "-1@$", "$");
842 TEST (T, -1095.0, "(1095 $)", 8, showbase, eofbit, 0, "-1@$", "$");
843
844 // verify a single-char sign with a multichar one (see bug #428)
847 PunctData<charT>::negative_sign_ [intl] = parens [0];
849
850 // { sign, value, none, symbol }
851 TEST (T, 1096.0, "1096 $", 6, showbase, eofbit, 0, "-1@$", "$");
852 TEST (T, 1097.0, "1097 $", 6, showbase, eofbit, 0, "-1@$", "$");
853 TEST (T, +1098.0, "+1098 $", 7, showbase, eofbit, 0, "-1@$", "$");
854 TEST (T, -1099.0, "(1099 $)", 8, showbase, eofbit, 0, "-1@$", "$");
855
860
861 // { value, none, symbol, sign }
862 // trailing whitespace is not extracted (even if required by the format)
863 // if it can be determined that no other characters can possibly complete
864 // the format (e.g., if both signs and symbol are empty or if signs are
865 // empty and symbol is optional)
866 TEST (T, 110.0, "110 $", 3, 0, goodbit, 0, "1@-$", "$");
867 TEST (T, 111.0, "111 $", 3, 0, goodbit, 0, "1 -$", "$");
868 TEST (T, 112.0, "112$", 4, showbase, eofbit, 0, "1@-$", "$");
869 TEST (T, 113.0, "113$", 4, showbase, eofbit, 0, "1@-$", "$");
870 TEST (T, 114.0, "114 $", 5, showbase, eofbit, 0, "1 -$", "$");
871
872 TEST (T, 115.0, "115 $", 3, 0, goodbit, 0, "1@$-", "$");
873 TEST (T, 116.0, "116 $", 3, 0, goodbit, 0, "1 $-", "$");
874 TEST (T, 117.0, "117$", 4, showbase, eofbit, 0, "1@$-", "$");
875 TEST (T, 118.0, "118$", 4, showbase, eofbit, 0, "1@$-", "$");
876 TEST (T, 119.0, "119 $", 5, showbase, eofbit, 0, "1 $-", "$");
877
878
885
886 // test grouping, default pattern { symbol sign none value }
887 TEST (T, 0.0, "$0", 2, 0, eofbit, 0, 0, "$", "\1");
888 TEST (T, 0.0, "$0;0", 4, 0, eofbit, 0, 0, "$", "\1");
889 TEST (T, 0.0, "$0;0;0", 6, 0, eofbit, 0, 0, "$", "\1");
890
891 TEST (T, 0.0, "$+0", 3, 0, eofbit, 0, 0, "$", "\1");
892 TEST (T, 0.0, "$+0;0", 5, 0, eofbit, 0, 0, "$", "\1");
893 TEST (T, 0.0, "$+0;0;0", 7, 0, eofbit, 0, 0, "$", "\1");
894
895 TEST (T, 0.0, "$-0.0", 5, 0, eofbit, 1, 0, "$", "\1");
896 TEST (T, 0.0, "$-0;0.00", 8, 0, eofbit, 2, 0, "$", "\1");
897 TEST (T, 0.0, "$-0;0;0.000", 11, 0, eofbit, 3, 0, "$", "\1");
898
899 TEST (T, -10.0, "$-1.", 4, 0, eofbit, 1, 0, "$", "\1");
900 TEST (T, -2000.0, "$-2;0.0000", 10, 0, eofbit, 2, 0, "$", "\1");
901 TEST (T, -300000.0, "$-3;0;0.00000", 13, 0, eofbit, 3, 0, "$", "\1");
902 TEST (T, -300001.0, "$-3;0;0.00123", 13, 0, eofbit, 3, 0, "$", "\1");
903
904 // invalid grouping: store value and set failbit
905 TEST (T, 0.0, "$0;", 3, 0, eofbit | failbit, 0, 0, "$", "\1");
906 TEST (T, 0.0, "$;0;0", 5, 0, eofbit | failbit, 0, 0, "$", "\1");
907 TEST (T, 0.0, "$0;;0", 5, 0, eofbit | failbit, 0, 0, "$", "\1");
908 TEST (T, 0.0, "$;.0", 4, 0, eofbit | failbit, 1, 0, "$", "\1");
909 TEST (T, 0.0, "$;;.0", 5, 0, eofbit | failbit, 1, 0, "$", "\1");
910 // decimal_point alone is not a valid number
911 TEST (T, 0.0, "$.;1", 2, 0, failbit, 1, 0, "$", "\1");
912 TEST (T, 0.0, "$;.;2", 3, 0, failbit, 1, 0, "$", "\1");
913
914 TEST (T, 0.0, "$+0;", 4, 0, eofbit | failbit, 0, 0, "$", "\1");
915 TEST (T, 0.0, "$+;0;0", 6, 0, eofbit | failbit, 0, 0, "$", "\1");
916 TEST (T, 0.0, "$+0;;0", 6, 0, eofbit | failbit, 0, 0, "$", "\1");
917 TEST (T, 0.0, "$+;.0;", 5, 0, failbit, 1, 0, "$", "\1");
918
919 TEST (T, -40.0, "$-4;. ", 5, 0, failbit, 1, 0, "$", "\1");
920 TEST (T, -5000.0, "$-;5;0.0000 ", 11, 0, failbit, 2, 0, "$", "\1");
921 TEST (T, -600000.0, "$-6;0;;0.00000 ", 14, 0, failbit, 3, 0, "$", "\1");
922 TEST (T, -700004.0, "$-7;;0;0.00456 ", 14, 0, failbit, 3, 0, "$", "\1");
923
924#ifndef _RWSTD_NO_LONG_DOUBLE
925# define LDBL(x) x ## L
926#else
927# define LDBL(x) x
928#endif
929 TEST (T, LDBL (1234567890.0),
930 "$1;2;3;4;5;6;7;8;9;0", 20, 0, eofbit, 0, 0, "$", "\1");
931
932 TEST (T, LDBL (1234567890.0),
933 "$0;1;2;3;4;5;6;7;8;9;0", 22, 0, eofbit, 0, 0, "$", "\1");
934
935 TEST (T, LDBL (1234567890.0),
936 "$0;0;1;2;3;4;5;6;7;8;9;0", 24, 0, eofbit, 0, 0, "$", "\1");
937
938 TEST (T, LDBL (1234567890.0),
939 "$+1;2;3;4;5;6;7;8;9;0", 21, 0, eofbit, 0, 0, "$", "\1");
940
941 TEST (T, LDBL (1234567890.0),
942 "$+0;1;2;3;4;5;6;7;8;9;0", 23, 0, eofbit, 0, 0, "$", "\1");
943
944 TEST (T, LDBL (1234567890.0),
945 "$+0;0;1;2;3;4;5;6;7;8;9;0", 25, 0, eofbit, 0, 0, "$", "\1");
946
947 TEST (T, LDBL (1234567890.0),
948 "$+0;1;2;3;4;5;6;7;8;9;0", 23, 0, eofbit, 0, 0, "$", "\1");
949
950 TEST (T, -LDBL (1234567890.0),
951 "$-1;2;3;4;5;6;7;8;9;0", 21, 0, eofbit, 0, 0, "$", "\1");
952
953 TEST (T, -LDBL (1234567890.0),
954 "$-0;1;2;3;4;5;6;7;8;9;0", 23, 0, eofbit, 0, 0, "$", "\1");
955
956 TEST (T, -LDBL (1234567890.0),
957 "$-0;0;1;2;3;4;5;6;7;8;9;0", 25, 0, eofbit, 0, 0, "$", "\1");
958
959
960 TEST (T, LDBL (1234567890.0),
961 "$12;34;56;78;90", 15, 0, eofbit, 0, 0, "$", "\2");
962
963 TEST (T, LDBL (1234567890.0),
964 "$+12;34;56;78;90", 16, 0, eofbit, 0, 0, "$", "\2");
965
966 TEST (T, -LDBL (1234567890.0),
967 "$-12;34;56;78;90", 16, 0, eofbit, 0, 0, "$", "\2");
968
969#undef T
970
971}
972
973
975template <class charT>
976void
977test_get (charT opt, const char *cname, const char *tname)
978{
979 // test local money format
980 test_get (opt, cname, tname, false);
981
982 // test international money format
983 test_get (opt, cname, tname, true);
984}
985
986
988template <class charT>
989void
990test_long_double (charT, const char *cname)
991{
992 if (rw_enabled ("long double"))
993 test_get (charT (0 /* long double argument */),
994 cname, "long double");
995 else
996 rw_note (0, __FILE__, __LINE__, "long double test disabled");
997}
998
999
1001template <class charT>
1002void
1003test_string (charT, const char *cname)
1004{
1005 if (rw_enabled ("basic_string"))
1006 test_get (charT (1 /* basic_string argument */),
1007 cname, "basic_string");
1008 else
1009 rw_note (0, __FILE__, __LINE__,
1010 "basic_string<%s> test disabled", cname);
1011}
1012
1013
1015static int
1016run_test (int, char*[])
1017{
1018 // check the prescribed values of the required constants
1019 rw_fatal ('\0' == std::money_base::none, 0, 0,
1020 "'\\0' == money_base::none, got %d", std::money_base::none);
1021
1022 rw_fatal ('\1' == std::money_base::space, 0, 0,
1023 "'\\1' == money_base::space, got %d", std::money_base::space);
1024
1025 rw_fatal ('\2' == std::money_base::symbol, 0, 0,
1026 "'\\2' == money_base::symbol, got %d", std::money_base::symbol);
1027
1028 rw_fatal ('\3' == std::money_base::sign, 0, 0,
1029 "'\\3' == money_base::sign, got %d", std::money_base::sign);
1030
1031 rw_fatal ('\4' == std::money_base::value, 0, 0,
1032 "'\\4' == money_base::value, got %d", std::money_base::value);
1033
1034 if (rw_enabled ("char")) {
1035 test_long_double (char (), "char");
1036 test_string (char (), "char");
1037 }
1038 else
1039 rw_note (0, __FILE__, __LINE__, "char test disabled");
1040
1041#ifndef _RWSTD_NO_WCHAR_T
1042
1043 if (rw_enabled ("wchar_t")) {
1044 test_long_double (wchar_t (), "wchar_t");
1045 test_string (wchar_t (), "wchar_t");
1046 }
1047 else
1048 rw_note (0, __FILE__, __LINE__, "wchar_t test disabled");
1049
1050#endif // _RWSTD_NO_WCHAR_T
1051
1052 return 0;
1053}
1054
1055
1057int main (int argc, char* argv [])
1058{
1059 return rw_test (argc, argv, __FILE__,
1060 "lib.locale.money.get",
1061 0 /* no comment */, run_test,
1062 "|-no-basic_string#",
1063 &no_basic_string);
1064}
#define i
Definition 17.names.cpp:126
#define last
Definition 17.names.cpp:487
#define which
Definition 17.names.cpp:575
#define pf
Definition 17.names.cpp:516
#define x
Definition 17.names.cpp:140
#define lineno
Definition 17.names.cpp:491
#define c
Definition 17.names.cpp:111
#define charT
Definition 17.names.cpp:456
#define n
Definition 17.names.cpp:130
#define val
Definition 17.names.cpp:570
void test_string(const char *charTname, const std::collate< charT > &co, const char *str1, const char *str2, int expected_val)
#define T
#define showbase
#define failbit
int foo()
#define LongDouble
void test_long_double(charT, const char *cname)
#define goodbit
std::money_base::pattern set_pattern(const char *format)
#define TEST
#define eofbit
void test_get(charT opt, const char *cname, const char *tname, bool intl)
#define LDBL(x)
#define flags
void do_test(int line, const char *src, std::size_t resoff, ForwardIterator dummy_iter, const T *, const char *predname)
void run_test(const ForwardIterator &dummy, T *, Predicate *pred)
#define main
#define foo(buf, s,...)
#define _RWSTD_LDBL_PRINTF_PREFIX
Definition _config.h:381
#define _RWSTD_ASSERT(ignore)
Definition _defs.h:1108
std::mbstate_t init
Definition codecvt1.cpp:80
const char * str
Definition exec.cpp:170
_TEST_EXPORT char * rw_expand(char *, const char *, _RWSTD_SIZE_T=_RWSTD_SIZE_MAX, _RWSTD_SIZE_T *=0)
_TEST_EXPORT char * rw_narrow(char *, const char *, _RWSTD_SIZE_T=_RWSTD_SIZE_MAX)
_TEST_EXPORT int rw_enabled(const char *name)
_TEST_EXPORT int rw_test(int argc, char *argv[], const char *filename, const char *clause, const char *comment, int(*testfun)(int, char **), const char *optspec,...)
_TEST_EXPORT int rw_info(int, const char *, int, const char *,...)
Definition driver.cpp:1681
_TEST_EXPORT int rw_fatal(int expr, const char *filename, int line, const char *fmtspec,...)
Definition driver.cpp:1596
_TEST_EXPORT int rw_note(int, const char *, int, const char *,...)
Definition driver.cpp:1664
_TEST_EXPORT int rw_assert(int, const char *, int, const char *,...)
Definition driver.cpp:1630
_TEST_EXPORT int rw_ldblcmp(long double x, long double y)
Definition valcmp.cpp:816
Base::char_type char_type
static int n_widen_
std::ctype< charT > Base
virtual const char_type * do_widen(const char *lo, const char *hi, char_type *dst) const
virtual char_type do_widen(char c) const
static const charT * positive_sign_[2]
static charT decimal_point_[2]
static charT thousands_sep_[2]
static const charT * negative_sign_[2]
static int frac_digits_[2]
static const char * grouping_[2]
static std::money_base::pattern format_[2][2]
static const charT * curr_symbol_[2]
virtual string_type do_negative_sign() const
static char_type decimal_point_
Punct(std::size_t ref)
static const char_type * negative_sign_
virtual std::money_base::pattern do_pos_format() const
static const char_type * positive_sign_
int do_frac_digits() const
static int n_thousands_sep_
static const char * grouping_
static const char_type * curr_symbol_
static char_type thousands_sep_
virtual string_type do_curr_symbol() const
char_type do_decimal_point() const
std::moneypunct< charT, Intl > Base
virtual string_type do_positive_sign() const
static int frac_digits_
virtual std::string do_grouping() const
virtual char_type do_thousands_sep() const
Base::char_type char_type
Base::string_type string_type
virtual std::money_base::pattern do_neg_format() const