OLD | NEW |
1 /******************************************************************** | 1 /******************************************************************** |
2 * COPYRIGHT: | 2 * COPYRIGHT: |
3 * Copyright (c) 2008-2013, International Business Machines Corporation and | 3 * Copyright (c) 2008-2014, International Business Machines Corporation and |
4 * others. All Rights Reserved. | 4 * others. All Rights Reserved. |
5 ********************************************************************/ | 5 ********************************************************************/ |
6 | 6 |
7 #include "unicode/utypes.h" | 7 #include "unicode/utypes.h" |
8 | 8 |
9 #if !UCONFIG_NO_FORMATTING | 9 #if !UCONFIG_NO_FORMATTING |
10 | 10 |
11 #include <stdio.h> | 11 #include <stdio.h> |
12 #include <stdlib.h> | 12 #include <stdlib.h> |
13 #include "dtptngts.h" | 13 #include "dtptngts.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 UnicodeString("13 de ene. de 1999"), // 03: yMMMd -> "d
'de' MMM 'de' y" | 161 UnicodeString("13 de ene. de 1999"), // 03: yMMMd -> "d
'de' MMM 'de' y" |
162 UnicodeString("13/1"), // 04: Md -> "d
/M" | 162 UnicodeString("13/1"), // 04: Md -> "d
/M" |
163 UnicodeString("13 de ene."), // 05: MMMd -> "d
'de' MMM" | 163 UnicodeString("13 de ene."), // 05: MMMd -> "d
'de' MMM" |
164 UnicodeString("13 de enero"), // 06: MMMMd -> "d
'de' MMMM" | 164 UnicodeString("13 de enero"), // 06: MMMMd -> "d
'de' MMMM" |
165 UnicodeString("T1 1999"), // 07: yQQQ -> "Q
QQ y" | 165 UnicodeString("T1 1999"), // 07: yQQQ -> "Q
QQ y" |
166 UnicodeString("11:58 p. m."), // 08: hhmm -> "h
h:mm a" | 166 UnicodeString("11:58 p. m."), // 08: hhmm -> "h
h:mm a" |
167 UnicodeString("23:58"), // 09: HHmm -> "H
H:mm" | 167 UnicodeString("23:58"), // 09: HHmm -> "H
H:mm" |
168 UnicodeString("23:58"), // 10: jjmm -> "H
H:mm" | 168 UnicodeString("23:58"), // 10: jjmm -> "H
H:mm" |
169 UnicodeString("58:59"), // 11: mmss -> "m
m:ss" | 169 UnicodeString("58:59"), // 11: mmss -> "m
m:ss" |
170 UnicodeString("enero de 1999"), // 12: yyyyMMMM ->
"MMMM 'de' yyyy" | 170 UnicodeString("enero de 1999"), // 12: yyyyMMMM ->
"MMMM 'de' yyyy" |
171 CharsToUnicodeString("mi\\u00E9. 13 de ene."), // 13: MMMEd -> "E
d 'de' MMM" | 171 CharsToUnicodeString("mi\\u00E9., 13 de ene."), // 13: MMMEd -> "
E, d 'de' MMM" |
172 CharsToUnicodeString("mi\\u00E9. 13"), // 14: Ed -> "E
EE d" | 172 CharsToUnicodeString("mi\\u00E9. 13"), // 14: Ed -> "E
EE d" |
173 UnicodeString("23:58:59,123"), // 15: jmmssSSS ->
"H:mm:ss,SSS" | 173 UnicodeString("23:58:59,123"), // 15: jmmssSSS ->
"H:mm:ss,SSS" |
174 UnicodeString("23:58"), // 16: JJmm | 174 UnicodeString("23:58"), // 16: JJmm |
175 | 175 |
176 // ja // 5 j
a | 176 // ja // 5 j
a |
177 UnicodeString("1999/1"), // 00:
yM -> y/M | 177 UnicodeString("1999/1"), // 00:
yM -> y/M |
178 CharsToUnicodeString("1999\\u5E741\\u6708"), // 01:
yMMM -> y\u5E74M\u6708 | 178 CharsToUnicodeString("1999\\u5E741\\u6708"), // 01:
yMMM -> y\u5E74M\u6708 |
179 UnicodeString("1999/1/13"), // 02:
yMd -> y/M/d | 179 UnicodeString("1999/1/13"), // 02:
yMd -> y/M/d |
180 CharsToUnicodeString("1999\\u5E741\\u670813\\u65E5"), // 03:
yMMMd -> y\u5E74M\u6708d\u65E5 | 180 CharsToUnicodeString("1999\\u5E741\\u670813\\u65E5"), // 03:
yMMMd -> y\u5E74M\u6708d\u65E5 |
181 UnicodeString("1/13"), // 04:
Md -> M/d | 181 UnicodeString("1/13"), // 04:
Md -> M/d |
(...skipping 11 matching lines...) Expand all Loading... |
193 UnicodeString("23:58"), // 16:
JJmm | 193 UnicodeString("23:58"), // 16:
JJmm |
194 | 194 |
195 // ja@calendar=japanese // 6 j
a@calendar=japanese | 195 // ja@calendar=japanese // 6 j
a@calendar=japanese |
196 CharsToUnicodeString("\\u5E73\\u621011/1"), // 00:
yM -> Gy/m | 196 CharsToUnicodeString("\\u5E73\\u621011/1"), // 00:
yM -> Gy/m |
197 CharsToUnicodeString("\\u5E73\\u621011\\u5E741\\u6708"), // 01:
yMMM -> Gy\u5E74M\u6708 | 197 CharsToUnicodeString("\\u5E73\\u621011\\u5E741\\u6708"), // 01:
yMMM -> Gy\u5E74M\u6708 |
198 CharsToUnicodeString("\\u5E73\\u621011/1/13"), // 02:
yMd -> Gy/m/d | 198 CharsToUnicodeString("\\u5E73\\u621011/1/13"), // 02:
yMd -> Gy/m/d |
199 CharsToUnicodeString("\\u5E73\\u621011\\u5E741\\u670813\\u65E5"), // 03:
yMMMd -> Gy\u5E74M\u6708d\u65E5 | 199 CharsToUnicodeString("\\u5E73\\u621011\\u5E741\\u670813\\u65E5"), // 03:
yMMMd -> Gy\u5E74M\u6708d\u65E5 |
200 UnicodeString("1/13"), // 04:
Md -> M/d | 200 UnicodeString("1/13"), // 04:
Md -> M/d |
201 CharsToUnicodeString("1\\u670813\\u65E5"), // 05:
MMMd -> M\u6708d\u65E5 | 201 CharsToUnicodeString("1\\u670813\\u65E5"), // 05:
MMMd -> M\u6708d\u65E5 |
202 CharsToUnicodeString("1\\u670813\\u65E5"), // 06:
MMMMd -> M\u6708d\u65E5 | 202 CharsToUnicodeString("1\\u670813\\u65E5"), // 06:
MMMMd -> M\u6708d\u65E5 |
203 CharsToUnicodeString("\\u5E73\\u6210 11 Q1"), // 07:
yQQQ -> G y QQQ | 203 CharsToUnicodeString("\\u5E73\\u621011/Q1"), // 07:
yQQQ -> Gy/QQQ |
204 CharsToUnicodeString("\\u5348\\u5F8C11:58"), // 08:
hhmm -> | 204 CharsToUnicodeString("\\u5348\\u5F8C11:58"), // 08:
hhmm -> |
205 UnicodeString("23:58"), // 09:
HHmm -> HH:mm (as for ja) | 205 UnicodeString("23:58"), // 09:
HHmm -> HH:mm (as for ja) |
206 UnicodeString("23:58"), // 10:
jjmm | 206 UnicodeString("23:58"), // 10:
jjmm |
207 UnicodeString("58:59"), // 11:
mmss -> mm:ss (as for ja) | 207 UnicodeString("58:59"), // 11:
mmss -> mm:ss (as for ja) |
208 CharsToUnicodeString("\\u5E73\\u621011\\u5E741\\u6708"), // 12:
yyyyMMMM -> Gyyyy\u5E74M\u6708 | 208 CharsToUnicodeString("\\u5E73\\u621011\\u5E741\\u6708"), // 12:
yyyyMMMM -> Gyyyy\u5E74M\u6708 |
209 CharsToUnicodeString("1\\u670813\\u65E5(\\u6C34)"), // 13:
MMMEd -> M\u6708d\u65E5(EEE) | 209 CharsToUnicodeString("1\\u670813\\u65E5(\\u6C34)"), // 13:
MMMEd -> M\u6708d\u65E5(EEE) |
210 CharsToUnicodeString("13\\u65E5(\\u6C34)"), // 14:
Ed -> d\u65E5(EEE) | 210 CharsToUnicodeString("13\\u65E5(\\u6C34)"), // 14:
Ed -> d\u65E5(EEE) |
211 UnicodeString("23:58:59.123"), // 15:
jmmssSSS -> "H:mm:ss.SSS" | 211 UnicodeString("23:58:59.123"), // 15:
jmmssSSS -> "H:mm:ss.SSS" |
212 UnicodeString("23:58"), // 16:
JJmm | 212 UnicodeString("23:58"), // 16:
JJmm |
213 | 213 |
214 // zh_Hans_CN // 7 z
h_Hans_CN | 214 // zh_Hans_CN // 7 z
h_Hans_CN |
215 UnicodeString("1999/1", -1, US_INV), // 00:
yM | 215 CharsToUnicodeString("1999\\u5E741\\u6708"), // 00:
yM -> y\u5E74M\u6708 |
216 CharsToUnicodeString("1999\\u5E741\\u6708"), // 01:
yMMM -> yyyy\u5E74MMM (fixed expected result per ticket:6626:) | 216 CharsToUnicodeString("1999\\u5E741\\u6708"), // 01:
yMMM -> yyyy\u5E74MMM (fixed expected result per ticket:6626:) |
217 CharsToUnicodeString("1999/1/13"), // 02:
yMd | 217 CharsToUnicodeString("1999/1/13"), // 02:
yMd |
218 CharsToUnicodeString("1999\\u5E741\\u670813\\u65E5"), // 03:
yMMMd -> yyyy\u5E74MMMd\u65E5 (fixed expected result per ticket:6626:) | 218 CharsToUnicodeString("1999\\u5E741\\u670813\\u65E5"), // 03:
yMMMd -> yyyy\u5E74MMMd\u65E5 (fixed expected result per ticket:6626:) |
219 UnicodeString("1/13"), // 04:
Md | 219 UnicodeString("1/13"), // 04:
Md |
220 CharsToUnicodeString("1\\u670813\\u65E5"), // 05:
MMMd -> M\u6708d\u65E5 (fixed expected result per ticket:6626:) | 220 CharsToUnicodeString("1\\u670813\\u65E5"), // 05:
MMMd -> M\u6708d\u65E5 (fixed expected result per ticket:6626:) |
221 CharsToUnicodeString("1\\u670813\\u65E5"), // 06:
MMMMd -> M\u6708d\u65E5 | 221 CharsToUnicodeString("1\\u670813\\u65E5"), // 06:
MMMMd -> M\u6708d\u65E5 |
222 CharsToUnicodeString("1999\\u5E74\\u7B2C1\\u5B63\\u5EA6"), // 07:
yQQQ | 222 CharsToUnicodeString("1999\\u5E74\\u7B2C1\\u5B63\\u5EA6"), // 07:
yQQQ |
223 CharsToUnicodeString("\\u4E0B\\u534811:58"), // 08:
hhmm | 223 CharsToUnicodeString("\\u4E0B\\u534811:58"), // 08:
hhmm |
224 UnicodeString("23:58"), // 09:
HHmm | 224 UnicodeString("23:58"), // 09:
HHmm |
225 CharsToUnicodeString("\\u4E0B\\u534811:58"), // 10:
jjmm | 225 CharsToUnicodeString("\\u4E0B\\u534811:58"), // 10:
jjmm |
(...skipping 18 matching lines...) Expand all Loading... |
244 CharsToUnicodeString("\\u4E0B\\u534811:58"), // 10:
jjmm | 244 CharsToUnicodeString("\\u4E0B\\u534811:58"), // 10:
jjmm |
245 UnicodeString("58:59"), // 11:
mmss -> | 245 UnicodeString("58:59"), // 11:
mmss -> |
246 CharsToUnicodeString("\\u6C11\\u570B88\\u5E741\\u6708"), // 12:
yyyyMMMM -> Gy\u5E74M\u670 | 246 CharsToUnicodeString("\\u6C11\\u570B88\\u5E741\\u6708"), // 12:
yyyyMMMM -> Gy\u5E74M\u670 |
247 CharsToUnicodeString("1\\u670813\\u65E5\\u9031\\u4E09"), // 13:
MMMEd -> M\u6708d\u65E5EEE | 247 CharsToUnicodeString("1\\u670813\\u65E5\\u9031\\u4E09"), // 13:
MMMEd -> M\u6708d\u65E5EEE |
248 CharsToUnicodeString("13\\u65E5\\uff08\\u9031\\u4E09\\uff09"), // 14:
Ed -> d\u65E5\\uff08EEEi\\uff09 | 248 CharsToUnicodeString("13\\u65E5\\uff08\\u9031\\u4E09\\uff09"), // 14:
Ed -> d\u65E5\\uff08EEEi\\uff09 |
249 CharsToUnicodeString("\\u4E0B\\u534811:58:59.123"), // 15:
jmmssSSS -> "ah:mm:ss.SSS" | 249 CharsToUnicodeString("\\u4E0B\\u534811:58:59.123"), // 15:
jmmssSSS -> "ah:mm:ss.SSS" |
250 UnicodeString("11:58"), // 16:
JJmm | 250 UnicodeString("11:58"), // 16:
JJmm |
251 | 251 |
252 // ru // 9 r
u | 252 // ru // 9 r
u |
253 UnicodeString("01.1999"), // 00:
yM -> MM.y | 253 UnicodeString("01.1999"), // 00:
yM -> MM.y |
254 CharsToUnicodeString("\\u042F\\u043D\\u0432. 1999"), // 01:
yMMM -> LLL y | 254 CharsToUnicodeString("\\u044F\\u043D\\u0432. 1999"), // 01:
yMMM -> LLL y |
255 UnicodeString("13.01.1999"), // 02:
yMd -> dd.MM.y | 255 UnicodeString("13.01.1999"), // 02:
yMd -> dd.MM.y |
256 CharsToUnicodeString("13 \\u044F\\u043D\\u0432. 1999 \\u0433."), // 03:
yMMMd -> d MMM y | 256 CharsToUnicodeString("13 \\u044F\\u043D\\u0432. 1999 \\u0433."), // 03:
yMMMd -> d MMM y |
257 UnicodeString("13.01"), // 04:
Md -> dd.MM | 257 UnicodeString("13.01"), // 04:
Md -> dd.MM |
258 CharsToUnicodeString("13 \\u044F\\u043D\\u0432."), // 05:
MMMd -> d MMM | 258 CharsToUnicodeString("13 \\u044F\\u043D\\u0432."), // 05:
MMMd -> d MMM |
259 CharsToUnicodeString("13 \\u044F\\u043D\\u0432\\u0430\\u0440\\u044F"), /
/ 06: MMMMd -> d MMMM | 259 CharsToUnicodeString("13 \\u044F\\u043D\\u0432\\u0430\\u0440\\u044F"), /
/ 06: MMMMd -> d MMMM |
260 CharsToUnicodeString("1-\\u0439 \\u043A\\u0432. 1999 \\u0433."), // 07:
yQQQ -> y QQQ | 260 CharsToUnicodeString("1-\\u0439 \\u043A\\u0432. 1999 \\u0433."), // 07:
yQQQ -> y QQQ |
261 CharsToUnicodeString("11:58 \\u043F\\u043E\\u0441\\u043B\\u0435 \\u043F\
\u043E\\u043B\\u0443\\u0434\\u043D\\u044F"),
// 07: hhmm -> hh:mm a | 261 UnicodeString("11:58 PM"), // 07:
hhmm -> hh:mm a |
262 UnicodeString("23:58"), // 09:
HHmm -> HH:mm | 262 UnicodeString("23:58"), // 09:
HHmm -> HH:mm |
263 UnicodeString("23:58"), // 10:
jjmm -> HH:mm | 263 UnicodeString("23:58"), // 10:
jjmm -> HH:mm |
264 UnicodeString("58:59"), // 11:
mmss -> mm:ss | 264 UnicodeString("58:59"), // 11:
mmss -> mm:ss |
265 CharsToUnicodeString("\\u042F\\u043D\\u0432\\u0430\\u0440\\u044C 1999"),
// 12: yyyyMMMM -> LLLL y | 265 CharsToUnicodeString("\\u044F\\u043D\\u0432\\u0430\\u0440\\u044C 1999"),
// 12: yyyyMMMM -> LLLL y |
266 CharsToUnicodeString("\\u0421\\u0440, 13 \\u044F\\u043D\\u0432."), // 13
: MMMEd -> ccc, d MMM | 266 CharsToUnicodeString("\\u0421\\u0440, 13 \\u044F\\u043D\\u0432."), // 13
: MMMEd -> ccc, d MMM |
267 CharsToUnicodeString("\\u0421\\u0440, 13"), // 14:
Ed -> EEE, d | 267 CharsToUnicodeString("\\u0421\\u0440, 13"), // 14:
Ed -> EEE, d |
268 UnicodeString("23:58:59,123"), // 15:
jmmssSSS -> "H:mm:ss,SSS" | 268 UnicodeString("23:58:59,123"), // 15:
jmmssSSS -> "H:mm:ss,SSS" |
269 UnicodeString("23:58"), // 16:
JJmm | 269 UnicodeString("23:58"), // 16:
JJmm |
270 | 270 |
271 // zh@calendar=chinese // 10
zh@calendar=chinese | 271 // zh@calendar=chinese // 10
zh@calendar=chinese |
272 CharsToUnicodeString("\\u620A\\u5BC5\\u5E7411\\u6708"), // 00:
yM | 272 CharsToUnicodeString("\\u620A\\u5BC5\\u5E74\\u51AC\\u6708"), // 00:
yMMM |
273 CharsToUnicodeString("\\u620A\\u5BC5\\u5E74\\u5341\\u4E00\\u6708"), //
01: yMMM | 273 CharsToUnicodeString("\\u620A\\u5BC5\\u5E74\\u51AC\\u6708"), // 01:
yMMM |
274 CharsToUnicodeString("\\u620A\\u5BC5\\u5E7411\\u670826\\u65E5"), // 02:
yMd | 274 CharsToUnicodeString("\\u620A\\u5BC5\\u5E74\\u51AC\\u670826\\u65E5"), //
02: yMMMd |
275 CharsToUnicodeString("\\u620A\\u5BC5\\u5E74\\u5341\\u4E00\\u670826\\u65E
5"), // 03: yMMMd | 275 CharsToUnicodeString("\\u620A\\u5BC5\\u5E74\\u51AC\\u670826\\u65E5"), //
03: yMMMd |
276 UnicodeString("11-26"), // 04:
Md | 276 UnicodeString("11-26"), // 04:
Md |
277 CharsToUnicodeString("\\u5341\\u4E00\\u670826\\u65E5"), // 05:
MMMd | 277 CharsToUnicodeString("\\u51AC\\u670826\\u65E5"), // 05:
MMMd |
278 CharsToUnicodeString("\\u5341\\u4E00\\u670826\\u65E5"), // 06:
MMMMd | 278 CharsToUnicodeString("\\u51AC\\u670826\\u65E5"), // 06:
MMMMd |
279 CharsToUnicodeString("\\u620A\\u5BC5\\u5E74\\u7b2c\\u56db\\u5B63\\u5EA6"
), // 07: yQQQ | 279 CharsToUnicodeString("\\u620A\\u5BC5\\u5E74\\u7b2c\\u56db\\u5B63\\u5EA6"
), // 07: yQQQ |
280 CharsToUnicodeString("\\u4E0B\\u534811:58"), // 08:
hhmm | 280 CharsToUnicodeString("\\u4E0B\\u534811:58"), // 08:
hhmm |
281 UnicodeString("23:58"), // 09:
HHmm | 281 UnicodeString("23:58"), // 09:
HHmm |
282 CharsToUnicodeString("\\u4E0B\\u534811:58"), // 10:
jjmm | 282 CharsToUnicodeString("\\u4E0B\\u534811:58"), // 10:
jjmm |
283 UnicodeString("58:59"), // 11:
mmss | 283 UnicodeString("58:59"), // 11:
mmss |
284 CharsToUnicodeString("\\u620A\\u5BC5\\u5E74\\u5341\\u4E00\\u6708"), // 1
2: yyyyMMMM | 284 CharsToUnicodeString("\\u620A\\u5BC5\\u5E74\\u51AC\\u6708"), // 12:
yyyyMMMM |
285 CharsToUnicodeString("\\u5341\\u4E00\\u670826\\u65E5\\u5468\\u4E09"), //
13: MMMEd | 285 CharsToUnicodeString("\\u51AC\\u670826\\u65E5\\u5468\\u4E09"), // 13:
MMMEd |
286 CharsToUnicodeString("26\\u65E5\\u5468\\u4E09"), // 14:
Ed -> d\u65E5EEE | 286 CharsToUnicodeString("26\\u65E5\\u5468\\u4E09"), // 14:
Ed -> d\u65E5EEE |
287 CharsToUnicodeString("\\u4E0B\\u534811:58:59.123"), // 15:
jmmssSS | 287 CharsToUnicodeString("\\u4E0B\\u534811:58:59.123"), // 15:
jmmssSS |
288 UnicodeString("11:58"), // 16:
JJmm | 288 UnicodeString("11:58"), // 16:
JJmm |
289 | 289 |
290 UnicodeString(), | 290 UnicodeString(), |
291 }; | 291 }; |
292 | 292 |
293 UnicodeString patternTests2[] = { | 293 UnicodeString patternTests2[] = { |
294 UnicodeString("yyyyMMMdd"), | 294 UnicodeString("yyyyMMMdd"), |
295 UnicodeString("yyyyqqqq"), | 295 UnicodeString("yyyyqqqq"), |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 if (zone==NULL) { | 426 if (zone==NULL) { |
427 dataerrln("ERROR: Could not create TimeZone ECT"); | 427 dataerrln("ERROR: Could not create TimeZone ECT"); |
428 delete gen; | 428 delete gen; |
429 delete format; | 429 delete format; |
430 return; | 430 return; |
431 } | 431 } |
432 format->setTimeZone(*zone); | 432 format->setTimeZone(*zone); |
433 UnicodeString dateReturned, expectedResult; | 433 UnicodeString dateReturned, expectedResult; |
434 dateReturned.remove(); | 434 dateReturned.remove(); |
435 dateReturned = format->format(sampleDate, dateReturned, status); | 435 dateReturned = format->format(sampleDate, dateReturned, status); |
436 expectedResult=UnicodeString("14. Okt. 08:58", -1, US_INV); | 436 expectedResult=UnicodeString("14. Okt., 08:58", -1, US_INV); |
437 if ( dateReturned != expectedResult ) { | 437 if ( dateReturned != expectedResult ) { |
438 errln("ERROR: Simple test in getBestPattern with Locale::getGermany())."
); | 438 errln("ERROR: Simple test in getBestPattern with Locale::getGermany())."
); |
439 } | 439 } |
440 // add new pattern | 440 // add new pattern |
441 status = U_ZERO_ERROR; | 441 status = U_ZERO_ERROR; |
442 conflictingStatus = gen->addPattern(UnicodeString("d'. von' MMMM", -1, US_IN
V), true, conflictingPattern, status); | 442 conflictingStatus = gen->addPattern(UnicodeString("d'. von' MMMM", -1, US_IN
V), true, conflictingPattern, status); |
443 if (U_FAILURE(status)) { | 443 if (U_FAILURE(status)) { |
444 errln("ERROR: Could not addPattern - d\'. von\' MMMM"); | 444 errln("ERROR: Could not addPattern - d\'. von\' MMMM"); |
445 } | 445 } |
446 status = U_ZERO_ERROR; | 446 status = U_ZERO_ERROR; |
447 UnicodeString testPattern=gen->getBestPattern(UnicodeString("MMMMdd"), statu
s); | 447 UnicodeString testPattern=gen->getBestPattern(UnicodeString("MMMMdd"), statu
s); |
448 testPattern=gen->getBestPattern(UnicodeString("MMMddHmm"), status); | 448 testPattern=gen->getBestPattern(UnicodeString("MMMddHmm"), status); |
449 format->applyPattern(gen->getBestPattern(UnicodeString("MMMMdHmm"), status))
; | 449 format->applyPattern(gen->getBestPattern(UnicodeString("MMMMdHmm"), status))
; |
450 dateReturned.remove(); | 450 dateReturned.remove(); |
451 dateReturned = format->format(sampleDate, dateReturned, status); | 451 dateReturned = format->format(sampleDate, dateReturned, status); |
452 expectedResult=UnicodeString("14. von Oktober 08:58", -1, US_INV); | 452 expectedResult=UnicodeString("14. von Oktober, 08:58", -1, US_INV); |
453 if ( dateReturned != expectedResult ) { | 453 if ( dateReturned != expectedResult ) { |
454 errln(UnicodeString("ERROR: Simple test addPattern failed!: d\'. von\' M
MMM Got: ") + dateReturned + UnicodeString(" Expected: ") + expectedResult); | 454 errln(UnicodeString("ERROR: Simple test addPattern failed!: d\'. von\' M
MMM Got: ") + dateReturned + UnicodeString(" Expected: ") + expectedResult); |
455 } | 455 } |
456 delete format; | 456 delete format; |
457 | 457 |
458 // get a pattern and modify it | 458 // get a pattern and modify it |
459 format = (SimpleDateFormat *)DateFormat::createDateTimeInstance(DateFormat::
kFull, DateFormat::kFull, | 459 format = (SimpleDateFormat *)DateFormat::createDateTimeInstance(DateFormat::
kFull, DateFormat::kFull, |
460 deLocale); | 460 deLocale); |
461 format->setTimeZone(*zone); | 461 format->setTimeZone(*zone); |
462 UnicodeString pattern; | 462 UnicodeString pattern; |
463 pattern = format->toPattern(pattern); | 463 pattern = format->toPattern(pattern); |
464 dateReturned.remove(); | 464 dateReturned.remove(); |
465 dateReturned = format->format(sampleDate, dateReturned, status); | 465 dateReturned = format->format(sampleDate, dateReturned, status); |
466 expectedResult=CharsToUnicodeString("Donnerstag, 14. Oktober 1999 08:58:59 M
itteleurop\\u00E4ische Sommerzeit"); | 466 expectedResult=CharsToUnicodeString("Donnerstag, 14. Oktober 1999 um 08:58:5
9 Mitteleurop\\u00E4ische Sommerzeit"); |
467 if ( dateReturned != expectedResult ) { | 467 if ( dateReturned != expectedResult ) { |
468 errln("ERROR: Simple test uses full date format."); | 468 errln("ERROR: Simple test uses full date format."); |
469 errln(UnicodeString(" Got: ") + dateReturned + UnicodeString(" Expected:
") + expectedResult); | 469 errln(UnicodeString(" Got: ") + dateReturned + UnicodeString(" Expected:
") + expectedResult); |
470 } | 470 } |
471 | 471 |
472 // modify it to change the zone. | 472 // modify it to change the zone. |
473 UnicodeString newPattern = gen->replaceFieldTypes(pattern, UnicodeString("vv
vv"), status); | 473 UnicodeString newPattern = gen->replaceFieldTypes(pattern, UnicodeString("vv
vv"), status); |
474 format->applyPattern(newPattern); | 474 format->applyPattern(newPattern); |
475 dateReturned.remove(); | 475 dateReturned.remove(); |
476 dateReturned = format->format(sampleDate, dateReturned, status); | 476 dateReturned = format->format(sampleDate, dateReturned, status); |
477 expectedResult=CharsToUnicodeString("Donnerstag, 14. Oktober 1999 08:58:59 M
itteleurop\\u00E4ische Zeit"); | 477 expectedResult=CharsToUnicodeString("Donnerstag, 14. Oktober 1999 um 08:58:5
9 Mitteleurop\\u00E4ische Zeit"); |
478 if ( dateReturned != expectedResult ) { | 478 if ( dateReturned != expectedResult ) { |
479 errln("ERROR: Simple test modify the timezone!"); | 479 errln("ERROR: Simple test modify the timezone!"); |
480 errln(UnicodeString(" Got: ")+ dateReturned + UnicodeString(" Expected:
") + expectedResult); | 480 errln(UnicodeString(" Got: ")+ dateReturned + UnicodeString(" Expected:
") + expectedResult); |
481 } | 481 } |
482 | 482 |
483 // setDeciaml(), getDeciaml() | 483 // setDeciaml(), getDeciaml() |
484 gen->setDecimal(newDecimal); | 484 gen->setDecimal(newDecimal); |
485 if (newDecimal != gen->getDecimal()) { | 485 if (newDecimal != gen->getDecimal()) { |
486 errln("ERROR: unexpected result from setDecimal() and getDecimal()!.\n")
; | 486 errln("ERROR: unexpected result from setDecimal() and getDecimal()!.\n")
; |
487 } | 487 } |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 { "en", "Hmm", "HH:mm", UDATPG_MATCH_HOUR_FIELD_LENGTH }, | 856 { "en", "Hmm", "HH:mm", UDATPG_MATCH_HOUR_FIELD_LENGTH }, |
857 { "en", "HHmm", "HH:mm", UDATPG_MATCH_HOUR_FIELD_LENGTH }, | 857 { "en", "HHmm", "HH:mm", UDATPG_MATCH_HOUR_FIELD_LENGTH }, |
858 { "en", "hhmm", "hh:mm a", UDATPG_MATCH_HOUR_FIELD_LENGTH }, | 858 { "en", "hhmm", "hh:mm a", UDATPG_MATCH_HOUR_FIELD_LENGTH }, |
859 { "be", "Hmm", "HH.mm", UDATPG_MATCH_NO_OPTIONS }, | 859 { "be", "Hmm", "HH.mm", UDATPG_MATCH_NO_OPTIONS }, |
860 { "be", "HHmm", "HH.mm", UDATPG_MATCH_NO_OPTIONS }, | 860 { "be", "HHmm", "HH.mm", UDATPG_MATCH_NO_OPTIONS }, |
861 { "be", "hhmm", "h.mm a", UDATPG_MATCH_NO_OPTIONS }, | 861 { "be", "hhmm", "h.mm a", UDATPG_MATCH_NO_OPTIONS }, |
862 { "be", "Hmm", "H.mm", UDATPG_MATCH_HOUR_FIELD_LENGTH }, | 862 { "be", "Hmm", "H.mm", UDATPG_MATCH_HOUR_FIELD_LENGTH }, |
863 { "be", "HHmm", "HH.mm", UDATPG_MATCH_HOUR_FIELD_LENGTH }, | 863 { "be", "HHmm", "HH.mm", UDATPG_MATCH_HOUR_FIELD_LENGTH }, |
864 { "be", "hhmm", "hh.mm a", UDATPG_MATCH_HOUR_FIELD_LENGTH }, | 864 { "be", "hhmm", "hh.mm a", UDATPG_MATCH_HOUR_FIELD_LENGTH }, |
865 // | 865 // |
866 { "en", "yyyy", "yyyy", UDATPG_MATCH_NO_OPTIONS }, | 866 { "en", "yyyy", "yyyy", UDATPG_MATCH_NO_OPTIONS }, |
867 { "en", "YYYY", "YYYY", UDATPG_MATCH_NO_OPTIONS }, | 867 { "en", "YYYY", "YYYY", UDATPG_MATCH_NO_OPTIONS }, |
868 { "en", "U", "y", UDATPG_MATCH_NO_OPTIONS }, | 868 { "en", "U", "y", UDATPG_MATCH_NO_OPTIONS }, |
869 { "en@calendar=japanese", "yyyy", "y G", UDATPG_MATCH_NO_OPTIONS }, | 869 { "en@calendar=japanese", "yyyy", "y G", UDATPG_MATCH_NO_OPTIONS }, |
870 { "en@calendar=japanese", "YYYY", "Y G", UDATPG_MATCH_NO_OPTIONS }, | 870 { "en@calendar=japanese", "YYYY", "Y G", UDATPG_MATCH_NO_OPTIONS }, |
871 { "en@calendar=japanese", "U", "y G", UDATPG_MATCH_NO_OPTIONS }, | 871 { "en@calendar=japanese", "U", "y G", UDATPG_MATCH_NO_OPTIONS }, |
872 { "en@calendar=chinese", "yyyy", "U", UDATPG_MATCH_NO_OPTIONS }, | 872 { "en@calendar=chinese", "yyyy", "U", UDATPG_MATCH_NO_OPTIONS }, |
873 { "en@calendar=chinese", "YYYY", "Y", UDATPG_MATCH_NO_OPTIONS }, | 873 { "en@calendar=chinese", "YYYY", "Y", UDATPG_MATCH_NO_OPTIONS }, |
874 { "en@calendar=chinese", "U", "U", UDATPG_MATCH_NO_OPTIONS }, | 874 { "en@calendar=chinese", "U", "U", UDATPG_MATCH_NO_OPTIONS }, |
| 875 { "en@calendar=chinese", "Gy", "U", UDATPG_MATCH_NO_OPTIONS }, |
| 876 { "en@calendar=chinese", "GU", "U", UDATPG_MATCH_NO_OPTIONS }, |
| 877 { "en@calendar=chinese", "ULLL", "MMM U", UDATPG_MATCH_NO_OPTIONS }, |
| 878 { "en@calendar=chinese", "yMMM", "MMM U", UDATPG_MATCH_NO_OPTIONS }, |
| 879 { "en@calendar=chinese", "GUMMM", "MMM U", UDATPG_MATCH_NO_OPTIONS }, |
| 880 { "zh@calendar=chinese", "yyyy", "U\\u5E74", UDATPG_MATCH_NO_OPTION
S }, |
| 881 { "zh@calendar=chinese", "YYYY", "Y\\u5E74", UDATPG_MATCH_NO_OPTION
S }, |
| 882 { "zh@calendar=chinese", "U", "U\\u5E74", UDATPG_MATCH_NO_OPTION
S }, |
| 883 { "zh@calendar=chinese", "Gy", "U\\u5E74", UDATPG_MATCH_NO_OPTION
S }, |
| 884 { "zh@calendar=chinese", "GU", "U\\u5E74", UDATPG_MATCH_NO_OPTION
S }, |
| 885 { "zh@calendar=chinese", "ULLL", "U\\u5E74MMM", UDATPG_MATCH_NO_OPTION
S }, |
| 886 { "zh@calendar=chinese", "yMMM", "U\\u5E74MMM", UDATPG_MATCH_NO_OPTION
S }, |
| 887 { "zh@calendar=chinese", "GUMMM", "U\\u5E74MMM", UDATPG_MATCH_NO_OPTION
S }, |
875 }; | 888 }; |
876 | 889 |
877 int count = sizeof(testData) / sizeof(testData[0]); | 890 int count = sizeof(testData) / sizeof(testData[0]); |
878 const DTPtnGenOptionsData * testDataPtr = testData; | 891 const DTPtnGenOptionsData * testDataPtr = testData; |
879 | 892 |
880 for (; count-- > 0; ++testDataPtr) { | 893 for (; count-- > 0; ++testDataPtr) { |
881 UErrorCode status = U_ZERO_ERROR; | 894 UErrorCode status = U_ZERO_ERROR; |
882 | 895 |
883 Locale locale(testDataPtr->locale); | 896 Locale locale(testDataPtr->locale); |
884 UnicodeString skel(testDataPtr->skel); | 897 UnicodeString skel(testDataPtr->skel); |
885 UnicodeString expectedPattern(testDataPtr->expectedPattern); | 898 UnicodeString expectedPattern(UnicodeString(testDataPtr->expectedPattern
).unescape()); |
886 UDateTimePatternMatchOptions options = testDataPtr->options; | 899 UDateTimePatternMatchOptions options = testDataPtr->options; |
887 | 900 |
888 DateTimePatternGenerator * dtpgen = DateTimePatternGenerator::createInst
ance(locale, status); | 901 DateTimePatternGenerator * dtpgen = DateTimePatternGenerator::createInst
ance(locale, status); |
889 if (U_FAILURE(status)) { | 902 if (U_FAILURE(status)) { |
890 dataerrln("Unable to create DateTimePatternGenerator instance for lo
cale(%s): %s", locale.getName(), u_errorName(status)); | 903 dataerrln("Unable to create DateTimePatternGenerator instance for lo
cale(%s): %s", locale.getName(), u_errorName(status)); |
891 delete dtpgen; | 904 delete dtpgen; |
892 continue; | 905 continue; |
893 } | 906 } |
894 UnicodeString pattern = dtpgen->getBestPattern(skel, options, status); | 907 UnicodeString pattern = dtpgen->getBestPattern(skel, options, status); |
895 if (pattern.compare(expectedPattern) != 0) { | 908 if (pattern.compare(expectedPattern) != 0) { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 } | 1051 } |
1039 } | 1052 } |
1040 delete dtpg; | 1053 delete dtpg; |
1041 } else { | 1054 } else { |
1042 dataerrln("Create DateTimePatternGenerator instance for locale(%s) f
ails: %s", | 1055 dataerrln("Create DateTimePatternGenerator instance for locale(%s) f
ails: %s", |
1043 locale.getName(), u_errorName(status)); | 1056 locale.getName(), u_errorName(status)); |
1044 } | 1057 } |
1045 } | 1058 } |
1046 } | 1059 } |
1047 #endif /* #if !UCONFIG_NO_FORMATTING */ | 1060 #endif /* #if !UCONFIG_NO_FORMATTING */ |
OLD | NEW |