1 /********************************************************************
2 * Copyright (c) 2011-2016, International Business Machines Corporation
3 * and others. All Rights Reserved.
4 ********************************************************************/
5 /* C API TEST FOR DATE INTERVAL FORMAT */
7 #include "unicode/utypes.h"
9 #if !UCONFIG_NO_FORMATTING
11 #include "unicode/udateintervalformat.h"
12 #include "unicode/udat.h"
13 #include "unicode/ucal.h"
14 #include "unicode/ustring.h"
18 static void TestDateIntervalFormat(void);
19 static void TestFPos_SkelWithSeconds(void);
21 void addDateIntervalFormatTest(TestNode
** root
);
23 #define TESTCASE(x) addTest(root, &x, "tsformat/cdateintervalformattest/" #x)
25 void addDateIntervalFormatTest(TestNode
** root
)
27 TESTCASE(TestDateIntervalFormat
);
28 TESTCASE(TestFPos_SkelWithSeconds
);
31 static const char tzUSPacific
[] = "US/Pacific";
32 static const char tzAsiaTokyo
[] = "Asia/Tokyo";
33 #define Date201103021030 1299090600000.0 /* 2011-Mar-02 1030 in US/Pacific, 2011-Mar-03 0330 in Asia/Tokyo */
34 #define Date201009270800 1285599629000.0 /* 2010-Sep-27 0800 in US/Pacific */
35 #define _MINUTE (60.0*1000.0)
36 #define _HOUR (60.0*60.0*1000.0)
37 #define _DAY (24.0*60.0*60.0*1000.0)
41 const char * skeleton
;
43 UDateIntervalFormatAttributeValue minimizeType
;
46 const char * resultExpected
;
47 } DateIntervalFormatTestItem
;
49 /* Just a small set of tests for now, the real functionality is tested in the C++ tests */
50 static const DateIntervalFormatTestItem testItems
[] = {
51 { "en", "MMMdHHmm", tzUSPacific
, UDTITVFMT_MINIMIZE_NONE
, Date201103021030
, Date201103021030
+ 7.0*_HOUR
, "Mar 2, 10:30 - 17:30" },
52 { "en", "MMMdHHmm", tzAsiaTokyo
, UDTITVFMT_MINIMIZE_NONE
, Date201103021030
, Date201103021030
+ 7.0*_HOUR
, "Mar 3, 03:30 - 10:30" },
53 { "en", "yMMMEd", tzUSPacific
, UDTITVFMT_MINIMIZE_NONE
, Date201009270800
, Date201009270800
+ 12.0*_HOUR
, "Mon, Sep 27, 2010" },
54 { "en", "yMMMEd", tzUSPacific
, UDTITVFMT_MINIMIZE_NONE
, Date201009270800
, Date201009270800
+ 31.0*_DAY
, "Mon, Sep 27 - Thu, Oct 28, 2010" },
55 { "en", "yMMMEd", tzUSPacific
, UDTITVFMT_MINIMIZE_NONE
, Date201009270800
, Date201009270800
+ 410.0*_DAY
, "Mon, Sep 27, 2010 - Fri, Nov 11, 2011" },
56 { "de", "Hm", tzUSPacific
, UDTITVFMT_MINIMIZE_NONE
, Date201009270800
, Date201009270800
+ 12.0*_HOUR
, "08:00\\u201320:00 Uhr" },
57 { "de", "Hm", tzUSPacific
, UDTITVFMT_MINIMIZE_NONE
, Date201009270800
, Date201009270800
+ 31.0*_DAY
, "27.9.2010, 08:00 \\u2013 28.10.2010, 08:00" },
58 { "ja", "MMMd", tzUSPacific
, UDTITVFMT_MINIMIZE_NONE
, Date201009270800
, Date201009270800
+ 1.0*_DAY
, "9\\u670827\\u65E5\\uFF5E28\\u65E5" },
59 { "en", "jm", tzUSPacific
, UDTITVFMT_MINIMIZE_NONE
, Date201103021030
, Date201103021030
+ 1.0*_HOUR
, "10:30 AM - 11:30 AM" },
60 { "en", "jm", tzUSPacific
, UDTITVFMT_MINIMIZE_NONE
, Date201103021030
, Date201103021030
+ 12.0*_HOUR
, "10:30 AM - 10:30 PM" },
61 { "it", "yMMMMd", tzUSPacific
, UDTITVFMT_MINIMIZE_NONE
, Date201103021030
, Date201103021030
+ 15.0*_DAY
, "2\\u201317 marzo 2011" },
63 { "en", "MMMd", tzUSPacific
, UDTITVFMT_MINIMIZE_ADJACENT_MONTHS
, Date201009270800
, Date201009270800
+ 6.0*_DAY
, "Sep 27 - 3" },
64 { "en", "MMMd", tzUSPacific
, UDTITVFMT_MINIMIZE_ADJACENT_MONTHS
, Date201009270800
, Date201009270800
+ 32.0*_DAY
, "Sep 27 - Oct 29" },
65 { "fr", "MMMd", tzUSPacific
, UDTITVFMT_MINIMIZE_ADJACENT_MONTHS
, Date201009270800
, Date201009270800
+ 6.0*_DAY
, "27\\u20133 oct." },
66 { "fr", "MMMd", tzUSPacific
, UDTITVFMT_MINIMIZE_ADJACENT_MONTHS
, Date201009270800
, Date201009270800
+ 32.0*_DAY
, "27 sept. \\u2013 29 oct." },
67 { "en", "MMMdjmm", tzUSPacific
, UDTITVFMT_MINIMIZE_ADJACENT_DAYS
, Date201009270800
, Date201009270800
+ 10.0*_HOUR
, "Sep 27, 8:00 AM - 6:00 PM" },
68 { "en", "MMMdjmm", tzUSPacific
, UDTITVFMT_MINIMIZE_ADJACENT_DAYS
, Date201009270800
, Date201009270800
+ 17.0*_HOUR
, "Sep 27, 8:00 AM - Sep 28, 1:00 AM" },
69 { "en", "MMMdjmm", tzUSPacific
, UDTITVFMT_MINIMIZE_ADJACENT_DAYS
, Date201009270800
+ 12.0*_HOUR
, Date201009270800
+ 17.0*_HOUR
, "Sep 27, 8:00 PM - 1:00 AM" },
70 { "en", "MMMdjmm", tzUSPacific
, UDTITVFMT_MINIMIZE_ADJACENT_DAYS
, Date201009270800
+ 12.0*_HOUR
, Date201009270800
+ 26.0*_HOUR
, "Sep 27, 8:00 PM - Sep 28, 10:00 AM" },
71 { "en", "MMMdjmm", tzUSPacific
, UDTITVFMT_MINIMIZE_ADJACENT_DAYS
, Date201009270800
+ 12.0*_HOUR
, Date201009270800
+ 35.0*_HOUR
, "Sep 27, 8:00 PM - Sep 28, 7:00 PM" },
72 { "fr", "MMMdjmm", tzUSPacific
, UDTITVFMT_MINIMIZE_ADJACENT_DAYS
, Date201009270800
, Date201009270800
+ 10.0*_HOUR
, "27 sept. \\u00E0 08:00 \\u2013 18:00" },
73 { "fr", "MMMdjmm", tzUSPacific
, UDTITVFMT_MINIMIZE_ADJACENT_DAYS
, Date201009270800
, Date201009270800
+ 17.0*_HOUR
, "27 sept. \\u00E0 08:00 \\u2013 28 sept. \\u00E0 01:00" },
74 { "fr", "MMMdjmm", tzUSPacific
, UDTITVFMT_MINIMIZE_ADJACENT_DAYS
, Date201009270800
+ 12.0*_HOUR
, Date201009270800
+ 17.0*_HOUR
, "27 sept. \\u00E0 20:00 \\u2013 01:00" },
75 { "fr", "MMMdjmm", tzUSPacific
, UDTITVFMT_MINIMIZE_ADJACENT_DAYS
, Date201009270800
+ 12.0*_HOUR
, Date201009270800
+ 26.0*_HOUR
, "27 sept. \\u00E0 20:00 \\u2013 28 sept. \\u00E0 10:00" },
76 { "fr", "MMMdjmm", tzUSPacific
, UDTITVFMT_MINIMIZE_ADJACENT_DAYS
, Date201009270800
+ 12.0*_HOUR
, Date201009270800
+ 35.0*_HOUR
, "27 sept. \\u00E0 20:00 \\u2013 28 sept. \\u00E0 19:00" },
78 { NULL
, NULL
, NULL
, UDTITVFMT_MINIMIZE_NONE
, 0, 0, NULL
}
87 static void TestDateIntervalFormat()
89 const DateIntervalFormatTestItem
* testItemPtr
;
90 UErrorCode status
= U_ZERO_ERROR
;
91 ctest_setTimeZone(NULL
, &status
);
92 log_verbose("\nTesting udtitvfmt_open() and udtitvfmt_format() with various parameters\n");
93 for ( testItemPtr
= testItems
; testItemPtr
->locale
!= NULL
; ++testItemPtr
) {
94 UDateIntervalFormat
* udtitvfmt
;
96 UChar skelBuf
[kSkelBufLen
];
97 UChar tzidBuf
[kTZIDBufLen
];
98 const char * tzidForLog
= (testItemPtr
->tzid
)? testItemPtr
->tzid
: "NULL";
100 status
= U_ZERO_ERROR
;
101 u_unescape(testItemPtr
->skeleton
, skelBuf
, kSkelBufLen
);
102 if ( testItemPtr
->tzid
) {
103 u_unescape(testItemPtr
->tzid
, tzidBuf
, kTZIDBufLen
);
108 udtitvfmt
= udtitvfmt_open(testItemPtr
->locale
, skelBuf
, -1, tzidBuf
, tzidLen
, &status
);
109 if ( U_SUCCESS(status
) ) {
110 UChar result
[kFormatBufLen
];
111 UChar resultExpected
[kFormatBufLen
];
112 udtitvfmt_setAttribute(udtitvfmt
, UDTITVFMT_MINIMIZE_TYPE
, testItemPtr
->minimizeType
, &status
);
113 if ( U_FAILURE(status
) ) {
114 log_err("FAIL: udtitvfmt_setAttribute for locale %s, skeleton %s, tzid %s, minimizeType %d: %s\n",
115 testItemPtr
->locale
, testItemPtr
->skeleton
, tzidForLog
, (int)testItemPtr
->minimizeType
, myErrorName(status
) );
117 int32_t fmtLen
= udtitvfmt_format(udtitvfmt
, testItemPtr
->from
, testItemPtr
->to
, result
, kFormatBufLen
, NULL
, &status
);
118 if (fmtLen
>= kFormatBufLen
) {
119 result
[kFormatBufLen
-1] = 0;
121 if ( U_SUCCESS(status
) ) {
122 u_unescape(testItemPtr
->resultExpected
, resultExpected
, kFormatBufLen
);
123 if ( u_strcmp(result
, resultExpected
) != 0 ) {
124 char bcharBuf
[kFormatBufLen
];
126 log_err("ERROR: udtitvfmt_format for locale %s, skeleton %s, tzid %s, minimizeType %d, from %.1f, to %.1f: expect %s, get %s\n",
127 testItemPtr
->locale
, testItemPtr
->skeleton
, tzidForLog
, (int)testItemPtr
->minimizeType
,
128 testItemPtr
->from
, testItemPtr
->to
, testItemPtr
->resultExpected
, u_austrcpy(bcharBuf
,result
) );
130 // Apple-specific version
131 char bexpbuf
[kFormatBufLen
];
132 u_strToUTF8(bexpbuf
, kFormatBufLen
, NULL
, resultExpected
, -1, &status
);
133 u_strToUTF8(bcharBuf
, kFormatBufLen
, NULL
, result
, fmtLen
, &status
);
134 log_err("ERROR: udtitvfmt_format for locale %s, skeleton %s, tzid %s, minimizeType %d, from %.1f, to %.1f: expect %s, get %s\n",
135 testItemPtr
->locale
, testItemPtr
->skeleton
, tzidForLog
, (int)testItemPtr
->minimizeType
,
136 testItemPtr
->from
, testItemPtr
->to
, bexpbuf
, bcharBuf
);
140 log_err("FAIL: udtitvfmt_format for locale %s, skeleton %s, tzid %s, minimizeType %d, from %.1f, to %.1f: %s\n",
141 testItemPtr
->locale
, testItemPtr
->skeleton
, tzidForLog
, (int)testItemPtr
->minimizeType
,
142 testItemPtr
->from
, testItemPtr
->to
, myErrorName(status
) );
144 udtitvfmt_close(udtitvfmt
);
146 log_data_err("FAIL: udtitvfmt_open for locale %s, skeleton %s, tzid %s - %s\n",
147 testItemPtr
->locale
, testItemPtr
->skeleton
, tzidForLog
, myErrorName(status
) );
150 ctest_resetTimeZone();
153 /********************************************************************
154 * TestFPos_SkelWithSeconds and related data
155 ********************************************************************
158 static UChar zoneGMT
[] = { 0x47,0x4D,0x54,0 }; // GMT
159 static const UDate startTime
= 1416474000000.0; // 2014 Nov 20 09:00 GMT
161 static const double deltas
[] = {
163 200.0, // 200 millisec
167 43200000.0, // 12 hrs
168 691200000.0, // 8 days
169 1382400000.0, // 16 days,
170 8640000000.0, // 100 days
173 enum { kNumDeltas
= UPRV_LENGTHOF(deltas
) - 1 };
179 } ExpectPosAndFormat
;
181 static const ExpectPosAndFormat exp_en_HHmm
[kNumDeltas
] = {
185 { 3, 5, "09:00 \\u002D 09:20" },
186 { 3, 5, "09:00 \\u002D 11:00" },
187 { 3, 5, "09:00 \\u002D 21:00" },
188 { 15, 17, "11/20/2014, 09:00 \\u002D 11/28/2014, 09:00" },
189 { 15, 17, "11/20/2014, 09:00 \\u002D 12/6/2014, 09:00" },
190 { 15, 17, "11/20/2014, 09:00 \\u002D 2/28/2015, 09:00" }
193 static const ExpectPosAndFormat exp_en_HHmmss
[kNumDeltas
] = {
194 { 3, 5, "09:00:00" },
195 { 3, 5, "09:00:00" },
196 { 3, 5, "09:00:00 \\u002D 09:00:20" },
197 { 3, 5, "09:00:00 \\u002D 09:20:00" },
198 { 3, 5, "09:00:00 \\u002D 11:00:00" },
199 { 3, 5, "09:00:00 \\u002D 21:00:00" },
200 { 15, 17, "11/20/2014, 09:00:00 \\u002D 11/28/2014, 09:00:00" },
201 { 15, 17, "11/20/2014, 09:00:00 \\u002D 12/6/2014, 09:00:00" },
202 { 15, 17, "11/20/2014, 09:00:00 \\u002D 2/28/2015, 09:00:00" }
205 static const ExpectPosAndFormat exp_en_yyMMdd
[kNumDeltas
] = {
206 { 0, 0, "11/20/14" },
207 { 0, 0, "11/20/14" },
208 { 0, 0, "11/20/14" },
209 { 0, 0, "11/20/14" },
210 { 0, 0, "11/20/14" },
211 { 0, 0, "11/20/14" },
212 { 0, 0, "11/20/14 \\u002D 11/28/14" },
213 { 0, 0, "11/20/14 \\u002D 12/6/14" },
214 { 0, 0, "11/20/14 \\u002D 2/28/15" }
217 static const ExpectPosAndFormat exp_en_yyMMddHHmm
[kNumDeltas
] = {
218 { 13, 15, "11/20/14, 09:00" },
219 { 13, 15, "11/20/14, 09:00" },
220 { 13, 15, "11/20/14, 09:00" },
221 { 13, 15, "11/20/14, 09:00 \\u002D 09:20" },
222 { 13, 15, "11/20/14, 09:00 \\u002D 11:00" },
223 { 13, 15, "11/20/14, 09:00 \\u002D 21:00" },
224 { 13, 15, "11/20/14, 09:00 \\u002D 11/28/14, 09:00" },
225 { 13, 15, "11/20/14, 09:00 \\u002D 12/06/14, 09:00" },
226 { 13, 15, "11/20/14, 09:00 \\u002D 02/28/15, 09:00" }
229 static const ExpectPosAndFormat exp_en_yyMMddHHmmss
[kNumDeltas
] = {
230 { 13, 15, "11/20/14, 09:00:00" },
231 { 13, 15, "11/20/14, 09:00:00" },
232 { 13, 15, "11/20/14, 09:00:00 \\u002D 09:00:20" },
233 { 13, 15, "11/20/14, 09:00:00 \\u002D 09:20:00" },
234 { 13, 15, "11/20/14, 09:00:00 \\u002D 11:00:00" },
235 { 13, 15, "11/20/14, 09:00:00 \\u002D 21:00:00" },
236 { 13, 15, "11/20/14, 09:00:00 \\u002D 11/28/14, 09:00:00" },
237 { 13, 15, "11/20/14, 09:00:00 \\u002D 12/06/14, 09:00:00" },
238 { 13, 15, "11/20/14, 09:00:00 \\u002D 02/28/15, 09:00:00" }
241 static const ExpectPosAndFormat exp_en_yMMMdhmmssz
[kNumDeltas
] = {
242 { 16, 18, "Nov 20, 2014, 9:00:00 AM GMT" },
243 { 16, 18, "Nov 20, 2014, 9:00:00 AM GMT" },
244 { 16, 18, "Nov 20, 2014, 9:00:00 AM GMT \\u002D 9:00:20 AM GMT" },
245 { 16, 18, "Nov 20, 2014, 9:00:00 AM GMT \\u002D 9:20:00 AM GMT" },
246 { 16, 18, "Nov 20, 2014, 9:00:00 AM GMT \\u002D 11:00:00 AM GMT" },
247 { 16, 18, "Nov 20, 2014, 9:00:00 AM GMT \\u002D 9:00:00 PM GMT" },
248 { 16, 18, "Nov 20, 2014, 9:00:00 AM GMT \\u002D Nov 28, 2014, 9:00:00 AM GMT" },
249 { 16, 18, "Nov 20, 2014, 9:00:00 AM GMT \\u002D Dec 6, 2014, 9:00:00 AM GMT" },
250 { 16, 18, "Nov 20, 2014, 9:00:00 AM GMT \\u002D Feb 28, 2015, 9:00:00 AM GMT" }
253 static const ExpectPosAndFormat exp_ja_yyMMddHHmm
[kNumDeltas
] = {
254 { 11, 13, "14/11/20 9:00" },
255 { 11, 13, "14/11/20 9:00" },
256 { 11, 13, "14/11/20 9:00" },
257 { 11, 13, "14/11/20 9\\u664200\\u5206\\uFF5E9\\u664220\\u5206" },
258 { 11, 13, "14/11/20 9\\u664200\\u5206\\uFF5E11\\u664200\\u5206" },
259 { 11, 13, "14/11/20 9\\u664200\\u5206\\uFF5E21\\u664200\\u5206" },
260 { 11, 13, "14/11/20 9:00\\uFF5E14/11/28 9:00" },
261 { 11, 13, "14/11/20 9:00\\uFF5E14/12/06 9:00" },
262 { 11, 13, "14/11/20 9:00\\uFF5E15/02/28 9:00" }
265 static const ExpectPosAndFormat exp_ja_yyMMddHHmmss
[kNumDeltas
] = {
266 { 11, 13, "14/11/20 9:00:00" },
267 { 11, 13, "14/11/20 9:00:00" },
268 { 11, 13, "14/11/20 9:00:00\\uFF5E9:00:20" },
269 { 11, 13, "14/11/20 9:00:00\\uFF5E9:20:00" },
270 { 11, 13, "14/11/20 9:00:00\\uFF5E11:00:00" },
271 { 11, 13, "14/11/20 9:00:00\\uFF5E21:00:00" },
272 { 11, 13, "14/11/20 9:00:00\\uFF5E14/11/28 9:00:00" },
273 { 11, 13, "14/11/20 9:00:00\\uFF5E14/12/06 9:00:00" },
274 { 11, 13, "14/11/20 9:00:00\\uFF5E15/02/28 9:00:00" }
277 static const ExpectPosAndFormat exp_ja_yMMMdHHmmss
[kNumDeltas
] = {
278 { 14, 16, "2014\\u5E7411\\u670820\\u65E5 9:00:00" },
279 { 14, 16, "2014\\u5E7411\\u670820\\u65E5 9:00:00" },
280 { 14, 16, "2014\\u5E7411\\u670820\\u65E5 9:00:00\\uFF5E9:00:20" },
281 { 14, 16, "2014\\u5E7411\\u670820\\u65E5 9:00:00\\uFF5E9:20:00" },
282 { 14, 16, "2014\\u5E7411\\u670820\\u65E5 9:00:00\\uFF5E11:00:00" },
283 { 14, 16, "2014\\u5E7411\\u670820\\u65E5 9:00:00\\uFF5E21:00:00" },
284 { 14, 16, "2014\\u5E7411\\u670820\\u65E5 9:00:00\\uFF5E2014\\u5E7411\\u670828\\u65E5 9:00:00" },
285 { 14, 16, "2014\\u5E7411\\u670820\\u65E5 9:00:00\\uFF5E2014\\u5E7412\\u67086\\u65E5 9:00:00" },
286 { 14, 16, "2014\\u5E7411\\u670820\\u65E5 9:00:00\\uFF5E2015\\u5E742\\u670828\\u65E5 9:00:00" }
291 const char * skeleton
;
292 UDateFormatField fieldToCheck
;
293 const ExpectPosAndFormat
* expected
;
294 } LocaleAndSkeletonItem
;
296 static const LocaleAndSkeletonItem locSkelItems
[] = {
297 { "en", "HHmm", UDAT_MINUTE_FIELD
, exp_en_HHmm
},
298 { "en", "HHmmss", UDAT_MINUTE_FIELD
, exp_en_HHmmss
},
299 { "en", "yyMMdd", UDAT_MINUTE_FIELD
, exp_en_yyMMdd
},
300 { "en", "yyMMddHHmm", UDAT_MINUTE_FIELD
, exp_en_yyMMddHHmm
},
301 { "en", "yyMMddHHmmss", UDAT_MINUTE_FIELD
, exp_en_yyMMddHHmmss
},
302 { "en", "yMMMdhmmssz", UDAT_MINUTE_FIELD
, exp_en_yMMMdhmmssz
},
303 { "ja", "yyMMddHHmm", UDAT_MINUTE_FIELD
, exp_ja_yyMMddHHmm
},
304 { "ja", "yyMMddHHmmss", UDAT_MINUTE_FIELD
, exp_ja_yyMMddHHmmss
},
305 { "ja", "yMMMdHHmmss", UDAT_MINUTE_FIELD
, exp_ja_yMMMdHHmmss
},
306 { NULL
, NULL
, (UDateFormatField
)0, NULL
}
309 enum { kSizeUBuf
= 96, kSizeBBuf
= 192 };
311 static void TestFPos_SkelWithSeconds()
313 const LocaleAndSkeletonItem
* locSkelItemPtr
;
314 for (locSkelItemPtr
= locSkelItems
; locSkelItemPtr
->locale
!= NULL
; locSkelItemPtr
++) {
315 UDateIntervalFormat
* udifmt
;
316 UChar ubuf
[kSizeUBuf
];
318 UErrorCode status
= U_ZERO_ERROR
;
320 u_strFromUTF8(ubuf
, kSizeUBuf
, &ulen
, locSkelItemPtr
->skeleton
, -1, &status
);
321 udifmt
= udtitvfmt_open(locSkelItemPtr
->locale
, ubuf
, ulen
, zoneGMT
, -1, &status
);
322 if ( U_FAILURE(status
) ) {
323 log_data_err("FAIL: udtitvfmt_open for locale %s, skeleton %s: %s\n",
324 locSkelItemPtr
->locale
, locSkelItemPtr
->skeleton
, u_errorName(status
));
326 const double * deltasPtr
= deltas
;
327 const ExpectPosAndFormat
* expectedPtr
= locSkelItemPtr
->expected
;
328 for (; *deltasPtr
>= 0.0; deltasPtr
++, expectedPtr
++) {
329 UFieldPosition fpos
= { locSkelItemPtr
->fieldToCheck
, 0, 0 };
330 UChar uebuf
[kSizeUBuf
];
331 char bbuf
[kSizeBBuf
];
332 char bebuf
[kSizeBBuf
];
333 status
= U_ZERO_ERROR
;
334 uelen
= u_unescape(expectedPtr
->format
, uebuf
, kSizeUBuf
);
335 ulen
= udtitvfmt_format(udifmt
, startTime
, startTime
+ *deltasPtr
, ubuf
, kSizeUBuf
, &fpos
, &status
);
336 if ( U_FAILURE(status
) ) {
337 log_err("FAIL: udtitvfmt_format for locale %s, skeleton %s, delta %.1f: %s\n",
338 locSkelItemPtr
->locale
, locSkelItemPtr
->skeleton
, *deltasPtr
, u_errorName(status
));
339 } else if ( ulen
!= uelen
|| u_strncmp(ubuf
,uebuf
,uelen
) != 0 ||
340 fpos
.beginIndex
!= expectedPtr
->posBegin
|| fpos
.endIndex
!= expectedPtr
->posEnd
) {
341 u_strToUTF8(bbuf
, kSizeBBuf
, NULL
, ubuf
, ulen
, &status
);
342 u_strToUTF8(bebuf
, kSizeBBuf
, NULL
, uebuf
, uelen
, &status
); // convert back to get unescaped string
343 log_err("FAIL: udtitvfmt_format for locale %s, skeleton %s, delta %12.1f, expect %d-%d \"%s\", get %d-%d \"%s\"\n",
344 locSkelItemPtr
->locale
, locSkelItemPtr
->skeleton
, *deltasPtr
,
345 expectedPtr
->posBegin
, expectedPtr
->posEnd
, bebuf
,
346 fpos
.beginIndex
, fpos
.endIndex
, bbuf
);
349 udtitvfmt_close(udifmt
);
354 #endif /* #if !UCONFIG_NO_FORMATTING */