| OLD | NEW |
| 1 /******************************************************************** | 1 /******************************************************************** |
| 2 * COPYRIGHT: | 2 * COPYRIGHT: |
| 3 * Copyright (c) 2005-2012, International Business Machines Corporation and | 3 * Copyright (c) 2005-2014, International Business Machines Corporation and |
| 4 * others. All Rights Reserved. | 4 * others. All Rights Reserved. |
| 5 ********************************************************************/ | 5 ********************************************************************/ |
| 6 #include "unicode/utypes.h" | 6 #include "unicode/utypes.h" |
| 7 | 7 |
| 8 #if !UCONFIG_NO_FORMATTING | 8 #if !UCONFIG_NO_FORMATTING |
| 9 #include "unicode/unum.h" | 9 #include "unicode/unum.h" |
| 10 #include "unicode/ucurr.h" | 10 #include "unicode/ucurr.h" |
| 11 #include "unicode/ustring.h" | 11 #include "unicode/ustring.h" |
| 12 #include "cintltst.h" | 12 #include "cintltst.h" |
| 13 #include "cstring.h" | 13 #include "cstring.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 if (checkItemCount(UCURR_COMMON|UCURR_UNCOMMON) != 0) { | 152 if (checkItemCount(UCURR_COMMON|UCURR_UNCOMMON) != 0) { |
| 153 log_err("Error: UCURR_DEPRECATED|UCURR_NON_DEPRECATED should return 0 it
ems\n"); | 153 log_err("Error: UCURR_DEPRECATED|UCURR_NON_DEPRECATED should return 0 it
ems\n"); |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 | 156 |
| 157 static void TestFractionDigitOverride(void) { | 157 static void TestFractionDigitOverride(void) { |
| 158 UErrorCode status = U_ZERO_ERROR; | 158 UErrorCode status = U_ZERO_ERROR; |
| 159 UNumberFormat *fmt = unum_open(UNUM_CURRENCY, NULL, 0, "hu_HU", NULL, &statu
s); | 159 UNumberFormat *fmt = unum_open(UNUM_CURRENCY, NULL, 0, "hu_HU", NULL, &statu
s); |
| 160 UChar buffer[256]; | 160 UChar buffer[256]; |
| 161 UChar expectedBuf[256]; | 161 UChar expectedBuf[256]; |
| 162 const char expectedFirst[] = "123\\u00A0Ft"; | 162 const char expectedFirst[] = "123,46\\u00A0HUF"; /* changed to use 2 fractio
n digits */ |
| 163 const char expectedSecond[] = "123,46\\u00A0Ft"; | 163 const char expectedSecond[] = "123,46\\u00A0HUF"; |
| 164 const char expectedThird[] = "123,456\\u00A0Ft"; | 164 const char expectedThird[] = "123,456\\u00A0HUF"; |
| 165 if (U_FAILURE(status)) { | 165 if (U_FAILURE(status)) { |
| 166 log_data_err("Error: unum_open returned %s (Are you missing data?)\n", my
ErrorName(status)); | 166 log_data_err("Error: unum_open returned %s (Are you missing data?)\n", my
ErrorName(status)); |
| 167 return; | 167 return; |
| 168 } | 168 } |
| 169 /* Make sure that you can format normal fraction digits. */ | 169 /* Make sure that you can format normal fraction digits. */ |
| 170 unum_formatDouble(fmt, 123.456, buffer, sizeof(buffer)/sizeof(buffer[0]), NU
LL, &status); | 170 unum_formatDouble(fmt, 123.456, buffer, sizeof(buffer)/sizeof(buffer[0]), NU
LL, &status); |
| 171 u_unescape(expectedFirst, expectedBuf, strlen(expectedFirst)+1); | 171 u_unescape(expectedFirst, expectedBuf, strlen(expectedFirst)+1); |
| 172 if (u_strcmp(buffer, expectedBuf) != 0) { | 172 if (u_strcmp(buffer, expectedBuf) != 0) { |
| 173 log_err("Error: unum_formatDouble didn't return %s\n", expectedFirst); | 173 log_err("Error: unum_formatDouble didn't return %s\n", expectedFirst); |
| 174 } | 174 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 { | 266 { |
| 267 TESTCASE(TestEnumList); | 267 TESTCASE(TestEnumList); |
| 268 TESTCASE(TestEnumListReset); | 268 TESTCASE(TestEnumListReset); |
| 269 TESTCASE(TestEnumListCount); | 269 TESTCASE(TestEnumListCount); |
| 270 TESTCASE(TestFractionDigitOverride); | 270 TESTCASE(TestFractionDigitOverride); |
| 271 TESTCASE(TestPrefixSuffix); | 271 TESTCASE(TestPrefixSuffix); |
| 272 TESTCASE(TestNumericCode); | 272 TESTCASE(TestNumericCode); |
| 273 } | 273 } |
| 274 | 274 |
| 275 #endif /* #if !UCONFIG_NO_FORMATTING */ | 275 #endif /* #if !UCONFIG_NO_FORMATTING */ |
| OLD | NEW |