1 #include "locale_test.h" 2 3 #if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) 4 # include <locale> 5 # include <sstream> 6 # include <stdexcept> 7 8 # if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) 9 using namespace std; 10 # endif 11 12 struct ref_monetary { 13 const char *name; 14 const char *money_int_prefix; 15 const char *money_int_prefix_old; 16 const char *money_prefix; 17 const char *money_suffix; 18 const char *money_decimal_point; 19 const char *money_thousands_sep; 20 }; 21 22 static const ref_monetary tested_locales[] = { 23 //{ name, money_int_prefix, money_int_prefix_old, money_prefix, money_suffix, money_decimal_point, money_thousands_sep}, 24 # if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) 25 { "fr_FR", "EUR ", "FRF ", "", "", ",", 26 # if defined (WIN32) || defined (_WIN32) 27 "\xa0" }, 28 # else 29 " " }, 30 # endif 31 { "ru_RU.koi8r", "RUB ", "RUR ", "", "\xd2\xd5\xc2", ".", " " }, 32 { "en_GB", "GBP ", "", "\xa3", "", ".", "," }, 33 { "en_US", "USD ", "", "$", "", ".", "," }, 34 # endif 35 { "C", "", "", "", "", " ", " " }, 36 }; 37 38 39 const ref_monetary* LocaleTest::_get_ref_monetary(size_t i) 40 { 41 if (i < sizeof(tested_locales) / sizeof(tested_locales[0])) { 42 return tested_locales + i; 43 } 44 return 0; 45 } 46 47 const char* LocaleTest::_get_ref_monetary_name(const ref_monetary* _ref) 48 { 49 return _ref->name; 50 } 51 52 void LocaleTest::_money_put_get( const locale& loc, const ref_monetary* rl ) 53 { 54 _money_put_get2(loc, loc, rl); 55 } 56 57 void LocaleTest::_money_put_get2( const locale& loc, const locale& streamLoc, const ref_monetary* prl ) 58 { 59 const ref_monetary &rl = *prl; 60 CPPUNIT_ASSERT( has_facet<money_put<char> >(loc) ); 61 money_put<char> const& fmp = use_facet<money_put<char> >(loc); 62 CPPUNIT_ASSERT( has_facet<money_get<char> >(loc) ); 63 money_get<char> const& fmg = use_facet<money_get<char> >(loc); 64 65 ostringstream ostr; 66 ostr.imbue(streamLoc); 67 ostr << showbase; 68 69 //Check a positive value (international format) 70 { 71 string str_res; 72 //money_put 73 { 74 CPPUNIT_ASSERT( (has_facet<moneypunct<char, true> >(loc)) ); 75 moneypunct<char, true> const& intl_fmp = use_facet<moneypunct<char, true> >(loc); 76 77 ostreambuf_iterator<char, char_traits<char> > res = fmp.put(ostr, true, ostr, ' ', 123456); 78 79 CPPUNIT_ASSERT( !res.failed() ); 80 str_res = ostr.str(); 81 //CPPUNIT_MESSAGE(str_res.c_str()); 82 83 size_t fieldIndex = 0; 84 size_t index = 0; 85 86 //On a positive value we skip the sign field if exists: 87 if (intl_fmp.pos_format().field[fieldIndex] == money_base::sign) { 88 ++fieldIndex; 89 } 90 // international currency abbreviation, if it is before value 91 92 /* 93 * int_curr_symbol 94 * 95 * The international currency symbol. The operand is a four-character 96 * string, with the first three characters containing the alphabetic 97 * international currency symbol in accordance with those specified 98 * in the ISO 4217 specification. The fourth character is the character used 99 * to separate the international currency symbol from the monetary quantity. 100 * 101 * (http://www.opengroup.org/onlinepubs/7990989775/xbd/locale.html) 102 */ 103 string::size_type p = strlen( rl.money_int_prefix ); 104 if (p != 0) { 105 CPPUNIT_ASSERT( intl_fmp.pos_format().field[fieldIndex] == money_base::symbol ); 106 string::size_type p_old = strlen( rl.money_int_prefix_old ); 107 CPPUNIT_ASSERT( (str_res.substr(index, p) == rl.money_int_prefix) || 108 ((p_old != 0) && 109 (str_res.substr(index, p_old) == rl.money_int_prefix_old)) ); 110 if ( str_res.substr(index, p) == rl.money_int_prefix ) { 111 index += p; 112 } else { 113 index += p_old; 114 } 115 ++fieldIndex; 116 } 117 118 // space after currency 119 if (intl_fmp.pos_format().field[fieldIndex] == money_base::space || 120 intl_fmp.pos_format().field[fieldIndex] == money_base::none) { 121 // iternational currency symobol has four chars, one of these chars 122 // is separator, so if format has space on this place, it should 123 // be skipped. 124 ++fieldIndex; 125 } 126 127 // sign 128 if (intl_fmp.pos_format().field[fieldIndex] == money_base::sign) { 129 ++fieldIndex; 130 } 131 132 // value 133 CPPUNIT_ASSERT( str_res[index++] == '1' ); 134 if (!intl_fmp.grouping().empty()) { 135 CPPUNIT_ASSERT( str_res[index++] == /* intl_fmp.thousands_sep() */ *rl.money_thousands_sep ); 136 } 137 CPPUNIT_ASSERT( str_res[index++] == '2' ); 138 CPPUNIT_ASSERT( str_res[index++] == '3' ); 139 CPPUNIT_ASSERT( str_res[index++] == '4' ); 140 if (intl_fmp.frac_digits() != 0) { 141 CPPUNIT_ASSERT( str_res[index++] == /* intl_fmp.decimal_point() */ *rl.money_decimal_point ); 142 } 143 CPPUNIT_ASSERT( str_res[index++] == '5' ); 144 CPPUNIT_ASSERT( str_res[index++] == '6' ); 145 ++fieldIndex; 146 147 // sign 148 if (intl_fmp.pos_format().field[fieldIndex] == money_base::sign) { 149 ++fieldIndex; 150 } 151 152 // space 153 if (intl_fmp.pos_format().field[fieldIndex] == money_base::space ) { 154 CPPUNIT_ASSERT( str_res[index++] == ' ' ); 155 ++fieldIndex; 156 } 157 158 // sign 159 if (intl_fmp.pos_format().field[fieldIndex] == money_base::sign) { 160 ++fieldIndex; 161 } 162 163 //as space cannot be last the only left format can be none: 164 while ( fieldIndex < 3 ) { 165 CPPUNIT_ASSERT( intl_fmp.pos_format().field[fieldIndex] == money_base::none ); 166 ++fieldIndex; 167 } 168 } 169 170 //money_get 171 { 172 ios_base::iostate err = ios_base::goodbit; 173 string digits; 174 175 istringstream istr(str_res); 176 ostr.str( "" ); 177 ostr.clear(); 178 fmg.get(istr, istreambuf_iterator<char, char_traits<char> >(), true, ostr, err, digits); 179 CPPUNIT_ASSERT( (err & (ios_base::failbit | ios_base::badbit)) == 0 ); 180 CPPUNIT_ASSERT( digits == "123456" ); 181 } 182 } 183 184 ostr.str(""); 185 //Check a negative value (national format) 186 { 187 CPPUNIT_ASSERT( (has_facet<moneypunct<char, false> >(loc)) ); 188 moneypunct<char, false> const& dom_fmp = use_facet<moneypunct<char, false> >(loc); 189 string str_res; 190 //Check money_put 191 { 192 ostreambuf_iterator<char, char_traits<char> > res = fmp.put(ostr, false, ostr, ' ', -123456); 193 194 CPPUNIT_ASSERT( !res.failed() ); 195 str_res = ostr.str(); 196 //CPPUNIT_MESSAGE(str_res.c_str()); 197 198 size_t fieldIndex = 0; 199 size_t index = 0; 200 201 if (dom_fmp.neg_format().field[fieldIndex] == money_base::sign) { 202 CPPUNIT_ASSERT( str_res.substr(index, dom_fmp.negative_sign().size()) == dom_fmp.negative_sign() ); 203 index += dom_fmp.negative_sign().size(); 204 ++fieldIndex; 205 } 206 207 string::size_type p = strlen( rl.money_prefix ); 208 if (p != 0) { 209 CPPUNIT_ASSERT( str_res.substr(index, p) == rl.money_prefix ); 210 index += p; 211 ++fieldIndex; 212 } 213 if (dom_fmp.neg_format().field[fieldIndex] == money_base::space || 214 dom_fmp.neg_format().field[fieldIndex] == money_base::none) { 215 CPPUNIT_ASSERT( str_res[index++] == ' ' ); 216 ++fieldIndex; 217 } 218 219 CPPUNIT_ASSERT( str_res[index++] == '1' ); 220 if (!dom_fmp.grouping().empty()) { 221 CPPUNIT_ASSERT( str_res[index++] == dom_fmp.thousands_sep() ); 222 } 223 CPPUNIT_ASSERT( str_res[index++] == '2' ); 224 CPPUNIT_ASSERT( str_res[index++] == '3' ); 225 CPPUNIT_ASSERT( str_res[index++] == '4' ); 226 if (dom_fmp.frac_digits() != 0) { 227 CPPUNIT_ASSERT( str_res[index++] == dom_fmp.decimal_point() ); 228 } 229 CPPUNIT_ASSERT( str_res[index++] == '5' ); 230 CPPUNIT_ASSERT( str_res[index++] == '6' ); 231 ++fieldIndex; 232 233 //space cannot be last: 234 if ((fieldIndex < 3) && 235 dom_fmp.neg_format().field[fieldIndex] == money_base::space) { 236 CPPUNIT_ASSERT( str_res[index++] == ' ' ); 237 ++fieldIndex; 238 } 239 240 if (fieldIndex == 3) { 241 //If none is last we should not add anything to the resulting string: 242 if (dom_fmp.neg_format().field[fieldIndex] == money_base::none) { 243 CPPUNIT_ASSERT( index == str_res.size() ); 244 } else { 245 CPPUNIT_ASSERT( dom_fmp.neg_format().field[fieldIndex] == money_base::symbol ); 246 CPPUNIT_ASSERT( str_res.substr(index, strlen(rl.money_suffix)) == rl.money_suffix ); 247 } 248 } 249 } 250 251 //money_get 252 { 253 ios_base::iostate err = ios_base::goodbit; 254 # if defined (STLPORT) 255 _STLP_LONGEST_FLOAT_TYPE val; 256 # else 257 long double val; 258 # endif 259 260 istringstream istr(str_res); 261 fmg.get(istr, istreambuf_iterator<char, char_traits<char> >(), false, ostr, err, val); 262 CPPUNIT_ASSERT( (err & (ios_base::failbit | ios_base::badbit)) == 0 ); 263 if (dom_fmp.negative_sign().empty()) { 264 //Without negative sign there is no way to guess the resulting amount sign ("C" locale): 265 CPPUNIT_ASSERT( val == 123456 ); 266 } 267 else { 268 CPPUNIT_ASSERT( val == -123456 ); 269 } 270 } 271 } 272 } 273 274 275 // Test for bug in case when number of digits in value less then number 276 // of digits in fraction. I.e. '9' should be printed as '0.09', 277 // if x.frac_digits() == 2. 278 279 void LocaleTest::_money_put_X_bug( const locale& loc, const ref_monetary* prl ) 280 { 281 const ref_monetary &rl = *prl; 282 CPPUNIT_ASSERT( has_facet<money_put<char> >(loc) ); 283 money_put<char> const& fmp = use_facet<money_put<char> >(loc); 284 285 ostringstream ostr; 286 ostr.imbue(loc); 287 ostr << showbase; 288 289 // ostr.str(""); 290 // Check value with one decimal digit: 291 { 292 CPPUNIT_ASSERT( (has_facet<moneypunct<char, false> >(loc)) ); 293 moneypunct<char, false> const& dom_fmp = use_facet<moneypunct<char, false> >(loc); 294 string str_res; 295 // Check money_put 296 { 297 ostreambuf_iterator<char, char_traits<char> > res = fmp.put(ostr, false, ostr, ' ', 9); 298 299 CPPUNIT_ASSERT( !res.failed() ); 300 str_res = ostr.str(); 301 302 size_t fieldIndex = 0; 303 size_t index = 0; 304 305 if (dom_fmp.pos_format().field[fieldIndex] == money_base::sign) { 306 CPPUNIT_ASSERT( str_res.substr(index, dom_fmp.positive_sign().size()) == dom_fmp.positive_sign() ); 307 index += dom_fmp.positive_sign().size(); 308 ++fieldIndex; 309 } 310 311 string::size_type p = strlen( rl.money_prefix ); 312 if (p != 0) { 313 CPPUNIT_ASSERT( str_res.substr(index, p) == rl.money_prefix ); 314 index += p; 315 ++fieldIndex; 316 } 317 if (dom_fmp.neg_format().field[fieldIndex] == money_base::space || 318 dom_fmp.neg_format().field[fieldIndex] == money_base::none) { 319 CPPUNIT_ASSERT( str_res[index++] == ' ' ); 320 ++fieldIndex; 321 } 322 if (dom_fmp.frac_digits() != 0) { 323 CPPUNIT_ASSERT( str_res[index++] == '0' ); 324 CPPUNIT_ASSERT( str_res[index++] == dom_fmp.decimal_point() ); 325 for ( int fd = 1; fd < dom_fmp.frac_digits(); ++fd ) { 326 CPPUNIT_ASSERT( str_res[index++] == '0' ); 327 } 328 } 329 CPPUNIT_ASSERT( str_res[index++] == '9' ); 330 ++fieldIndex; 331 332 //space cannot be last: 333 if ((fieldIndex < 3) && 334 dom_fmp.neg_format().field[fieldIndex] == money_base::space) { 335 CPPUNIT_ASSERT( str_res[index++] == ' ' ); 336 ++fieldIndex; 337 } 338 339 if (fieldIndex == 3) { 340 //If none is last we should not add anything to the resulting string: 341 if (dom_fmp.neg_format().field[fieldIndex] == money_base::none) { 342 CPPUNIT_ASSERT( index == str_res.size() ); 343 } else { 344 CPPUNIT_ASSERT( dom_fmp.neg_format().field[fieldIndex] == money_base::symbol ); 345 CPPUNIT_ASSERT( str_res.substr(index, strlen(rl.money_suffix)) == rl.money_suffix ); 346 } 347 } 348 } 349 } 350 351 ostr.str(""); 352 // Check value with two decimal digit: 353 { 354 CPPUNIT_ASSERT( (has_facet<moneypunct<char, false> >(loc)) ); 355 moneypunct<char, false> const& dom_fmp = use_facet<moneypunct<char, false> >(loc); 356 string str_res; 357 // Check money_put 358 { 359 ostreambuf_iterator<char, char_traits<char> > res = fmp.put(ostr, false, ostr, ' ', 90); 360 361 CPPUNIT_ASSERT( !res.failed() ); 362 str_res = ostr.str(); 363 364 size_t fieldIndex = 0; 365 size_t index = 0; 366 367 if (dom_fmp.pos_format().field[fieldIndex] == money_base::sign) { 368 CPPUNIT_ASSERT( str_res.substr(index, dom_fmp.positive_sign().size()) == dom_fmp.positive_sign() ); 369 index += dom_fmp.positive_sign().size(); 370 ++fieldIndex; 371 } 372 373 string::size_type p = strlen( rl.money_prefix ); 374 if (p != 0) { 375 CPPUNIT_ASSERT( str_res.substr(index, p) == rl.money_prefix ); 376 index += p; 377 ++fieldIndex; 378 } 379 if (dom_fmp.neg_format().field[fieldIndex] == money_base::space || 380 dom_fmp.neg_format().field[fieldIndex] == money_base::none) { 381 CPPUNIT_ASSERT( str_res[index++] == ' ' ); 382 ++fieldIndex; 383 } 384 if (dom_fmp.frac_digits() != 0) { 385 CPPUNIT_ASSERT( str_res[index++] == '0' ); 386 CPPUNIT_ASSERT( str_res[index++] == dom_fmp.decimal_point() ); 387 for ( int fd = 1; fd < dom_fmp.frac_digits() - 1; ++fd ) { 388 CPPUNIT_ASSERT( str_res[index++] == '0' ); 389 } 390 } 391 CPPUNIT_ASSERT( str_res[index++] == '9' ); 392 if (dom_fmp.frac_digits() != 0) { 393 CPPUNIT_ASSERT( str_res[index++] == '0' ); 394 } 395 ++fieldIndex; 396 397 //space cannot be last: 398 if ((fieldIndex < 3) && 399 dom_fmp.neg_format().field[fieldIndex] == money_base::space) { 400 CPPUNIT_ASSERT( str_res[index++] == ' ' ); 401 ++fieldIndex; 402 } 403 404 if (fieldIndex == 3) { 405 //If none is last we should not add anything to the resulting string: 406 if (dom_fmp.neg_format().field[fieldIndex] == money_base::none) { 407 CPPUNIT_ASSERT( index == str_res.size() ); 408 } else { 409 CPPUNIT_ASSERT( dom_fmp.neg_format().field[fieldIndex] == money_base::symbol ); 410 CPPUNIT_ASSERT( str_res.substr(index, strlen(rl.money_suffix)) == rl.money_suffix ); 411 } 412 } 413 } 414 } 415 } 416 417 typedef void (LocaleTest::*_Test) (const locale&, const ref_monetary*); 418 static void test_supported_locale(LocaleTest& inst, _Test __test) { 419 size_t n = sizeof(tested_locales) / sizeof(tested_locales[0]); 420 for (size_t i = 0; i < n; ++i) { 421 locale loc; 422 # if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) 423 try 424 # endif 425 { 426 locale tmp(tested_locales[i].name); 427 loc = tmp; 428 } 429 # if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) 430 catch (runtime_error const&) { 431 //This locale is not supported. 432 continue; 433 } 434 # endif 435 CPPUNIT_MESSAGE( loc.name().c_str() ); 436 (inst.*__test)(loc, tested_locales + i); 437 438 { 439 locale tmp(locale::classic(), tested_locales[i].name, locale::monetary); 440 loc = tmp; 441 } 442 (inst.*__test)(loc, tested_locales + i); 443 444 { 445 locale tmp0(locale::classic(), new moneypunct_byname<char, true>(tested_locales[i].name)); 446 locale tmp1(tmp0, new moneypunct_byname<char, false>(tested_locales[i].name)); 447 loc = tmp1; 448 } 449 (inst.*__test)(loc, tested_locales + i); 450 } 451 } 452 453 void LocaleTest::money_put_get() 454 { test_supported_locale(*this, &LocaleTest::_money_put_get); } 455 456 void LocaleTest::money_put_X_bug() 457 { test_supported_locale(*this, &LocaleTest::_money_put_X_bug); } 458 459 void LocaleTest::moneypunct_by_name() 460 { 461 /* 462 * Check of the 22.1.1.2.7 standard point. Construction of a locale 463 * instance from a null pointer or an unknown name should result in 464 * a runtime_error exception. 465 */ 466 # if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS) 467 # if defined (STLPORT) || !defined (__GNUC__) 468 try { 469 locale loc(locale::classic(), new moneypunct_byname<char, true>(static_cast<char const*>(0))); 470 CPPUNIT_FAIL; 471 } 472 catch (runtime_error const&) { 473 } 474 catch (...) { 475 CPPUNIT_FAIL; 476 } 477 # endif 478 479 try { 480 locale loc(locale::classic(), new moneypunct_byname<char, true>("yasli_language")); 481 CPPUNIT_FAIL; 482 } 483 catch (runtime_error const&) { 484 } 485 catch (...) { 486 CPPUNIT_FAIL; 487 } 488 489 try { 490 string veryLongFacetName("LC_MONETARY="); 491 veryLongFacetName.append(512, '?'); 492 locale loc(locale::classic(), new moneypunct_byname<char, true>(veryLongFacetName.c_str())); 493 CPPUNIT_FAIL; 494 } 495 catch (runtime_error const& /* e */) { 496 //CPPUNIT_MESSAGE( e.what() ); 497 } 498 catch (...) { 499 CPPUNIT_FAIL; 500 } 501 502 # if defined (STLPORT) || !defined (__GNUC__) 503 try { 504 locale loc(locale::classic(), new moneypunct_byname<char, false>(static_cast<char const*>(0))); 505 CPPUNIT_FAIL; 506 } 507 catch (runtime_error const&) { 508 } 509 catch (...) { 510 CPPUNIT_FAIL; 511 } 512 # endif 513 514 try { 515 locale loc(locale::classic(), new moneypunct_byname<char, false>("yasli_language")); 516 CPPUNIT_FAIL; 517 } 518 catch (runtime_error const&) { 519 } 520 catch (...) { 521 CPPUNIT_FAIL; 522 } 523 524 try { 525 string veryLongFacetName("LC_MONETARY="); 526 veryLongFacetName.append(512, '?'); 527 locale loc(locale::classic(), new moneypunct_byname<char, false>(veryLongFacetName.c_str())); 528 CPPUNIT_FAIL; 529 } 530 catch (runtime_error const& /* e */) { 531 //CPPUNIT_MESSAGE( e.what() ); 532 } 533 catch (...) { 534 CPPUNIT_FAIL; 535 } 536 537 try { 538 locale loc(locale::classic(), new moneypunct_byname<char, false>("C")); 539 moneypunct<char, false> const& cfacet_byname = use_facet<moneypunct<char, false> >(loc); 540 moneypunct<char, false> const& cfacet = use_facet<moneypunct<char, false> >(locale::classic()); 541 542 money_base::pattern cp = cfacet.pos_format(); 543 money_base::pattern cp_bn = cfacet_byname.pos_format(); 544 CPPUNIT_CHECK( cp_bn.field[0] == cp.field[0] ); 545 CPPUNIT_CHECK( cp_bn.field[1] == cp.field[1] ); 546 CPPUNIT_CHECK( cp_bn.field[2] == cp.field[2] ); 547 CPPUNIT_CHECK( cp_bn.field[3] == cp.field[3] ); 548 549 CPPUNIT_CHECK( cfacet_byname.frac_digits() == cfacet.frac_digits() ); 550 if (cfacet_byname.frac_digits() != 0) 551 CPPUNIT_CHECK( cfacet_byname.decimal_point() == cfacet.decimal_point() ); 552 CPPUNIT_CHECK( cfacet_byname.grouping() == cfacet.grouping() ); 553 if (!cfacet_byname.grouping().empty()) 554 CPPUNIT_CHECK( cfacet_byname.thousands_sep() == cfacet.thousands_sep() ); 555 CPPUNIT_CHECK( cfacet_byname.positive_sign() == cfacet.positive_sign() ); 556 CPPUNIT_CHECK( cfacet_byname.negative_sign() == cfacet.negative_sign() ); 557 } 558 catch (runtime_error const& /* e */) { 559 /* CPPUNIT_MESSAGE( e.what() ); */ 560 CPPUNIT_FAIL; 561 } 562 catch (...) { 563 CPPUNIT_FAIL; 564 } 565 566 try { 567 locale loc(locale::classic(), new moneypunct_byname<char, true>("C")); 568 moneypunct<char, true> const& cfacet_byname = use_facet<moneypunct<char, true> >(loc); 569 moneypunct<char, true> const& cfacet = use_facet<moneypunct<char, true> >(locale::classic()); 570 571 money_base::pattern cp = cfacet.pos_format(); 572 money_base::pattern cp_bn = cfacet_byname.pos_format(); 573 CPPUNIT_CHECK( cp_bn.field[0] == cp.field[0] ); 574 CPPUNIT_CHECK( cp_bn.field[1] == cp.field[1] ); 575 CPPUNIT_CHECK( cp_bn.field[2] == cp.field[2] ); 576 CPPUNIT_CHECK( cp_bn.field[3] == cp.field[3] ); 577 578 CPPUNIT_CHECK( cfacet_byname.frac_digits() == cfacet.frac_digits() ); 579 if (cfacet_byname.frac_digits() != 0) 580 CPPUNIT_CHECK( cfacet_byname.decimal_point() == cfacet.decimal_point() ); 581 CPPUNIT_CHECK( cfacet_byname.grouping() == cfacet.grouping() ); 582 if (!cfacet_byname.grouping().empty()) 583 CPPUNIT_CHECK( cfacet_byname.thousands_sep() == cfacet.thousands_sep() ); 584 CPPUNIT_CHECK( cfacet_byname.positive_sign() == cfacet.positive_sign() ); 585 CPPUNIT_CHECK( cfacet_byname.negative_sign() == cfacet.negative_sign() ); 586 } 587 catch (runtime_error const& /* e */) { 588 /* CPPUNIT_MESSAGE( e.what() ); */ 589 CPPUNIT_FAIL; 590 } 591 catch (...) { 592 CPPUNIT_FAIL; 593 } 594 595 try { 596 // On platform without real localization support we should rely on the "C" locale facet. 597 locale loc(locale::classic(), new moneypunct_byname<char, false>("")); 598 } 599 catch (runtime_error const& /* e */) { 600 /* CPPUNIT_MESSAGE( e.what() ); */ 601 CPPUNIT_FAIL; 602 } 603 catch (...) { 604 CPPUNIT_FAIL; 605 } 606 607 # if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T) 608 # if defined (STLPORT) || !defined (__GNUC__) 609 try { 610 locale loc(locale::classic(), new moneypunct_byname<wchar_t, true>(static_cast<char const*>(0))); 611 CPPUNIT_FAIL; 612 } 613 catch (runtime_error const&) { 614 } 615 catch (...) { 616 CPPUNIT_FAIL; 617 } 618 # endif 619 620 try { 621 locale loc(locale::classic(), new moneypunct_byname<wchar_t, true>("yasli_language")); 622 CPPUNIT_FAIL; 623 } 624 catch (runtime_error const&) { 625 } 626 catch (...) { 627 CPPUNIT_FAIL; 628 } 629 630 # if defined (STLPORT) || !defined (__GNUC__) 631 try { 632 locale loc(locale::classic(), new moneypunct_byname<wchar_t, false>(static_cast<char const*>(0))); 633 CPPUNIT_FAIL; 634 } 635 catch (runtime_error const&) { 636 } 637 catch (...) { 638 CPPUNIT_FAIL; 639 } 640 # endif 641 642 try { 643 locale loc(locale::classic(), new moneypunct_byname<wchar_t, false>("yasli_language")); 644 CPPUNIT_FAIL; 645 } 646 catch (runtime_error const&) { 647 } 648 catch (...) { 649 CPPUNIT_FAIL; 650 } 651 # endif 652 # endif 653 } 654 655 #endif 656