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

Side by Side Diff: source/test/cintltst/cmsgtst.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/cmsccoll.c ('k') | source/test/cintltst/cnmdptst.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 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 * File CMSGTST.C 7 * File CMSGTST.C
8 * 8 *
9 * Modification History: 9 * Modification History:
10 * Name Description 10 * Name Description
11 * Madhu Katragadda Creation 11 * Madhu Katragadda Creation
12 ********************************************************************/ 12 ********************************************************************/
13 /* C API TEST FOR MESSAGE FORMAT */ 13 /* C API TEST FOR MESSAGE FORMAT */
14 14
15 #include "unicode/utypes.h" 15 #include "unicode/utypes.h"
16 16
17 #if !UCONFIG_NO_FORMATTING 17 #if !UCONFIG_NO_FORMATTING
18 18
19 #include <stdlib.h> 19 #include <stdlib.h>
20 #include <string.h> 20 #include <string.h>
21 #include <stdarg.h> 21 #include <stdarg.h>
22 #include "unicode/uloc.h" 22 #include "unicode/uloc.h"
23 #include "unicode/umsg.h" 23 #include "unicode/umsg.h"
24 #include "unicode/udat.h" 24 #include "unicode/udat.h"
25 #include "unicode/umsg.h" 25 #include "unicode/umsg.h"
26 #include "unicode/ustring.h" 26 #include "unicode/ustring.h"
27 #include "cintltst.h" 27 #include "cintltst.h"
28 #include "cmsgtst.h" 28 #include "cmsgtst.h"
29 #include "cformtst.h" 29 #include "cformtst.h"
30 30 #include "cmemory.h"
31 #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
32 31
33 static const char* const txt_testCasePatterns[] = { 32 static const char* const txt_testCasePatterns[] = {
34 "Quotes '', '{', a {0,number,integer} '{'0}", 33 "Quotes '', '{', a {0,number,integer} '{'0}",
35 "Quotes '', '{', a {0,number,integer} '{'0}", 34 "Quotes '', '{', a {0,number,integer} '{'0}",
36 "You deposited {0,number,integer} times an amount of {1,number,currency} on { 2,date,short}", 35 "You deposited {0,number,integer} times an amount of {1,number,currency} on { 2,date,short}",
37 "'{'2,time,full}, for {1, number }, {0,number,integer} is {2,time,full} and full date is {2,date,full}", 36 "'{'2,time,full}, for {1, number }, {0,number,integer} is {2,time,full} and full date is {2,date,full}",
38 "'{'1,number,percent} for {0,number,integer} is {1,number,percent}", 37 "'{'1,number,percent} for {0,number,integer} is {1,number,percent}",
39 }; 38 };
40 39
41 static const char* const txt_testResultStrings[] = { 40 static const char* const txt_testResultStrings[] = {
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 UErrorCode errorCode = U_ZERO_ERROR; 1120 UErrorCode errorCode = U_ZERO_ERROR;
1122 U_STRING_DECL(pattern, "abc {1} def", 11); 1121 U_STRING_DECL(pattern, "abc {1} def", 11);
1123 UChar x[2] = { 0x78, 0 }; // "x" 1122 UChar x[2] = { 0x78, 0 }; // "x"
1124 UChar y[2] = { 0x79, 0 }; // "y" 1123 UChar y[2] = { 0x79, 0 }; // "y"
1125 U_STRING_DECL(expected, "abc y def", 9); 1124 U_STRING_DECL(expected, "abc y def", 9);
1126 UChar result[20]; 1125 UChar result[20];
1127 int32_t length; 1126 int32_t length;
1128 1127
1129 U_STRING_INIT(pattern, "abc {1} def", 11); 1128 U_STRING_INIT(pattern, "abc {1} def", 11);
1130 U_STRING_INIT(expected, "abc y def", 9); 1129 U_STRING_INIT(expected, "abc y def", 9);
1131 length = u_formatMessage("en", pattern, -1, result, LENGTHOF(result), &error Code, x, y); 1130 length = u_formatMessage("en", pattern, -1, result, UPRV_LENGTHOF(result), & errorCode, x, y);
1132 if (U_FAILURE(errorCode) || length != u_strlen(expected) || u_strcmp(result, expected) != 0) { 1131 if (U_FAILURE(errorCode) || length != u_strlen(expected) || u_strcmp(result, expected) != 0) {
1133 log_err("u_formatMessage(pattern with only {1}, 2 args) failed: result l ength %d, UErrorCode %s \n", 1132 log_err("u_formatMessage(pattern with only {1}, 2 args) failed: result l ength %d, UErrorCode %s \n",
1134 (int)length, u_errorName(errorCode)); 1133 (int)length, u_errorName(errorCode));
1135 } 1134 }
1136 } 1135 }
1137 1136
1138 static void TestErrorChaining(void) { 1137 static void TestErrorChaining(void) {
1139 UErrorCode status = U_USELESS_COLLATOR_ERROR; 1138 UErrorCode status = U_USELESS_COLLATOR_ERROR;
1140 1139
1141 umsg_open(NULL, 0, NULL, NULL, &status); 1140 umsg_open(NULL, 0, NULL, NULL, &status);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 addTest(root, &TestMessageFormatWithValist, "tsformat/cmsgtst/TestMessageFor matWithValist"); 1187 addTest(root, &TestMessageFormatWithValist, "tsformat/cmsgtst/TestMessageFor matWithValist");
1189 addTest(root, &TestParseMessageWithValist, "tsformat/cmsgtst/TestParseMessag eWithValist"); 1188 addTest(root, &TestParseMessageWithValist, "tsformat/cmsgtst/TestParseMessag eWithValist");
1190 addTest(root, &TestJ904, "tsformat/cmsgtst/TestJ904"); 1189 addTest(root, &TestJ904, "tsformat/cmsgtst/TestJ904");
1191 addTest(root, &MessageLength, "tsformat/cmsgtst/MessageLength"); 1190 addTest(root, &MessageLength, "tsformat/cmsgtst/MessageLength");
1192 addTest(root, &TestMessageWithUnusedArgNumber, "tsformat/cmsgtst/TestMessage WithUnusedArgNumber"); 1191 addTest(root, &TestMessageWithUnusedArgNumber, "tsformat/cmsgtst/TestMessage WithUnusedArgNumber");
1193 addTest(root, &TestErrorChaining, "tsformat/cmsgtst/TestErrorChaining"); 1192 addTest(root, &TestErrorChaining, "tsformat/cmsgtst/TestErrorChaining");
1194 addTest(root, &TestMsgFormatSelect, "tsformat/cmsgtst/TestMsgFormatSelect"); 1193 addTest(root, &TestMsgFormatSelect, "tsformat/cmsgtst/TestMsgFormatSelect");
1195 } 1194 }
1196 1195
1197 #endif /* #if !UCONFIG_NO_FORMATTING */ 1196 #endif /* #if !UCONFIG_NO_FORMATTING */
OLDNEW
« no previous file with comments | « source/test/cintltst/cmsccoll.c ('k') | source/test/cintltst/cnmdptst.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698