Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: third_party/icu/source/test/intltest/numrgts.cpp

Issue 6520018: Get ICU 4.6 to be compiled without RTTI.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: do not include typeinfo at all Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /*********************************************************************** 1 /***********************************************************************
2 * Copyright (c) 1997-2010, International Business Machines Corporation 2 * Copyright (c) 1997-2010, International Business Machines Corporation
3 * and others. All Rights Reserved. 3 * and others. All Rights Reserved.
4 ***********************************************************************/ 4 ***********************************************************************/
5 5
6 #include "unicode/utypes.h" 6 #include "unicode/utypes.h"
7 7
8 #if !UCONFIG_NO_FORMATTING 8 #if !UCONFIG_NO_FORMATTING
9 9
10 #include "numrgts.h" 10 #include "numrgts.h"
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 // TODO: There is not a good way to find out that the creation of this numbe r format has 498 // TODO: There is not a good way to find out that the creation of this numbe r format has
499 // failed. Major rewiring of format construction proposed. 499 // failed. Major rewiring of format construction proposed.
500 if(U_FAILURE(status)) { 500 if(U_FAILURE(status)) {
501 dataerrln("Something is wrong with French number format - it should not fa llback. Exitting - %s", u_errorName(status)); 501 dataerrln("Something is wrong with French number format - it should not fa llback. Exitting - %s", u_errorName(status));
502 delete nf1; 502 delete nf1;
503 return; 503 return;
504 } 504 }
505 failure(status, "NumberFormat::createInstance", Locale::getFrance()); 505 failure(status, "NumberFormat::createInstance", Locale::getFrance());
506 506
507 // C++ workaround to make sure cast works 507 // C++ workaround to make sure cast works
508 DecimalFormat *nf = dynamic_cast<DecimalFormat *>(nf1); 508 DecimalFormat *nf = CR_DYNAMIC_CAST<DecimalFormat *>(nf1);
509 if(nf == NULL) { 509 if(nf == NULL) {
510 errln("NumberFormat::createInstance returned incorrect type."); 510 errln("NumberFormat::createInstance returned incorrect type.");
511 return; 511 return;
512 } 512 }
513 513
514 UnicodeString temp; 514 UnicodeString temp;
515 logln("nf toPattern1: " + nf->toPattern(temp)); 515 logln("nf toPattern1: " + nf->toPattern(temp));
516 logln("nf toLocPattern1: " + nf->toLocalizedPattern(temp)); 516 logln("nf toLocPattern1: " + nf->toLocalizedPattern(temp));
517 517
518 // No group separator 518 // No group separator
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 UErrorCode status = U_ZERO_ERROR; 834 UErrorCode status = U_ZERO_ERROR;
835 char loc[256] = {0}; 835 char loc[256] = {0};
836 uloc_canonicalize("pt_PT_PREEURO", loc, 256, &status); 836 uloc_canonicalize("pt_PT_PREEURO", loc, 256, &status);
837 Locale *de = new Locale(loc); 837 Locale *de = new Locale(loc);
838 NumberFormat *nf = NumberFormat::createCurrencyInstance(*de, status); 838 NumberFormat *nf = NumberFormat::createCurrencyInstance(*de, status);
839 if(U_FAILURE(status)) { 839 if(U_FAILURE(status)) {
840 dataerrln("Error creating DecimalFormat: %s", u_errorName(status)); 840 dataerrln("Error creating DecimalFormat: %s", u_errorName(status));
841 delete nf; 841 delete nf;
842 return; 842 return;
843 } 843 }
844 DecimalFormat *df = dynamic_cast<DecimalFormat *>(nf); 844 DecimalFormat *df = CR_DYNAMIC_CAST<DecimalFormat *>(nf);
845 if(df == NULL) { 845 if(df == NULL) {
846 errln("expected DecimalFormat!"); 846 errln("expected DecimalFormat!");
847 return; 847 return;
848 } 848 }
849 const DecimalFormatSymbols *sym = df->getDecimalFormatSymbols(); 849 const DecimalFormatSymbols *sym = df->getDecimalFormatSymbols();
850 UnicodeString decSep = sym->getSymbol(DecimalFormatSymbols::kDecimalSeparato rSymbol); 850 UnicodeString decSep = sym->getSymbol(DecimalFormatSymbols::kDecimalSeparato rSymbol);
851 UnicodeString monSep = sym->getSymbol(DecimalFormatSymbols::kMonetarySeparat orSymbol); 851 UnicodeString monSep = sym->getSymbol(DecimalFormatSymbols::kMonetarySeparat orSymbol);
852 if (decSep == monSep) { 852 if (decSep == monSep) {
853 errln("ERROR in test: want decimal sep != monetary sep"); 853 errln("ERROR in test: want decimal sep != monetary sep");
854 return; 854 return;
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1905 * single quotes. 1905 * single quotes.
1906 */ 1906 */
1907 void NumberFormatRegressionTest::Test4145457() { 1907 void NumberFormatRegressionTest::Test4145457() {
1908 //try { 1908 //try {
1909 UErrorCode status = U_ZERO_ERROR; 1909 UErrorCode status = U_ZERO_ERROR;
1910 NumberFormat *nff = NumberFormat::createInstance(status); 1910 NumberFormat *nff = NumberFormat::createInstance(status);
1911 if (failure(status, "NumberFormat::createInstance", TRUE)){ 1911 if (failure(status, "NumberFormat::createInstance", TRUE)){
1912 delete nff; 1912 delete nff;
1913 return; 1913 return;
1914 }; 1914 };
1915 DecimalFormat *nf = dynamic_cast<DecimalFormat *>(nff); 1915 DecimalFormat *nf = CR_DYNAMIC_CAST<DecimalFormat *>(nff);
1916 if(nf == NULL) { 1916 if(nf == NULL) {
1917 errln("DecimalFormat needed to continue"); 1917 errln("DecimalFormat needed to continue");
1918 return; 1918 return;
1919 } 1919 }
1920 1920
1921 DecimalFormatSymbols *sym = (DecimalFormatSymbols*) nf->getDecimalFormatSymb ols(); 1921 DecimalFormatSymbols *sym = (DecimalFormatSymbols*) nf->getDecimalFormatSymb ols();
1922 sym->setSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol, (UChar)/*'\''* /0x0027); 1922 sym->setSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol, (UChar)/*'\''* /0x0027);
1923 nf->setDecimalFormatSymbols(*sym); 1923 nf->setDecimalFormatSymbols(*sym);
1924 double pi = 3.14159; 1924 double pi = 3.14159;
1925 1925
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
2182 * @bug 4170798 2182 * @bug 4170798
2183 * DecimalFormat.parse() fails when ParseIntegerOnly set to true 2183 * DecimalFormat.parse() fails when ParseIntegerOnly set to true
2184 */ 2184 */
2185 void NumberFormatRegressionTest::Test4170798(void) { 2185 void NumberFormatRegressionTest::Test4170798(void) {
2186 UErrorCode status = U_ZERO_ERROR; 2186 UErrorCode status = U_ZERO_ERROR;
2187 NumberFormat *nf = NumberFormat::createInstance(Locale::getUS(), status); 2187 NumberFormat *nf = NumberFormat::createInstance(Locale::getUS(), status);
2188 if (failure(status, "NumberFormat::createInstance", TRUE)){ 2188 if (failure(status, "NumberFormat::createInstance", TRUE)){
2189 delete nf; 2189 delete nf;
2190 return; 2190 return;
2191 }; 2191 };
2192 DecimalFormat *df = dynamic_cast<DecimalFormat *>(nf); 2192 DecimalFormat *df = CR_DYNAMIC_CAST<DecimalFormat *>(nf);
2193 if(df == NULL) { 2193 if(df == NULL) {
2194 errln("DecimalFormat needed to continue"); 2194 errln("DecimalFormat needed to continue");
2195 return; 2195 return;
2196 } 2196 }
2197 df->setParseIntegerOnly(TRUE); 2197 df->setParseIntegerOnly(TRUE);
2198 Formattable n; 2198 Formattable n;
2199 ParsePosition pos(0); 2199 ParsePosition pos(0);
2200 df->parse("-0.0", n, pos); 2200 df->parse("-0.0", n, pos);
2201 if (n.getType() != Formattable::kLong 2201 if (n.getType() != Formattable::kLong
2202 || n.getLong() != 0) { 2202 || n.getLong() != 0) {
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
2680 df->format(ulocdat, outString); 2680 df->format(ulocdat, outString);
2681 2681
2682 if (outString != exp) { 2682 if (outString != exp) {
2683 errln("FAIL: " + udt + " => " + outString); 2683 errln("FAIL: " + udt + " => " + outString);
2684 } 2684 }
2685 2685
2686 delete df; 2686 delete df;
2687 } 2687 }
2688 2688
2689 #endif /* #if !UCONFIG_NO_FORMATTING */ 2689 #endif /* #if !UCONFIG_NO_FORMATTING */
OLDNEW
« no previous file with comments | « third_party/icu/source/test/intltest/numfmtst.cpp ('k') | third_party/icu/source/test/intltest/pptest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698