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

Side by Side Diff: source/test/intltest/tzfmttst.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/tufmtts.cpp ('k') | source/test/intltest/tztest.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 ******************************************************************************* 2 *******************************************************************************
3 * Copyright (C) 2007-2014, International Business Machines Corporation and * 3 * Copyright (C) 2007-2015, International Business Machines Corporation and *
4 * others. All Rights Reserved. * 4 * others. All Rights Reserved. *
5 ******************************************************************************* 5 *******************************************************************************
6 */ 6 */
7 #include "unicode/utypes.h" 7 #include "unicode/utypes.h"
8 8
9 #if !UCONFIG_NO_FORMATTING 9 #if !UCONFIG_NO_FORMATTING
10 10
11 #include "tzfmttst.h" 11 #include "tzfmttst.h"
12 12
13 #include "simplethread.h" 13 #include "simplethread.h"
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 data.index = 0; 671 data.index = 0;
672 data.testCounts = testCounts; 672 data.testCounts = testCounts;
673 data.times = times; 673 data.times = times;
674 data.locales = LOCALES; 674 data.locales = LOCALES;
675 data.nLocales = nLocales; 675 data.nLocales = nLocales;
676 data.quick = quick; 676 data.quick = quick;
677 data.START_TIME = START_TIME; 677 data.START_TIME = START_TIME;
678 data.END_TIME = END_TIME; 678 data.END_TIME = END_TIME;
679 data.numDone = 0; 679 data.numDone = 0;
680 680
681 #if (ICU_USE_THREADS==0) 681 TestTimeRoundTripThread **threads = new TestTimeRoundTripThread*[nThreads];
682 TestTimeRoundTripThread fakeThread(*this, data, 0);
683 fakeThread.run();
684 #else
685 TestTimeRoundTripThread **threads = new TestTimeRoundTripThread*[threadCount ];
686 int32_t i; 682 int32_t i;
687 for (i = 0; i < nThreads; i++) { 683 for (i = 0; i < nThreads; i++) {
688 threads[i] = new TestTimeRoundTripThread(*this, data, i); 684 threads[i] = new TestTimeRoundTripThread(*this, data, i);
689 if (threads[i]->start() != 0) { 685 if (threads[i]->start() != 0) {
690 errln("Error starting thread %d", i); 686 errln("Error starting thread %d", i);
691 } 687 }
692 } 688 }
693 689
694 UBool done = false; 690 for (i = 0; i < nThreads; i++) {
695 while (true) { 691 threads[i]->join();
696 umtx_lock(NULL); 692 }
697 if (data.numDone == nLocales) { 693 if (data.numDone != nLocales) {
698 done = true; 694 errln("%s:%d data.numDone = %d, nLocales = %d", __FILE__, __LINE__, data .numDone, nLocales);
699 }
700 umtx_unlock(NULL);
701 if (done)
702 break;
703 SimpleThread::sleep(1000);
704 } 695 }
705 696
706 for (i = 0; i < nThreads; i++) { 697 for (i = 0; i < nThreads; i++) {
707 delete threads[i]; 698 delete threads[i];
708 } 699 }
709 delete [] threads; 700 delete [] threads;
710 701
711 #endif
712 UDate total = 0; 702 UDate total = 0;
713 logln("### Elapsed time by patterns ###"); 703 logln("### Elapsed time by patterns ###");
714 for (int32_t i = 0; i < NUM_PATTERNS; i++) { 704 for (int32_t i = 0; i < NUM_PATTERNS; i++) {
715 logln(UnicodeString("") + data.times[i] + "ms (" + PATTERNS[i] + ")"); 705 logln(UnicodeString("") + data.times[i] + "ms (" + PATTERNS[i] + ")");
716 total += data.times[i]; 706 total += data.times[i];
717 } 707 }
718 logln((UnicodeString) "Total: " + total + "ms"); 708 logln((UnicodeString) "Total: " + total + "ms");
719 logln((UnicodeString) "Iteration: " + data.testCounts); 709 logln((UnicodeString) "Iteration: " + data.testCounts);
720 710
721 delete cal; 711 delete cal;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 }; 943 };
954 944
955 const int32_t MIN_OFFSET_UNIT[] = { 945 const int32_t MIN_OFFSET_UNIT[] = {
956 60000, 60000, 60000, 1000, 1000, 946 60000, 60000, 60000, 1000, 1000,
957 60000, 60000, 60000, 1000, 1000, 947 60000, 60000, 60000, 1000, 1000,
958 1000, 948 1000,
959 }; 949 };
960 950
961 // Formatting 951 // Formatting
962 UErrorCode status = U_ZERO_ERROR; 952 UErrorCode status = U_ZERO_ERROR;
963 LocalPointer<SimpleDateFormat> sdf(new SimpleDateFormat(status)); 953 LocalPointer<SimpleDateFormat> sdf(new SimpleDateFormat(status), status);
964 if (U_FAILURE(status)) { 954 if (U_FAILURE(status)) {
965 dataerrln("Fail new SimpleDateFormat: %s", u_errorName(status)); 955 dataerrln("Fail new SimpleDateFormat: %s", u_errorName(status));
966 return; 956 return;
967 } 957 }
968 UDate d = Calendar::getNow(); 958 UDate d = Calendar::getNow();
969 959
970 for (uint32_t i = 0; i < sizeof(OFFSET)/sizeof(OFFSET[0]); i++) { 960 for (uint32_t i = 0; i < sizeof(OFFSET)/sizeof(OFFSET[0]); i++) {
971 SimpleTimeZone* tz = new SimpleTimeZone(OFFSET[i], UnicodeString("Zone O ffset:") + OFFSET[i] + "ms"); 961 SimpleTimeZone* tz = new SimpleTimeZone(OFFSET[i], UnicodeString("Zone O ffset:") + OFFSET[i] + "ms");
972 sdf->adoptTimeZone(tz); 962 sdf->adoptTimeZone(tz);
973 for (int32_t j = 0; PATTERN[j] != 0; j++) { 963 for (int32_t j = 0; PATTERN[j] != 0; j++) {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 assertEquals(UnicodeString("Format result for ") + DATA[i].tzid + " (Tes t Case " + i + ")", expected, out); 1216 assertEquals(UnicodeString("Format result for ") + DATA[i].tzid + " (Tes t Case " + i + ")", expected, out);
1227 if (DATA[i].timeType != timeType) { 1217 if (DATA[i].timeType != timeType) {
1228 dataerrln(UnicodeString("Formatted time zone type (Test Case ") + i + "), returned=" 1218 dataerrln(UnicodeString("Formatted time zone type (Test Case ") + i + "), returned="
1229 + timeType + ", expected=" + DATA[i].timeType); 1219 + timeType + ", expected=" + DATA[i].timeType);
1230 } 1220 }
1231 } 1221 }
1232 } 1222 }
1233 1223
1234 1224
1235 #endif /* #if !UCONFIG_NO_FORMATTING */ 1225 #endif /* #if !UCONFIG_NO_FORMATTING */
OLDNEW
« no previous file with comments | « source/test/intltest/tufmtts.cpp ('k') | source/test/intltest/tztest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698