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

Side by Side Diff: source/test/intltest/tufmtts.cpp

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 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
« no previous file with comments | « source/test/intltest/tsmthred.cpp ('k') | source/test/intltest/tzfmttst.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /******************************************************************** 1 /********************************************************************
2 * Copyright (c) 2008-2014, International Business Machines Corporation and 2 * Copyright (c) 2008-2014, International Business Machines Corporation and
3 * others. All Rights Reserved. 3 * 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 "unicode/decimfmt.h" 10 #include "unicode/decimfmt.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 nf->setMinimumFractionDigits(i); 434 nf->setMinimumFractionDigits(i);
435 nf->setMaximumFractionDigits(i); 435 nf->setMaximumFractionDigits(i);
436 nf->setRoundingMode(DecimalFormat::kRoundDown); 436 nf->setRoundingMode(DecimalFormat::kRoundDown);
437 tuf.setNumberFormat(*nf, status); 437 tuf.setNumberFormat(*nf, status);
438 if (U_FAILURE(status)) { 438 if (U_FAILURE(status)) {
439 dataerrln("setting NumberFormat failed: %s", u_errorName(status) ); 439 dataerrln("setting NumberFormat failed: %s", u_errorName(status) );
440 return; 440 return;
441 } 441 }
442 UnicodeString actual; 442 UnicodeString actual;
443 Formattable fmt; 443 Formattable fmt;
444 LocalPointer<TimeUnitAmount> tamt(new TimeUnitAmount(values[j], Time Unit::UTIMEUNIT_MINUTE, status)); 444 LocalPointer<TimeUnitAmount> tamt(
445 new TimeUnitAmount(values[j], TimeUnit::UTIMEUNIT_MINUTE, status ), status);
445 if (U_FAILURE(status)) { 446 if (U_FAILURE(status)) {
446 dataerrln("generating TimeUnitAmount Object failed: %s", u_error Name(status)); 447 dataerrln("generating TimeUnitAmount Object failed: %s", u_error Name(status));
447 return; 448 return;
448 } 449 }
449 fmt.adoptObject(tamt.orphan()); 450 fmt.adoptObject(tamt.orphan());
450 tuf.format(fmt, actual, status); 451 tuf.format(fmt, actual, status);
451 if (U_FAILURE(status)) { 452 if (U_FAILURE(status)) {
452 dataerrln("Actual formatting failed: %s", u_errorName(status)); 453 dataerrln("Actual formatting failed: %s", u_errorName(status));
453 return; 454 return;
454 } 455 }
455 if (expected[j][i] != actual) { 456 if (expected[j][i] != actual) {
456 errln("Expected " + expected[j][i] + ", got " + actual); 457 errln("Expected " + expected[j][i] + ", got " + actual);
457 } 458 }
458 } 459 }
459 } 460 }
460 461
461 // test parsing 462 // test parsing
462 Formattable result; 463 Formattable result;
463 ParsePosition pos; 464 ParsePosition pos;
464 UnicodeString formattedString = "1 minutes"; 465 UnicodeString formattedString = "1 minutes";
465 tuf.parseObject(formattedString, result, pos); 466 tuf.parseObject(formattedString, result, pos);
466 if (formattedString.length() != pos.getIndex()) { 467 if (formattedString.length() != pos.getIndex()) {
467 errln("Expect parsing to go all the way to the end of the string."); 468 errln("Expect parsing to go all the way to the end of the string.");
468 } 469 }
469 } 470 }
470 471
471 #endif 472 #endif
OLDNEW
« no previous file with comments | « source/test/intltest/tsmthred.cpp ('k') | source/test/intltest/tzfmttst.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698