| OLD | NEW |
| 1 /******************************************************************** | 1 /******************************************************************** |
| 2 * COPYRIGHT: | 2 * COPYRIGHT: |
| 3 * Copyright (c) 1997-2010, International Business Machines Corporation and | 3 * Copyright (c) 1997-2010, International Business Machines Corporation and |
| 4 * others. All Rights Reserved. | 4 * others. All Rights Reserved. |
| 5 ********************************************************************/ | 5 ********************************************************************/ |
| 6 | 6 |
| 7 #include "loctest.h" | 7 #include "loctest.h" |
| 8 #include "unicode/decimfmt.h" | 8 #include "unicode/decimfmt.h" |
| 9 #include "unicode/ucurr.h" | 9 #include "unicode/ucurr.h" |
| 10 #include "unicode/smpdtfmt.h" | 10 #include "unicode/smpdtfmt.h" |
| (...skipping 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1840 delete cal; | 1840 delete cal; |
| 1841 #endif | 1841 #endif |
| 1842 | 1842 |
| 1843 // DecimalFormat, DecimalFormatSymbols | 1843 // DecimalFormat, DecimalFormatSymbols |
| 1844 #if !UCONFIG_NO_FORMATTING | 1844 #if !UCONFIG_NO_FORMATTING |
| 1845 req = "fr_FR_NICE"; | 1845 req = "fr_FR_NICE"; |
| 1846 NumberFormat* nf = NumberFormat::createInstance(Locale::createFromName(req),
ec); | 1846 NumberFormat* nf = NumberFormat::createInstance(Locale::createFromName(req),
ec); |
| 1847 if (U_FAILURE(ec)) { | 1847 if (U_FAILURE(ec)) { |
| 1848 dataerrln("FAIL: NumberFormat::createInstance failed - %s", u_errorName(
ec)); | 1848 dataerrln("FAIL: NumberFormat::createInstance failed - %s", u_errorName(
ec)); |
| 1849 } else { | 1849 } else { |
| 1850 DecimalFormat* dec = dynamic_cast<DecimalFormat*>(nf); | 1850 DecimalFormat* dec = CR_DYNAMIC_CAST<DecimalFormat*>(nf); |
| 1851 if (dec == NULL) { | 1851 if (dec == NULL) { |
| 1852 errln("FAIL: NumberFormat::createInstance does not return a DecimalF
ormat"); | 1852 errln("FAIL: NumberFormat::createInstance does not return a DecimalF
ormat"); |
| 1853 return; | 1853 return; |
| 1854 } | 1854 } |
| 1855 valid = dec->getLocale(ULOC_VALID_LOCALE, ec); | 1855 valid = dec->getLocale(ULOC_VALID_LOCALE, ec); |
| 1856 actual = dec->getLocale(ULOC_ACTUAL_LOCALE, ec); | 1856 actual = dec->getLocale(ULOC_ACTUAL_LOCALE, ec); |
| 1857 if (U_FAILURE(ec)) { | 1857 if (U_FAILURE(ec)) { |
| 1858 errln("FAIL: DecimalFormat::getLocale() failed"); | 1858 errln("FAIL: DecimalFormat::getLocale() failed"); |
| 1859 } else { | 1859 } else { |
| 1860 _checklocs("DecimalFormat", req, valid, actual); | 1860 _checklocs("DecimalFormat", req, valid, actual); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1878 | 1878 |
| 1879 // DateFormat, DateFormatSymbols | 1879 // DateFormat, DateFormatSymbols |
| 1880 #if !UCONFIG_NO_FORMATTING | 1880 #if !UCONFIG_NO_FORMATTING |
| 1881 req = "de_CH_LUCERNE"; | 1881 req = "de_CH_LUCERNE"; |
| 1882 DateFormat* df = | 1882 DateFormat* df = |
| 1883 DateFormat::createDateInstance(DateFormat::kDefault, | 1883 DateFormat::createDateInstance(DateFormat::kDefault, |
| 1884 Locale::createFromName(req)); | 1884 Locale::createFromName(req)); |
| 1885 if (df == 0){ | 1885 if (df == 0){ |
| 1886 dataerrln("Error calling DateFormat::createDateInstance()"); | 1886 dataerrln("Error calling DateFormat::createDateInstance()"); |
| 1887 } else { | 1887 } else { |
| 1888 SimpleDateFormat* dat = dynamic_cast<SimpleDateFormat*>(df); | 1888 SimpleDateFormat* dat = CR_DYNAMIC_CAST<SimpleDateFormat*>(df); |
| 1889 if (dat == NULL) { | 1889 if (dat == NULL) { |
| 1890 errln("FAIL: DateFormat::createInstance does not return a SimpleDate
Format"); | 1890 errln("FAIL: DateFormat::createInstance does not return a SimpleDate
Format"); |
| 1891 return; | 1891 return; |
| 1892 } | 1892 } |
| 1893 valid = dat->getLocale(ULOC_VALID_LOCALE, ec); | 1893 valid = dat->getLocale(ULOC_VALID_LOCALE, ec); |
| 1894 actual = dat->getLocale(ULOC_ACTUAL_LOCALE, ec); | 1894 actual = dat->getLocale(ULOC_ACTUAL_LOCALE, ec); |
| 1895 if (U_FAILURE(ec)) { | 1895 if (U_FAILURE(ec)) { |
| 1896 errln("FAIL: SimpleDateFormat::getLocale() failed"); | 1896 errln("FAIL: SimpleDateFormat::getLocale() failed"); |
| 1897 } else { | 1897 } else { |
| 1898 _checklocs("SimpleDateFormat", req, valid, actual); | 1898 _checklocs("SimpleDateFormat", req, valid, actual); |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2512 const char *variant = l.getVariant(); | 2512 const char *variant = l.getVariant(); |
| 2513 logln(variant); | 2513 logln(variant); |
| 2514 test_assert(strcmp("VALLEY", variant) == 0); | 2514 test_assert(strcmp("VALLEY", variant) == 0); |
| 2515 | 2515 |
| 2516 UErrorCode status = U_ZERO_ERROR; | 2516 UErrorCode status = U_ZERO_ERROR; |
| 2517 char buffer[50]; | 2517 char buffer[50]; |
| 2518 int32_t len = l.getKeywordValue("foo", buffer, 50, status); | 2518 int32_t len = l.getKeywordValue("foo", buffer, 50, status); |
| 2519 buffer[len] = '\0'; | 2519 buffer[len] = '\0'; |
| 2520 test_assert(strcmp("value", buffer) == 0); | 2520 test_assert(strcmp("value", buffer) == 0); |
| 2521 } | 2521 } |
| OLD | NEW |