OLD | NEW |
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 #ifndef _NUMBERFORMATTEST_ | 7 #ifndef _NUMBERFORMATTEST_ |
8 #define _NUMBERFORMATTEST_ | 8 #define _NUMBERFORMATTEST_ |
9 | 9 |
10 #include "unicode/utypes.h" | 10 #include "unicode/utypes.h" |
11 | 11 |
12 #if !UCONFIG_NO_FORMATTING | 12 #if !UCONFIG_NO_FORMATTING |
13 | 13 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 void TestShowZero(); | 168 void TestShowZero(); |
169 | 169 |
170 void TestCompatibleCurrencies(); | 170 void TestCompatibleCurrencies(); |
171 void TestBug9936(); | 171 void TestBug9936(); |
172 void TestParseNegativeWithFaLocale(); | 172 void TestParseNegativeWithFaLocale(); |
173 void TestParseNegativeWithAlternateMinusSign(); | 173 void TestParseNegativeWithAlternateMinusSign(); |
174 | 174 |
175 void TestCustomCurrencySignAndSeparator(); | 175 void TestCustomCurrencySignAndSeparator(); |
176 | 176 |
177 void TestParseSignsAndMarks(); | 177 void TestParseSignsAndMarks(); |
| 178 void Test10419RoundingWith0FractionDigits(); |
| 179 void Test10468ApplyPattern(); |
| 180 void TestRoundingScientific10542(); |
| 181 void TestZeroScientific10547(); |
| 182 void TestAccountingCurrency(); |
| 183 void TestEquality(); |
| 184 |
| 185 void TestCurrencyUsage(); |
178 | 186 |
179 private: | 187 private: |
180 UBool testFormattableAsUFormattable(const char *file, int line, Formattable
&f); | 188 UBool testFormattableAsUFormattable(const char *file, int line, Formattable
&f); |
181 | 189 |
182 void expectParseCurrency(const NumberFormat &fmt, const UChar* currency, dou
ble amount, const char *text); | 190 void expectParseCurrency(const NumberFormat &fmt, const UChar* currency, dou
ble amount, const char *text); |
183 | 191 |
184 static UBool equalValue(const Formattable& a, const Formattable& b); | 192 static UBool equalValue(const Formattable& a, const Formattable& b); |
185 | 193 |
186 void expectPositions(FieldPositionIterator& iter, int32_t *values, int32_t t
upleCount, | 194 void expectPositions(FieldPositionIterator& iter, int32_t *values, int32_t t
upleCount, |
187 const UnicodeString& str); | 195 const UnicodeString& str); |
(...skipping 23 matching lines...) Expand all Loading... |
211 | 219 |
212 void expect(NumberFormat& fmt, const Formattable& n, | 220 void expect(NumberFormat& fmt, const Formattable& n, |
213 const UnicodeString& exp, UBool rt=TRUE); | 221 const UnicodeString& exp, UBool rt=TRUE); |
214 | 222 |
215 void expect(NumberFormat& fmt, const Formattable& n, | 223 void expect(NumberFormat& fmt, const Formattable& n, |
216 const char *exp, UBool rt=TRUE) { | 224 const char *exp, UBool rt=TRUE) { |
217 expect(fmt, n, UnicodeString(exp, ""), rt); | 225 expect(fmt, n, UnicodeString(exp, ""), rt); |
218 } | 226 } |
219 | 227 |
220 void expect(NumberFormat* fmt, const Formattable& n, | 228 void expect(NumberFormat* fmt, const Formattable& n, |
221 const UnicodeString& exp, UErrorCode); | 229 const UnicodeString& exp, UBool rt, UErrorCode errorCode); |
| 230 |
| 231 void expect(NumberFormat* fmt, const Formattable& n, |
| 232 const char *exp, UBool rt, UErrorCode errorCode) { |
| 233 expect(fmt, n, UnicodeString(exp, ""), rt, errorCode); |
| 234 } |
| 235 |
| 236 void expect(NumberFormat* fmt, const Formattable& n, |
| 237 const UnicodeString& exp, UErrorCode errorCode) { |
| 238 expect(fmt, n, exp, TRUE, errorCode); |
| 239 } |
222 | 240 |
223 void expect(NumberFormat* fmt, const Formattable& n, | 241 void expect(NumberFormat* fmt, const Formattable& n, |
224 const char *exp, UErrorCode errorCode) { | 242 const char *exp, UErrorCode errorCode) { |
225 expect(fmt, n, UnicodeString(exp, ""), errorCode); | 243 expect(fmt, n, UnicodeString(exp, ""), TRUE, errorCode); |
226 } | 244 } |
227 | 245 |
228 void expectCurrency(NumberFormat& nf, const Locale& locale, | 246 void expectCurrency(NumberFormat& nf, const Locale& locale, |
229 double value, const UnicodeString& string); | 247 double value, const UnicodeString& string); |
230 | 248 |
231 void expectPad(DecimalFormat& fmt, const UnicodeString& pat, | 249 void expectPad(DecimalFormat& fmt, const UnicodeString& pat, |
232 int32_t pos, int32_t width, UChar pad); | 250 int32_t pos, int32_t width, UChar pad); |
233 | 251 |
234 void expectPad(DecimalFormat& fmt, const char *pat, | 252 void expectPad(DecimalFormat& fmt, const char *pat, |
235 int32_t pos, int32_t width, UChar pad) { | 253 int32_t pos, int32_t width, UChar pad) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 286 |
269 enum { ILLEGAL = -1 }; | 287 enum { ILLEGAL = -1 }; |
270 | 288 |
271 // internal subtest used by TestRounding487 | 289 // internal subtest used by TestRounding487 |
272 void roundingTest(NumberFormat& nf, double x, int32_t maxFractionDigits, con
st char* expected); | 290 void roundingTest(NumberFormat& nf, double x, int32_t maxFractionDigits, con
st char* expected); |
273 | 291 |
274 // internal rounding checking for TestRounding | 292 // internal rounding checking for TestRounding |
275 void checkRounding(DecimalFormat* df, double base, int iterations, double in
crement); | 293 void checkRounding(DecimalFormat* df, double base, int iterations, double in
crement); |
276 | 294 |
277 double checkRound(DecimalFormat* df, double iValue, double lastParsed); | 295 double checkRound(DecimalFormat* df, double iValue, double lastParsed); |
| 296 |
| 297 void verifyRounding( |
| 298 DecimalFormat& format, |
| 299 const double *values, |
| 300 const char * const *expected, |
| 301 const DecimalFormat::ERoundingMode *roundingModes, |
| 302 const char * const *descriptions, |
| 303 int32_t valueSize, |
| 304 int32_t roundingModeSize); |
| 305 |
278 }; | 306 }; |
279 | 307 |
280 #endif /* #if !UCONFIG_NO_FORMATTING */ | 308 #endif /* #if !UCONFIG_NO_FORMATTING */ |
281 | 309 |
282 #endif // _NUMBERFORMATTEST_ | 310 #endif // _NUMBERFORMATTEST_ |
OLD | NEW |