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

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

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/cintltst/cmsgtst.c ('k') | source/test/cintltst/cnormtst.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-2013, International Business Machines Corporation 3 * Copyright (c) 1997-2014, International Business Machines Corporation
4 * and others. All Rights Reserved. 4 * and others. All Rights Reserved.
5 ********************************************************************/ 5 ********************************************************************/
6 /******************************************************************************* 6 /*******************************************************************************
7 * 7 *
8 * File CNMDPTST.C 8 * File CNMDPTST.C
9 * 9 *
10 * Madhu Katragadda Creation 10 * Madhu Katragadda Creation
11 * Modification History: 11 * Modification History:
12 * 12 *
13 * Date Name Description 13 * Date Name Description
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 */ 409 */
410 static void TestCurrency(void) 410 static void TestCurrency(void)
411 { 411 {
412 UNumberFormat *currencyFmt; 412 UNumberFormat *currencyFmt;
413 UChar *str; 413 UChar *str;
414 int32_t lneed, i; 414 int32_t lneed, i;
415 UFieldPosition pos; 415 UFieldPosition pos;
416 UChar res[100]; 416 UChar res[100];
417 UErrorCode status = U_ZERO_ERROR; 417 UErrorCode status = U_ZERO_ERROR;
418 const char* locale[]={"fr_CA", "de_DE_PREEURO", "fr_FR_PREEURO"}; 418 const char* locale[]={"fr_CA", "de_DE_PREEURO", "fr_FR_PREEURO"};
419 const char* result[]={"1,50\\u00a0$", "1,50\\u00a0DEM", "1,50\\u00a0F"}; 419 const char* result[]={"1,50\\u00a0$", "1,50\\u00a0DM", "1,50\\u00a0F"};
420 log_verbose("\nTesting the number format with different currency patterns\n" ); 420 log_verbose("\nTesting the number format with different currency patterns\n" );
421 for(i=0; i < 3; i++) 421 for(i=0; i < 3; i++)
422 { 422 {
423 str=NULL; 423 str=NULL;
424 currencyFmt = unum_open(UNUM_CURRENCY, NULL,0,locale[i],NULL, &status); 424 currencyFmt = unum_open(UNUM_CURRENCY, NULL,0,locale[i],NULL, &status);
425 425
426 if(U_FAILURE(status)){ 426 if(U_FAILURE(status)){
427 log_data_err("Error in the construction of number format with style currency: %s (Are you missing data?)\n", 427 log_data_err("Error in the construction of number format with style currency: %s (Are you missing data?)\n",
428 myErrorName(status)); 428 myErrorName(status));
429 } else { 429 } else {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 UErrorCode status = U_ZERO_ERROR; 463 UErrorCode status = U_ZERO_ERROR;
464 464
465 const char* locale[]={ 465 const char* locale[]={
466 "ca_ES_PREEURO", "de_LU_PREEURO", "en_IE_PREEURO", "fi_FI _PREEURO", "fr_LU_PREEURO", "it_IT_PREEURO", 466 "ca_ES_PREEURO", "de_LU_PREEURO", "en_IE_PREEURO", "fi_FI _PREEURO", "fr_LU_PREEURO", "it_IT_PREEURO",
467 "pt_PT_PREEURO", "de_AT_PREEURO", "el_GR_PREEURO", "es_ES _PREEURO", "fr_BE_PREEURO", "ga_IE_PREEURO", 467 "pt_PT_PREEURO", "de_AT_PREEURO", "el_GR_PREEURO", "es_ES _PREEURO", "fr_BE_PREEURO", "ga_IE_PREEURO",
468 "nl_BE_PREEURO", "de_DE_PREEURO", "en_BE_PREEURO", "eu_ES _PREEURO", "fr_FR_PREEURO", "gl_ES_PREEURO", 468 "nl_BE_PREEURO", "de_DE_PREEURO", "en_BE_PREEURO", "eu_ES _PREEURO", "fr_FR_PREEURO", "gl_ES_PREEURO",
469 "nl_NL_PREEURO", 469 "nl_NL_PREEURO",
470 }; 470 };
471 471
472 const char* result[]={ 472 const char* result[]={
473 "\\u20A7\\u00A02", "2\\u00A0F", "IEP1.50", "1,50\\u00A0FIM", "2\\u00A0F", "ITL\\u00A02", 473 "\\u20A7\\u00A02", "2\\u00A0F", "IEP1.50", "1,50\\u00A0mk", "2\\u00A0F", "ITL\\u00A02",
474 "1$50\\u00A0Esc.", "\\u00F6S\\u00A01,50", "1,50\\u00A0\\u0394\\u03C1\\u 03C7", "2\\u00A0\\u20A7", "1,50\\u00A0FB", "IEP1.50", 474 "1$50\\u00A0\\u200B", "\\u00F6S\\u00A01,50", "1,50\\u00A0\\u0394\\u03C1 \\u03C7", "2\\u00A0\\u20A7", "1,50\\u00A0FB", "IEP1.50",
475 "1,50\\u00A0BEF", "1,50\\u00A0DEM", "1,50\\u00A0BEF", "\\u20A7\\u00A02", "1,50\\u00A0F", "2\\u00A0\\u20A7", 475 "1,50\\u00A0BEF", "1,50\\u00A0DM", "1,50\\u00A0BEF", "\\u20A7\\u00A02", "1,50\\u00A0F", "2\\u00A0\\u20A7",
476 "NLG\\u00A01,50" 476 "NLG\\u00A01,50"
477 }; 477 };
478 478
479 log_verbose("\nTesting the number format with different currency patterns\n" ); 479 log_verbose("\nTesting the number format with different currency patterns\n" );
480 for(i=0; i < 19; i++) 480 for(i=0; i < 19; i++)
481 { 481 {
482 char curID[256] = {0}; 482 char curID[256] = {0};
483 uloc_canonicalize(locale[i], curID, 256, &status); 483 uloc_canonicalize(locale[i], curID, 256, &status);
484 if(U_FAILURE(status)){ 484 if(U_FAILURE(status)){
485 log_data_err("Could not canonicalize %s. Error: %s (Are you missing data?)\n", locale[i], u_errorName(status)); 485 log_data_err("Could not canonicalize %s. Error: %s (Are you missing data?)\n", locale[i], u_errorName(status));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 "fr_FR", 537 "fr_FR",
538 }; 538 };
539 539
540 const char* currency[]={ 540 const char* currency[]={
541 "", 541 "",
542 "JPY", 542 "JPY",
543 }; 543 };
544 544
545 const char* result[]={ 545 const char* result[]={
546 "1\\u00A0234,56\\u00A0\\u20AC", 546 "1\\u00A0234,56\\u00A0\\u20AC",
547 "1\\u00A0235\\u00A0\\u00A5JP", 547 "1\\u00A0235\\u00A0JPY",
548 }; 548 };
549 549
550 log_verbose("\nTesting the number format with different currency codes\n"); 550 log_verbose("\nTesting the number format with different currency codes\n");
551 for(i=0; i < 2; i++) 551 for(i=0; i < 2; i++)
552 { 552 {
553 char cStr[20]={0}; 553 char cStr[20]={0};
554 UChar isoCode[16]={0}; 554 UChar isoCode[16]={0};
555 currencyFmt = unum_open(UNUM_CURRENCY, NULL,0,locale[i],NULL, &status); 555 currencyFmt = unum_open(UNUM_CURRENCY, NULL,0,locale[i],NULL, &status);
556 if(U_FAILURE(status)){ 556 if(U_FAILURE(status)){
557 log_data_err("Error in the construction of number format with style currency: %s (Are you missing data?)\n", 557 log_data_err("Error in the construction of number format with style currency: %s (Are you missing data?)\n",
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 } 864 }
865 } 865 }
866 866
867 } 867 }
868 } 868 }
869 869
870 static void TestGetKeywordValuesForLocale(void) { 870 static void TestGetKeywordValuesForLocale(void) {
871 #define PREFERRED_SIZE 12 871 #define PREFERRED_SIZE 12
872 #define MAX_NUMBER_OF_KEYWORDS 4 872 #define MAX_NUMBER_OF_KEYWORDS 4
873 const char *PREFERRED[PREFERRED_SIZE][MAX_NUMBER_OF_KEYWORDS] = { 873 const char *PREFERRED[PREFERRED_SIZE][MAX_NUMBER_OF_KEYWORDS] = {
874 { "root", "USD", "USN", "USS" }, 874 { "root", "USD", "USN", NULL },
875 { "und", "USD", "USN", "USS" }, 875 { "und", "USD", "USN", NULL },
876 /* { "und_ZZ", "USD", NULL, NULL }, -- temporaary remove as this locale now has 15 entries */ 876 /* { "und_ZZ", "USD", NULL, NULL }, -- temporarily remov e as this locale now has 15 entries */
877 { "en_US", "USD", "USN", "USS" }, 877 { "en_US", "USD", "USN", NULL },
878 { "en_029", "USD", "USN", "USS" }, 878 { "en_029", "USD", "USN", NULL },
879 { "en_TH", "THB", NULL, NULL }, 879 { "en_TH", "THB", NULL, NULL },
880 { "de", "EUR", NULL, NULL }, 880 { "de", "EUR", NULL, NULL },
881 { "de_DE", "EUR", NULL, NULL }, 881 { "de_DE", "EUR", NULL, NULL },
882 { "ar", "EGP", NULL, NULL }, 882 { "ar", "EGP", NULL, NULL },
883 { "ar_PS", "ILS", "JOD", NULL }, 883 { "ar_PS", "ILS", "JOD", NULL },
884 { "en@currency=CAD", "USD", "USN", "USS" }, 884 { "en@currency=CAD", "USD", "USN", NULL },
885 { "fr@currency=zzz", "EUR", NULL, NULL }, 885 { "fr@currency=zzz", "EUR", NULL, NULL },
886 { "de_DE@currency=DEM", "EUR", NULL, NULL }, 886 { "de_DE@currency=DEM", "EUR", NULL, NULL },
887 }; 887 };
888 const int32_t EXPECTED_SIZE[PREFERRED_SIZE] = { 888 const int32_t EXPECTED_SIZE[PREFERRED_SIZE] = {
889 3, 3, 3, 3, 1, 1, 1, 1, 2, 3, 1, 1 889 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1
890 }; 890 };
891 UErrorCode status = U_ZERO_ERROR; 891 UErrorCode status = U_ZERO_ERROR;
892 int32_t i, j, size; 892 int32_t i, j, size;
893 UEnumeration *pref, *all; 893 UEnumeration *pref, *all;
894 const char *loc = NULL; 894 const char *loc = NULL;
895 UBool matchPref, matchAll; 895 UBool matchPref, matchAll;
896 const char *value = NULL; 896 const char *value = NULL;
897 int32_t valueLength = 0; 897 int32_t valueLength = 0;
898 898
899 UList *ALLList = NULL; 899 UList *ALLList = NULL;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 u_uastrcpy(res, expected); 1058 u_uastrcpy(res, expected);
1059 if (u_strcmp(out, res) != 0) 1059 if (u_strcmp(out, res) != 0)
1060 log_err("FAIL: Expected: \"%s\" Got: \"%s\"\n", expected, austrdup(out) ); 1060 log_err("FAIL: Expected: \"%s\" Got: \"%s\"\n", expected, austrdup(out) );
1061 free(res); 1061 free(res);
1062 if(out != NULL) { 1062 if(out != NULL) {
1063 free(out); 1063 free(out);
1064 } 1064 }
1065 } 1065 }
1066 1066
1067 #endif /* #if !UCONFIG_NO_FORMATTING */ 1067 #endif /* #if !UCONFIG_NO_FORMATTING */
OLDNEW
« no previous file with comments | « source/test/cintltst/cmsgtst.c ('k') | source/test/cintltst/cnormtst.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698