OLD | NEW |
1 /******************************************************************** | 1 /******************************************************************** |
2 * COPYRIGHT: | 2 * COPYRIGHT: |
3 * Copyright (c) 1997-2011, 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 * Copyright (C) 2010 , Yahoo! Inc. | 5 * Copyright (C) 2010 , Yahoo! Inc. |
6 ********************************************************************/ | 6 ********************************************************************/ |
7 | 7 |
8 #include "unicode/utypes.h" | 8 #include "unicode/utypes.h" |
9 | 9 |
10 #if !UCONFIG_NO_FORMATTING | 10 #if !UCONFIG_NO_FORMATTING |
11 | 11 |
12 #include "selfmts.h" | 12 #include "selfmts.h" |
13 #include "cmemory.h" | 13 #include "cmemory.h" |
14 #include "unicode/selfmt.h" | 14 #include "unicode/selfmt.h" |
15 | 15 |
16 #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) | |
17 | |
18 #define SIMPLE_PATTERN_STRING
"feminine {feminineVerbValue} other{otherVerbValue}" | 16 #define SIMPLE_PATTERN_STRING
"feminine {feminineVerbValue} other{otherVerbValue}" |
19 | 17 |
20 | 18 |
21 #define SELECT_PATTERN_DATA 4 | 19 #define SELECT_PATTERN_DATA 4 |
22 #define SELECT_SYNTAX_DATA 10 | 20 #define SELECT_SYNTAX_DATA 10 |
23 #define EXP_FORMAT_RESULT_DATA 12 | 21 #define EXP_FORMAT_RESULT_DATA 12 |
24 #define NUM_OF_FORMAT_ARGS 3 | 22 #define NUM_OF_FORMAT_ARGS 3 |
25 | 23 |
26 #define VERBOSE_INT(x) {logln("%s:%d: int %s=%d\n", __FILE__, __LINE__, #x, (x)
);} | 24 #define VERBOSE_INT(x) {logln("%s:%d: int %s=%d\n", __FILE__, __LINE__, #x, (x)
);} |
27 #define VERBOSE_USTRING(text) {logln("%s:%d: UnicodeString %s(%d) = ", __FILE__,
__LINE__, #text, text.length()); logln(UnicodeString(" \"")+text+UnicodeString(
"\";"));} | 25 #define VERBOSE_USTRING(text) {logln("%s:%d: UnicodeString %s(%d) = ", __FILE__,
__LINE__, #text, text.length()); logln(UnicodeString(" \"")+text+UnicodeString(
"\";"));} |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 "Key word-_", | 174 "Key word-_", |
177 " Keyword-_", | 175 " Keyword-_", |
178 "Key*word-_", | 176 "Key*word-_", |
179 "*Keyword-_" | 177 "*Keyword-_" |
180 }; | 178 }; |
181 | 179 |
182 delete selFmt; | 180 delete selFmt; |
183 selFmt = NULL; | 181 selFmt = NULL; |
184 | 182 |
185 selFmt = new SelectFormat( SIMPLE_PATTERN , status); | 183 selFmt = new SelectFormat( SIMPLE_PATTERN , status); |
186 for (int32_t i = 0; i < LENGTHOF(keywords); i++ ){ | 184 for (int32_t i = 0; i < UPRV_LENGTHOF(keywords); i++ ){ |
187 status = U_ZERO_ERROR; | 185 status = U_ZERO_ERROR; |
188 selFmt->format( keywords[i], result , ignore , status); | 186 selFmt->format( keywords[i], result , ignore , status); |
189 if (!U_FAILURE(status)) { | 187 if (!U_FAILURE(status)) { |
190 errln("ERROR: SelectFormat Unit test failed in format() with keyWord
and with an invalid keyword as : "+ | 188 errln("ERROR: SelectFormat Unit test failed in format() with keyWord
and with an invalid keyword as : "+ |
191 keywords[i]+" ("+u_errorName(status)+")"); | 189 keywords[i]+" ("+u_errorName(status)+")"); |
192 } | 190 } |
193 } | 191 } |
194 | 192 |
195 delete selFmt; | 193 delete selFmt; |
196 } | 194 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 UnicodeString expected=UnicodeString("otherVerbValue"); | 318 UnicodeString expected=UnicodeString("otherVerbValue"); |
321 if( result1 != expected ){ | 319 if( result1 != expected ){ |
322 errln("ERROR: SelectFormat API test failed in format() with unexpect
ed result with Formattable"); | 320 errln("ERROR: SelectFormat API test failed in format() with unexpect
ed result with Formattable"); |
323 } | 321 } |
324 } | 322 } |
325 | 323 |
326 | 324 |
327 delete selFmt1; | 325 delete selFmt1; |
328 } | 326 } |
329 #endif /* #if !UCONFIG_NO_FORMATTING */ | 327 #endif /* #if !UCONFIG_NO_FORMATTING */ |
OLD | NEW |