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

Side by Side Diff: source/test/cintltst/creststn.c

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/cintltst/cnumtst.c ('k') | source/test/cintltst/cstrcase.c » ('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-2014, International Business Machines Corporation and 3 * Copyright (c) 1997-2015, International Business Machines Corporation and
4 * others. All Rights Reserved. 4 * others. All Rights Reserved.
5 ********************************************************************/ 5 ********************************************************************/
6 /******************************************************************************* 6 /*******************************************************************************
7 * 7 *
8 * File creststn.c 8 * File creststn.c
9 * 9 *
10 * Modification History: 10 * Modification History:
11 * Name Date Description 11 * Name Date Description
12 * Madhu Katragadda 05/09/2000 Ported Tests for New ResourceBundle API 12 * Madhu Katragadda 05/09/2000 Ported Tests for New ResourceBundle API
13 * Madhu Katragadda 05/24/2000 Added new tests to test RES_BINARY for coll ationElements 13 * Madhu Katragadda 05/24/2000 Added new tests to test RES_BINARY for coll ationElements
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 264
265 /* this bundle should return zero error, so it shouldn't change the status */ 265 /* this bundle should return zero error, so it shouldn't change the status */
266 status = U_USING_DEFAULT_WARNING; 266 status = U_USING_DEFAULT_WARNING;
267 r = ures_open(NULL, "ti_ER", &status); 267 r = ures_open(NULL, "ti_ER", &status);
268 checkStatus(__LINE__, U_USING_DEFAULT_WARNING, status); 268 checkStatus(__LINE__, U_USING_DEFAULT_WARNING, status);
269 269
270 /* we look up the resource which is aliased, but it lives in fallback */ 270 /* we look up the resource which is aliased, but it lives in fallback */
271 271
272 if(U_SUCCESS(status) && r != NULL) { 272 if(U_SUCCESS(status) && r != NULL) {
273 status = U_USING_DEFAULT_WARNING; 273 status = U_USING_DEFAULT_WARNING;
274 r2 = ures_getByKey(r, "LocaleScript", NULL, &status); /* LocaleScript lives in ti */ 274 r2 = ures_getByKey(r, "ExemplarCharacters", NULL, &status); /* ExemplarChar acters lives in ti */
275 checkStatus(__LINE__, U_USING_FALLBACK_WARNING, status); 275 checkStatus(__LINE__, U_USING_FALLBACK_WARNING, status);
276 } 276 }
277 ures_close(r); 277 ures_close(r);
278 278
279 /* this bundle should return zero error, so it shouldn't change the status */ 279 /* this bundle should return zero error, so it shouldn't change the status */
280 status = U_USING_DEFAULT_WARNING; 280 status = U_USING_DEFAULT_WARNING;
281 r = ures_open(U_ICUDATA_REGION, "ti", &status); 281 r = ures_open(U_ICUDATA_REGION, "ti", &status);
282 checkStatus(__LINE__, U_USING_DEFAULT_WARNING, status); 282 checkStatus(__LINE__, U_USING_DEFAULT_WARNING, status);
283 ures_close(r); 283 ures_close(r);
284 284
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 0x093E,0x0020,0x002E,0x0033,0x0939,0x092E,0x0020,0x002E,0x0033,0x0907,0x 0938,0x0915,0x093E,0x0020,0x002E,0x0033, 417 0x093E,0x0020,0x002E,0x0033,0x0939,0x092E,0x0020,0x002E,0x0033,0x0907,0x 0938,0x0915,0x093E,0x0020,0x002E,0x0033,
418 0x092F,0x0941,0x0915,0x094D,0x0924,0x093F,0x092A,0x0942,0x0930,0x094D,0x 0923,0x0020,0x002E,0x0032,0x0935,0x093F, 418 0x092F,0x0941,0x0915,0x094D,0x0924,0x093F,0x092A,0x0942,0x0930,0x094D,0x 0923,0x0020,0x002E,0x0032,0x0935,0x093F,
419 0x0938,0x094D,0x0924,0x093E,0x0930,0x0020,0x0905,0x092A,0x0947,0x0915,0x 094D,0x0937,0x093F,0x0924,0x0020,0x0915, 419 0x0938,0x094D,0x0924,0x093E,0x0930,0x0020,0x0905,0x092A,0x0947,0x0915,0x 094D,0x0937,0x093F,0x0924,0x0020,0x0915,
420 0x0930,0x0020,0x0938,0x0915,0x0947,0x0902,0x0917,0x0947,0x0020,0x003F,0x 0020, 420 0x0930,0x0020,0x0938,0x0915,0x0947,0x0902,0x0917,0x0947,0x0020,0x003F,0x 0020,
421 0 421 0
422 }; 422 };
423 423
424 /* pre-flight */ 424 /* pre-flight */
425 int32_t num =0; 425 int32_t num =0;
426 const char *testdatapath = loadTestData(&error); 426 const char *testdatapath = loadTestData(&error);
427 resB = ures_open(testdatapath, "iscii", &error); 427 resB = ures_open(testdatapath, "encoded", &error);
428 srcFromRes=tres_getString(resB,-1,"str",&len,&error); 428 srcFromRes=tres_getString(resB,-1,"str",&len,&error);
429 if(U_FAILURE(error)){ 429 if(U_FAILURE(error)){
430 #if UCONFIG_NO_LEGACY_CONVERSION 430 log_data_err("Could not find encoded.res from test data bundle. Error: % s\n", u_errorName(error));
431 log_info("Couldn't load iscii.bin from test data bundle, (because UCONFI G_NO_LEGACY_CONVERSION is turned on)\n");
432 #else
433 log_data_err("Could not find iscii.bin from test data bundle. Error: %s\ n", u_errorName(error));
434 #endif
435 ures_close(resB); 431 ures_close(resB);
436 return; 432 return;
437 } 433 }
438 if(u_strncmp(srcFromRes,uSrc,len)!=0){ 434 if(u_strncmp(srcFromRes,uSrc,len)!=0){
439 log_err("Genrb produced res files after decoding failed\n"); 435 log_err("Genrb produced res files after decoding failed\n");
440 } 436 }
441 while(num<len){ 437 while(num<len){
442 if(uSrc[num]!=srcFromRes[num]){ 438 if(uSrc[num]!=srcFromRes[num]){
443 log_verbose(" Expected: 0x%04X Got: 0x%04X \n", uSrc[num],srcFromRe s[num]); 439 log_verbose(" Expected: 0x%04X Got: 0x%04X \n", uSrc[num],srcFromRe s[num]);
444 } 440 }
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after
2121 ures_close(fr_FR); 2117 ures_close(fr_FR);
2122 /* Temporary hack err actually should be U_USING_FALLBACK_ERROR */ 2118 /* Temporary hack err actually should be U_USING_FALLBACK_ERROR */
2123 /* Test Jitterbug 552 fallback mechanism of aliased data */ 2119 /* Test Jitterbug 552 fallback mechanism of aliased data */
2124 { 2120 {
2125 UErrorCode err =U_ZERO_ERROR; 2121 UErrorCode err =U_ZERO_ERROR;
2126 UResourceBundle* myResB = ures_open(NULL,"no_NO_NY",&err); 2122 UResourceBundle* myResB = ures_open(NULL,"no_NO_NY",&err);
2127 UResourceBundle* resLocID = ures_getByKey(myResB, "Version", NULL, &err) ; 2123 UResourceBundle* resLocID = ures_getByKey(myResB, "Version", NULL, &err) ;
2128 UResourceBundle* tResB; 2124 UResourceBundle* tResB;
2129 UResourceBundle* zoneResource; 2125 UResourceBundle* zoneResource;
2130 const UChar* version = NULL; 2126 const UChar* version = NULL;
2131 static const UChar versionStr[] = { 0x0032, 0x002E, 0x0031, 0x002E, 0x00 36, 0x002E, 0x0036, 0x0039, 0x0000}; // 2.1.6.69 2127 static const UChar versionStr[] = { 0x0032, 0x002E, 0x0031, 0x002E, 0x00 31, 0x0039, 0x002E, 0x0031, 0x0034, 0x0000}; // 2.1.19.14
2132 2128
2133 if(err != U_ZERO_ERROR){ 2129 if(err != U_ZERO_ERROR){
2134 log_data_err("Expected U_ZERO_ERROR when trying to test no_NO_NY ali ased to nn_NO for Version err=%s\n",u_errorName(err)); 2130 log_data_err("Expected U_ZERO_ERROR when trying to test no_NO_NY ali ased to nn_NO for Version err=%s\n",u_errorName(err));
2135 return; 2131 return;
2136 } 2132 }
2137 version = tres_getString(resLocID, -1, NULL, &resultLen, &err); 2133 version = tres_getString(resLocID, -1, NULL, &resultLen, &err);
2138 if(u_strcmp(version, versionStr) != 0){ 2134 if(u_strcmp(version, versionStr) != 0){
2139 char x[100]; 2135 char x[100];
2140 char g[100]; 2136 char g[100];
2141 u_austrcpy(x, versionStr); 2137 u_austrcpy(x, versionStr);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2206 log_data_err("err loading tb resource\n"); 2202 log_data_err("err loading tb resource\n");
2207 } else { 2203 } else {
2208 /* testing aliasing to a non existing resource */ 2204 /* testing aliasing to a non existing resource */
2209 tb = ures_getByKey(aliasB, "nonexisting", tb, &status); 2205 tb = ures_getByKey(aliasB, "nonexisting", tb, &status);
2210 if(status != U_MISSING_RESOURCE_ERROR) { 2206 if(status != U_MISSING_RESOURCE_ERROR) {
2211 log_err("Managed to find an alias to non-existing resource\n"); 2207 log_err("Managed to find an alias to non-existing resource\n");
2212 } else { 2208 } else {
2213 status = U_ZERO_ERROR; 2209 status = U_ZERO_ERROR;
2214 } 2210 }
2215 /* testing referencing/composed alias */ 2211 /* testing referencing/composed alias */
2216 uk = ures_findResource("ja/LocaleScript/2", uk, &status); 2212 uk = ures_findResource("ja/calendar/gregorian/DateTimePatterns/2", uk, &st atus);
2217 if((uk == NULL) || U_FAILURE(status)) { 2213 if((uk == NULL) || U_FAILURE(status)) {
2218 log_err_status(status, "Couldn't findResource('ja/LocaleScript/2') err % s\n", u_errorName(status)); 2214 log_err_status(status, "Couldn't findResource('ja/calendar/gregorian/Dat eTimePatterns/2') err %s\n", u_errorName(status));
2219 goto cleanup; 2215 goto cleanup;
2220 } 2216 }
2221 2217
2222 sequence = tres_getString(uk, -1, NULL, &seqLen, &status); 2218 sequence = tres_getString(uk, -1, NULL, &seqLen, &status);
2223 2219
2224 tb = ures_getByKey(aliasB, "referencingalias", tb, &status); 2220 tb = ures_getByKey(aliasB, "referencingalias", tb, &status);
2225 string = tres_getString(tb, -1, NULL, &strLen, &status); 2221 string = tres_getString(tb, -1, NULL, &strLen, &status);
2226 2222
2227 if(seqLen != strLen || u_strncmp(sequence, string, seqLen) != 0) { 2223 if(seqLen != strLen || u_strncmp(sequence, string, seqLen) != 0) {
2228 log_err("Referencing alias didn't get the right string (1)\n"); 2224 log_err("Referencing alias didn't get the right string (1)\n");
2229 } 2225 }
2230 2226
2231 string = tres_getString(aliasB, -1, "referencingalias", &strLen, &status); 2227 string = tres_getString(aliasB, -1, "referencingalias", &strLen, &status);
2232 if(seqLen != strLen || u_strncmp(sequence, string, seqLen) != 0) { 2228 if(seqLen != strLen || u_strncmp(sequence, string, seqLen) != 0) {
2233 log_err("Referencing alias didn't get the right string (2)\n"); 2229 log_err("Referencing alias didn't get the right string (2)\n");
2234 } 2230 }
2235 2231
2236 checkStatus(__LINE__, U_ZERO_ERROR, status); 2232 checkStatus(__LINE__, U_ZERO_ERROR, status);
2237 tb = ures_getByKey(aliasB, "LocaleScript", tb, &status); 2233 tb = ures_getByKey(aliasB, "DateTimePatterns", tb, &status);
2238 checkStatus(__LINE__, U_ZERO_ERROR, status); 2234 checkStatus(__LINE__, U_ZERO_ERROR, status);
2239 tb = ures_getByIndex(tb, 2, tb, &status); 2235 tb = ures_getByIndex(tb, 2, tb, &status);
2240 checkStatus(__LINE__, U_ZERO_ERROR, status); 2236 checkStatus(__LINE__, U_ZERO_ERROR, status);
2241 string = tres_getString(tb, -1, NULL, &strLen, &status); 2237 string = tres_getString(tb, -1, NULL, &strLen, &status);
2242 checkStatus(__LINE__, U_ZERO_ERROR, status); 2238 checkStatus(__LINE__, U_ZERO_ERROR, status);
2243 2239
2244 if(U_FAILURE(status)) { 2240 if(U_FAILURE(status)) {
2245 log_err("%s trying to get string via separate getters\n", u_errorName(st atus)); 2241 log_err("%s trying to get string via separate getters\n", u_errorName(st atus));
2246 } else if(seqLen != strLen || u_strncmp(sequence, string, seqLen) != 0) { 2242 } else if(seqLen != strLen || u_strncmp(sequence, string, seqLen) != 0) {
2247 log_err("Referencing alias didn't get the right string (3)\n"); 2243 log_err("Referencing alias didn't get the right string (3)\n");
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2403 if(U_FAILURE(status)) { 2399 if(U_FAILURE(status)) {
2404 log_data_err("Couldn't access indexed resource, error %s\n", u_errorName (status)); 2400 log_data_err("Couldn't access indexed resource, error %s\n", u_errorName (status));
2405 status = U_ZERO_ERROR; 2401 status = U_ZERO_ERROR;
2406 } else { 2402 } else {
2407 key = ures_getKey(t); 2403 key = ures_getKey(t);
2408 if(key != NULL) { 2404 if(key != NULL) {
2409 log_err("Got a strange key, expected NULL, got %s\n", key); 2405 log_err("Got a strange key, expected NULL, got %s\n", key);
2410 } 2406 }
2411 } 2407 }
2412 2408
2413 t = ures_findResource("ja/LocaleScript", t, &status); 2409 t = ures_findResource("ja/ExemplarCharacters", t, &status);
2414 if(U_FAILURE(status)) { 2410 if(U_FAILURE(status)) {
2415 log_data_err("Couldn't access keyed resource, error %s\n", u_errorName(s tatus)); 2411 log_data_err("Couldn't access keyed resource, error %s\n", u_errorName(s tatus));
2416 status = U_ZERO_ERROR; 2412 status = U_ZERO_ERROR;
2417 } else { 2413 } else {
2418 key = ures_getKey(t); 2414 key = ures_getKey(t);
2419 if(strcmp(key, "LocaleScript")!=0) { 2415 if(strcmp(key, "ExemplarCharacters")!=0) {
2420 log_err("Got a strange key, expected 'LocaleScript', got %s\n", key) ; 2416 log_err("Got a strange key, expected 'ExemplarCharacters', got %s\n" , key);
2421 } 2417 }
2422 } 2418 }
2423 2419
2424 t2 = ures_open(U_ICUDATA_LANG, "sr", &status); 2420 t2 = ures_open(U_ICUDATA_LANG, "sr", &status);
2425 if(U_FAILURE(status)) { 2421 if(U_FAILURE(status)) {
2426 log_err_status(status, "Couldn't open 'sr' resource bundle, error %s\n", u_errorName(status)); 2422 log_err_status(status, "Couldn't open 'sr' resource bundle, error %s\n", u_errorName(status));
2427 log_data_err("No 'sr', no test - you have bigger problems than testing d irect access. " 2423 log_data_err("No 'sr', no test - you have bigger problems than testing d irect access. "
2428 "You probably have no data! Aborting this test\n"); 2424 "You probably have no data! Aborting this test\n");
2429 } 2425 }
2430 2426
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
3085 } 3081 }
3086 u_versionToString(testCurrent,tmp); 3082 u_versionToString(testCurrent,tmp);
3087 log_verbose("(data) CurrentCLDRVersion { %s }\n", tmp); 3083 log_verbose("(data) CurrentCLDRVersion { %s }\n", tmp);
3088 switch(memcmp(cldrVersion, testCurrent, sizeof(UVersionInfo))) { 3084 switch(memcmp(cldrVersion, testCurrent, sizeof(UVersionInfo))) {
3089 case 0: break; /* OK- current. */ 3085 case 0: break; /* OK- current. */
3090 case -1: log_info("CLDR version is behind 'current' (for testdata/root.txt) %s. Some things may fail.\n", tmp); break; 3086 case -1: log_info("CLDR version is behind 'current' (for testdata/root.txt) %s. Some things may fail.\n", tmp); break;
3091 case 1: log_info("CLDR version is ahead of 'current' (for testdata/root.txt) %s. Some things may fail.\n", tmp); break; 3087 case 1: log_info("CLDR version is ahead of 'current' (for testdata/root.txt) %s. Some things may fail.\n", tmp); break;
3092 } 3088 }
3093 3089
3094 } 3090 }
OLDNEW
« no previous file with comments | « source/test/cintltst/cnumtst.c ('k') | source/test/cintltst/cstrcase.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698