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

Side by Side Diff: source/test/intltest/bidiconf.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/astrotst.cpp ('k') | source/test/intltest/bytestrietest.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 * 3 *
4 * Copyright (C) 2009-2013, International Business Machines 4 * Copyright (C) 2009-2014, International Business Machines
5 * Corporation and others. All Rights Reserved. 5 * Corporation and others. All Rights Reserved.
6 * 6 *
7 ******************************************************************************* 7 *******************************************************************************
8 * file name: bidiconf.cpp 8 * file name: bidiconf.cpp
9 * encoding: US-ASCII 9 * encoding: US-ASCII
10 * tab size: 8 (not used) 10 * tab size: 8 (not used)
11 * indentation:4 11 * indentation:4
12 * 12 *
13 * created on: 2009oct16 13 * created on: 2009oct16
14 * created by: Markus W. Scherer 14 * created by: Markus W. Scherer
(...skipping 17 matching lines...) Expand all
32 public: 32 public:
33 BiDiConformanceTest() : 33 BiDiConformanceTest() :
34 directionBits(0), lineNumber(0), levelsCount(0), orderingCount(0), 34 directionBits(0), lineNumber(0), levelsCount(0), orderingCount(0),
35 errorCount(0) {} 35 errorCount(0) {}
36 36
37 void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par= NULL); 37 void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par= NULL);
38 38
39 void TestBidiTest(); 39 void TestBidiTest();
40 void TestBidiCharacterTest(); 40 void TestBidiCharacterTest();
41 private: 41 private:
42 char *getUnidataPath(char path[]);
43
44 UBool parseLevels(const char *&start); 42 UBool parseLevels(const char *&start);
45 UBool parseOrdering(const char *start); 43 UBool parseOrdering(const char *start);
46 UBool parseInputStringFromBiDiClasses(const char *&start); 44 UBool parseInputStringFromBiDiClasses(const char *&start);
47 45
48 UBool checkLevels(const UBiDiLevel actualLevels[], int32_t actualCount); 46 UBool checkLevels(const UBiDiLevel actualLevels[], int32_t actualCount);
49 UBool checkOrdering(UBiDi *ubidi); 47 UBool checkOrdering(UBiDi *ubidi);
50 48
51 void printErrorLine(); 49 void printErrorLine();
52 50
53 char line[10000]; 51 char line[10000];
(...skipping 16 matching lines...) Expand all
70 void BiDiConformanceTest::runIndexedTest(int32_t index, UBool exec, const char * &name, char * /*par*/) { 68 void BiDiConformanceTest::runIndexedTest(int32_t index, UBool exec, const char * &name, char * /*par*/) {
71 if(exec) { 69 if(exec) {
72 logln("TestSuite BiDiConformanceTest: "); 70 logln("TestSuite BiDiConformanceTest: ");
73 } 71 }
74 TESTCASE_AUTO_BEGIN; 72 TESTCASE_AUTO_BEGIN;
75 TESTCASE_AUTO(TestBidiTest); 73 TESTCASE_AUTO(TestBidiTest);
76 TESTCASE_AUTO(TestBidiCharacterTest); 74 TESTCASE_AUTO(TestBidiCharacterTest);
77 TESTCASE_AUTO_END; 75 TESTCASE_AUTO_END;
78 } 76 }
79 77
80 // TODO: Move to a common place (IntlTest?) to avoid duplication with UnicodeTes t (ucdtest.cpp).
81 char *BiDiConformanceTest::getUnidataPath(char path[]) {
82 IcuTestErrorCode errorCode(*this, "getUnidataPath");
83 const int kUnicodeDataTxtLength=15; // strlen("UnicodeData.txt")
84
85 // Look inside ICU_DATA first.
86 strcpy(path, pathToDataDirectory());
87 strcat(path, "unidata" U_FILE_SEP_STRING "UnicodeData.txt");
88 FILE *f=fopen(path, "r");
89 if(f!=NULL) {
90 fclose(f);
91 *(strchr(path, 0)-kUnicodeDataTxtLength)=0; // Remove the basename.
92 return path;
93 }
94
95 // As a fallback, try to guess where the source data was located
96 // at the time ICU was built, and look there.
97 # ifdef U_TOPSRCDIR
98 strcpy(path, U_TOPSRCDIR U_FILE_SEP_STRING "data");
99 # else
100 strcpy(path, loadTestData(errorCode));
101 strcat(path, U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".."
102 U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".."
103 U_FILE_SEP_STRING "data");
104 # endif
105 strcat(path, U_FILE_SEP_STRING);
106 strcat(path, "unidata" U_FILE_SEP_STRING "UnicodeData.txt");
107 f=fopen(path, "r");
108 if(f!=NULL) {
109 fclose(f);
110 *(strchr(path, 0)-kUnicodeDataTxtLength)=0; // Remove the basename.
111 return path;
112 }
113 return NULL;
114 }
115
116 U_DEFINE_LOCAL_OPEN_POINTER(LocalStdioFilePointer, FILE, fclose); 78 U_DEFINE_LOCAL_OPEN_POINTER(LocalStdioFilePointer, FILE, fclose);
117 79
118 UBool BiDiConformanceTest::parseLevels(const char *&start) { 80 UBool BiDiConformanceTest::parseLevels(const char *&start) {
119 directionBits=0; 81 directionBits=0;
120 levelsCount=0; 82 levelsCount=0;
121 while(*start!=0 && *(start=u_skipWhitespace(start))!=0 && *start!=';') { 83 while(*start!=0 && *(start=u_skipWhitespace(start))!=0 && *start!=';') {
122 if(*start=='x') { 84 if(*start=='x') {
123 levels[levelsCount++]=UBIDI_DEFAULT_LTR; 85 levels[levelsCount++]=UBIDI_DEFAULT_LTR;
124 ++start; 86 ++start;
125 } else { 87 } else {
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 } 669 }
708 return isOk; 670 return isOk;
709 } 671 }
710 672
711 void BiDiConformanceTest::printErrorLine() { 673 void BiDiConformanceTest::printErrorLine() {
712 ++errorCount; 674 ++errorCount;
713 errln("Input line %5d: %s", (int)lineNumber, line); 675 errln("Input line %5d: %s", (int)lineNumber, line);
714 errln(UnicodeString("Input string: ")+inputString); 676 errln(UnicodeString("Input string: ")+inputString);
715 errln("Para level: %s", paraLevelName); 677 errln("Para level: %s", paraLevelName);
716 } 678 }
OLDNEW
« no previous file with comments | « source/test/intltest/astrotst.cpp ('k') | source/test/intltest/bytestrietest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698