| OLD | NEW |
| 1 /************************************************************************ | 1 /************************************************************************ |
| 2 * COPYRIGHT: | 2 * COPYRIGHT: |
| 3 * Copyright (c) 1997-2014, International Business Machines Corporation | 3 * Copyright (c) 1997-2015, 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 |
| 14 #include "unicode/numfmt.h" | 14 #include "unicode/numfmt.h" |
| 15 #include "unicode/decimfmt.h" | 15 #include "unicode/decimfmt.h" |
| 16 #include "caltztst.h" | 16 #include "caltztst.h" |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * Expected field positions from field position iterator. Tests should |
| 20 * stack allocate an array of these making sure that the last element is |
| 21 * {0, -1, 0} (The sentinel element indicating end of iterator). Then test |
| 22 * should call verifyFieldPositionIterator() passing both this array of |
| 23 * expected results and the field position iterator from the format method. |
| 24 */ |
| 25 struct NumberFormatTest_Attributes { |
| 26 int32_t id; |
| 27 int32_t spos; |
| 28 int32_t epos; |
| 29 }; |
| 30 |
| 31 /** |
| 19 * Performs various in-depth test on NumberFormat | 32 * Performs various in-depth test on NumberFormat |
| 20 **/ | 33 **/ |
| 21 class NumberFormatTest: public CalendarTimeZoneTest { | 34 class NumberFormatTest: public CalendarTimeZoneTest { |
| 22 | 35 |
| 23 // IntlTest override | 36 // IntlTest override |
| 24 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par
); | 37 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par
); |
| 25 public: | 38 public: |
| 26 | 39 |
| 27 /** | 40 /** |
| 28 * Test APIs (to increase code coverage) | 41 * Test APIs (to increase code coverage) |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 189 |
| 177 void TestParseSignsAndMarks(); | 190 void TestParseSignsAndMarks(); |
| 178 void Test10419RoundingWith0FractionDigits(); | 191 void Test10419RoundingWith0FractionDigits(); |
| 179 void Test10468ApplyPattern(); | 192 void Test10468ApplyPattern(); |
| 180 void TestRoundingScientific10542(); | 193 void TestRoundingScientific10542(); |
| 181 void TestZeroScientific10547(); | 194 void TestZeroScientific10547(); |
| 182 void TestAccountingCurrency(); | 195 void TestAccountingCurrency(); |
| 183 void TestEquality(); | 196 void TestEquality(); |
| 184 | 197 |
| 185 void TestCurrencyUsage(); | 198 void TestCurrencyUsage(); |
| 199 void TestNumberFormatTestTuple(); |
| 200 void TestDataDriven(); |
| 201 |
| 202 void TestDoubleLimit11439(); |
| 203 void TestFastPathConsistent11524(); |
| 204 void TestGetAffixes(); |
| 205 void TestToPatternScientific11648(); |
| 206 void TestBenchmark(); |
| 207 void TestCtorApplyPatternDifference(); |
| 208 void TestFractionalDigitsForCurrency(); |
| 209 void TestFormatCurrencyPlural(); |
| 210 void Test11868(); |
| 211 void Test10727_RoundingZero(); |
| 212 void Test11376_getAndSetPositivePrefix(); |
| 213 void Test11475_signRecognition(); |
| 214 void Test11640_getAffixes(); |
| 215 void Test11649_toPatternWithMultiCurrency(); |
| 186 | 216 |
| 187 private: | 217 private: |
| 188 UBool testFormattableAsUFormattable(const char *file, int line, Formattable
&f); | 218 UBool testFormattableAsUFormattable(const char *file, int line, Formattable
&f); |
| 189 | 219 |
| 190 void expectParseCurrency(const NumberFormat &fmt, const UChar* currency, dou
ble amount, const char *text); | 220 void expectParseCurrency(const NumberFormat &fmt, const UChar* currency, dou
ble amount, const char *text); |
| 191 | 221 |
| 192 static UBool equalValue(const Formattable& a, const Formattable& b); | 222 static UBool equalValue(const Formattable& a, const Formattable& b); |
| 193 | 223 |
| 194 void expectPositions(FieldPositionIterator& iter, int32_t *values, int32_t t
upleCount, | 224 void expectPositions(FieldPositionIterator& iter, int32_t *values, int32_t t
upleCount, |
| 195 const UnicodeString& str); | 225 const UnicodeString& str); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 326 |
| 297 void verifyRounding( | 327 void verifyRounding( |
| 298 DecimalFormat& format, | 328 DecimalFormat& format, |
| 299 const double *values, | 329 const double *values, |
| 300 const char * const *expected, | 330 const char * const *expected, |
| 301 const DecimalFormat::ERoundingMode *roundingModes, | 331 const DecimalFormat::ERoundingMode *roundingModes, |
| 302 const char * const *descriptions, | 332 const char * const *descriptions, |
| 303 int32_t valueSize, | 333 int32_t valueSize, |
| 304 int32_t roundingModeSize); | 334 int32_t roundingModeSize); |
| 305 | 335 |
| 336 void verifyFieldPositionIterator( |
| 337 NumberFormatTest_Attributes *expected, |
| 338 FieldPositionIterator &iter); |
| 339 |
| 306 }; | 340 }; |
| 307 | 341 |
| 308 #endif /* #if !UCONFIG_NO_FORMATTING */ | 342 #endif /* #if !UCONFIG_NO_FORMATTING */ |
| 309 | 343 |
| 310 #endif // _NUMBERFORMATTEST_ | 344 #endif // _NUMBERFORMATTEST_ |
| OLD | NEW |