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

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

Issue 845603002: Update ICU to 54.1 step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: remove unusued directories Created 5 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/intltest.h ('k') | source/test/intltest/intltest.vcxproj » ('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: 2 * COPYRIGHT:
3 * Copyright (c) 1997-2013, International Business Machines Corporation and 3 * Copyright (c) 1997-2014, International Business Machines Corporation and
4 * others. All Rights Reserved. 4 * others. All Rights Reserved.
5 ********************************************************************/ 5 ********************************************************************/
6 6
7 7
8 #include "unicode/utypes.h" 8 #include "unicode/utypes.h"
9 9
10 /** 10 /**
11 * IntlTest is a base class for tests. 11 * IntlTest is a base class for tests.
12 */ 12 */
13 13
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 UBool IntlTest::logKnownIssue(const char *ticket, const UnicodeString &msg) { 970 UBool IntlTest::logKnownIssue(const char *ticket, const UnicodeString &msg) {
971 if(noKnownIssues) return FALSE; 971 if(noKnownIssues) return FALSE;
972 972
973 char fullpath[2048]; 973 char fullpath[2048];
974 strcpy(fullpath, basePath); 974 strcpy(fullpath, basePath);
975 strcat(fullpath, currName); 975 strcat(fullpath, currName);
976 UnicodeString msg2 =msg; 976 UnicodeString msg2 =msg;
977 UBool firstForTicket, firstForWhere; 977 UBool firstForTicket, firstForWhere;
978 knownList = udbg_knownIssue_openU(knownList, ticket, fullpath, msg2.getTermina tedBuffer(), &firstForTicket, &firstForWhere); 978 knownList = udbg_knownIssue_openU(knownList, ticket, fullpath, msg2.getTermina tedBuffer(), &firstForTicket, &firstForWhere);
979 979
980 msg2 = UNICODE_STRING_SIMPLE("(Known issue #") +
981 UnicodeString(ticket, -1, US_INV) + UNICODE_STRING_SIMPLE(") ") + msg;
980 if(firstForTicket || firstForWhere) { 982 if(firstForTicket || firstForWhere) {
981 infoln(UnicodeString("(Known issue #","") + UnicodeString(ticket,"")+ Unicod eString(") \"","") + msg); 983 infoln(msg2);
982 } else { 984 } else {
983 logln(UnicodeString("(Known issue #","") + UnicodeString(ticket,"")+ Unicode String(") \"","") + msg); 985 logln(msg2);
984 } 986 }
985 987
986 return TRUE; 988 return TRUE;
987 } 989 }
988 990
989 /* convenience functions that include sprintf formatting */ 991 /* convenience functions that include sprintf formatting */
990 void IntlTest::info(const char *fmt, ...) 992 void IntlTest::info(const char *fmt, ...)
991 { 993 {
992 char buffer[4000]; 994 char buffer[4000];
993 va_list ap; 995 va_list ap;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 1090 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
1089 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 1091 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
1090 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 1092 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
1091 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 1093 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
1092 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 1094 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
1093 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 1095 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
1094 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 1096 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
1095 }; 1097 };
1096 UnicodeString indent(FALSE, indentUChars, 1 + LL_indentlevel); 1098 UnicodeString indent(FALSE, indentUChars, 1 + LL_indentlevel);
1097 1099
1098 char buffer[10000]; 1100 char buffer[30000];
1099 int32_t length; 1101 int32_t length;
1100 1102
1101 // stream out the indentation string first if necessary 1103 // stream out the indentation string first if necessary
1102 length = indent.extract(1, indent.length(), buffer, sizeof(buffer)); 1104 length = indent.extract(1, indent.length(), buffer, sizeof(buffer));
1103 if (length > 0) { 1105 if (length > 0) {
1104 fwrite(buffer, sizeof(*buffer), length, (FILE *)testoutfp); 1106 fwrite(buffer, sizeof(*buffer), length, (FILE *)testoutfp);
1105 } 1107 }
1106 1108
1107 // replace each LineFeed by the indentation string 1109 // replace each LineFeed by the indentation string
1108 message.findAndReplace(UnicodeString((UChar)'\n'), indent); 1110 message.findAndReplace(UnicodeString((UChar)'\n'), indent);
1109 1111
1110 // stream out the message 1112 // stream out the message
1111 length = message.extract(0, message.length(), buffer, sizeof(buffer)); 1113 length = message.extract(0, message.length(), buffer, sizeof(buffer));
1112 if (length > 0) { 1114 if (length > 0) {
1113 length = length > 10000 ? 10000 : length; 1115 length = length > 30000 ? 30000 : length;
1114 fwrite(buffer, sizeof(*buffer), length, (FILE *)testoutfp); 1116 fwrite(buffer, sizeof(*buffer), length, (FILE *)testoutfp);
1115 } 1117 }
1116 1118
1117 if (newline) { 1119 if (newline) {
1118 char newLine = '\n'; 1120 char newLine = '\n';
1119 fwrite(&newLine, sizeof(newLine), 1, (FILE *)testoutfp); 1121 fwrite(&newLine, sizeof(newLine), 1, (FILE *)testoutfp);
1120 } 1122 }
1121 1123
1122 // A newline usually flushes the buffer, but 1124 // A newline usually flushes the buffer, but
1123 // flush the message just in case of a core dump. 1125 // flush the message just in case of a core dump.
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 fclose(f); 1601 fclose(f);
1600 } 1602 }
1601 else { 1603 else {
1602 /* We're in icu/source/test/intltest/Platform/(Debug|Release) */ 1604 /* We're in icu/source/test/intltest/Platform/(Debug|Release) */
1603 srcDataDir = ".." U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".." U_FILE_S EP_STRING ".." U_FILE_SEP_STRING "test" U_FILE_SEP_STRING "testdata"U_FILE_SEP_S TRING; 1605 srcDataDir = ".." U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".." U_FILE_S EP_STRING ".." U_FILE_SEP_STRING "test" U_FILE_SEP_STRING "testdata"U_FILE_SEP_S TRING;
1604 } 1606 }
1605 #endif 1607 #endif
1606 return srcDataDir; 1608 return srcDataDir;
1607 } 1609 }
1608 1610
1611 char *IntlTest::getUnidataPath(char path[]) {
1612 const int kUnicodeDataTxtLength = 15; // strlen("UnicodeData.txt")
1613
1614 // Look inside ICU_DATA first.
1615 strcpy(path, pathToDataDirectory());
1616 strcat(path, "unidata" U_FILE_SEP_STRING "UnicodeData.txt");
1617 FILE *f = fopen(path, "r");
1618 if(f != NULL) {
1619 fclose(f);
1620 *(strchr(path, 0) - kUnicodeDataTxtLength) = 0; // Remove the basename.
1621 return path;
1622 }
1623
1624 // As a fallback, try to guess where the source data was located
1625 // at the time ICU was built, and look there.
1626 # ifdef U_TOPSRCDIR
1627 strcpy(path, U_TOPSRCDIR U_FILE_SEP_STRING "data");
1628 # else
1629 UErrorCode errorCode = U_ZERO_ERROR;
1630 const char *testDataPath = loadTestData(errorCode);
1631 if(U_FAILURE(errorCode)) {
1632 it_errln(UnicodeString(
1633 "unable to find path to source/data/unidata/ and loadTes tData() failed: ") +
1634 u_errorName(errorCode));
1635 return NULL;
1636 }
1637 strcpy(path, testDataPath);
1638 strcat(path, U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".."
1639 U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".."
1640 U_FILE_SEP_STRING "data");
1641 # endif
1642 strcat(path, U_FILE_SEP_STRING);
1643 strcat(path, "unidata" U_FILE_SEP_STRING "UnicodeData.txt");
1644 f = fopen(path, "r");
1645 if(f != NULL) {
1646 fclose(f);
1647 *(strchr(path, 0) - kUnicodeDataTxtLength) = 0; // Remove the basename.
1648 return path;
1649 }
1650 return NULL;
1651 }
1652
1609 const char* IntlTest::fgDataDir = NULL; 1653 const char* IntlTest::fgDataDir = NULL;
1610 1654
1611 /* returns the path to icu/source/data */ 1655 /* returns the path to icu/source/data */
1612 const char * IntlTest::pathToDataDirectory() 1656 const char * IntlTest::pathToDataDirectory()
1613 { 1657 {
1614 1658
1615 if(fgDataDir != NULL) { 1659 if(fgDataDir != NULL) {
1616 return fgDataDir; 1660 return fgDataDir;
1617 } 1661 }
1618 1662
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
2004 } 2048 }
2005 2049
2006 /* 2050 /*
2007 * Hey, Emacs, please set the following: 2051 * Hey, Emacs, please set the following:
2008 * 2052 *
2009 * Local Variables: 2053 * Local Variables:
2010 * indent-tabs-mode: nil 2054 * indent-tabs-mode: nil
2011 * End: 2055 * End:
2012 * 2056 *
2013 */ 2057 */
OLDNEW
« no previous file with comments | « source/test/intltest/intltest.h ('k') | source/test/intltest/intltest.vcxproj » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698