X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/729e4ab9bc6618bc3d8a898e575df7f4019e29ca..f59164e3d128c7675a4d3934206346a3384e53a5:/icuSources/test/intltest/numfmtst.h diff --git a/icuSources/test/intltest/numfmtst.h b/icuSources/test/intltest/numfmtst.h index cd487f21..04d1f8fa 100644 --- a/icuSources/test/intltest/numfmtst.h +++ b/icuSources/test/intltest/numfmtst.h @@ -1,6 +1,6 @@ /************************************************************************ * COPYRIGHT: - * Copyright (c) 1997-2010, International Business Machines Corporation + * Copyright (c) 1997-2016, International Business Machines Corporation * and others. All Rights Reserved. ************************************************************************/ @@ -15,6 +15,19 @@ #include "unicode/decimfmt.h" #include "caltztst.h" +/** + * Expected field positions from field position iterator. Tests should + * stack allocate an array of these making sure that the last element is + * {0, -1, 0} (The sentinel element indicating end of iterator). Then test + * should call verifyFieldPositionIterator() passing both this array of + * expected results and the field position iterator from the format method. + */ +struct NumberFormatTest_Attributes { + int32_t id; + int32_t spos; + int32_t epos; +}; + /** * Performs various in-depth test on NumberFormat **/ @@ -130,6 +143,8 @@ class NumberFormatTest: public CalendarTimeZoneTest { /* Port of ICU4J rounding test. */ void TestRounding(void); + void TestRoundingPattern(void); + void TestNonpositiveMultiplier(void); void TestNumberingSystems(); @@ -151,8 +166,60 @@ class NumberFormatTest: public CalendarTimeZoneTest { void TestCurrencyFractionDigits(); void TestExponentParse(); + void TestExplicitParents(); + void TestAvailableNumberingSystems(); + void Test9087(); + void TestFormatFastpaths(); + + void TestFormattableSize(); + + void TestUFormattable(); + + void TestEnumSet(); + + void TestSignificantDigits(); + void TestShowZero(); + + void TestCompatibleCurrencies(); + void TestBug9936(); + void TestParseNegativeWithFaLocale(); + void TestParseNegativeWithAlternateMinusSign(); + + void TestCustomCurrencySignAndSeparator(); + + void TestParseSignsAndMarks(); + void Test10419RoundingWith0FractionDigits(); + void Test10468ApplyPattern(); + void TestRoundingScientific10542(); + void TestZeroScientific10547(); + void TestAccountingCurrency(); + void TestEquality(); + + void TestCurrencyUsage(); + void TestNumberFormatTestTuple(); + void TestDataDriven(); + + void TestDoubleLimit11439(); + void TestFastPathConsistent11524(); + void TestGetAffixes(); + void TestToPatternScientific11648(); + void TestBenchmark(); + void TestCtorApplyPatternDifference(); + void TestFractionalDigitsForCurrency(); + void TestFormatCurrencyPlural(); + void Test11868(); + void Test10727_RoundingZero(); + void Test11376_getAndSetPositivePrefix(); + void Test11475_signRecognition(); + void Test11640_getAffixes(); + void Test11649_toPatternWithMultiCurrency(); + + void checkExceptionIssue11735(); private: + UBool testFormattableAsUFormattable(const char *file, int line, Formattable &f); + + void expectParseCurrency(const NumberFormat &fmt, const UChar* currency, double amount, const char *text); static UBool equalValue(const Formattable& a, const Formattable& b); @@ -191,11 +258,21 @@ class NumberFormatTest: public CalendarTimeZoneTest { } void expect(NumberFormat* fmt, const Formattable& n, - const UnicodeString& exp, UErrorCode); + const UnicodeString& exp, UBool rt, UErrorCode errorCode); + + void expect(NumberFormat* fmt, const Formattable& n, + const char *exp, UBool rt, UErrorCode errorCode) { + expect(fmt, n, UnicodeString(exp, ""), rt, errorCode); + } + + void expect(NumberFormat* fmt, const Formattable& n, + const UnicodeString& exp, UErrorCode errorCode) { + expect(fmt, n, exp, TRUE, errorCode); + } void expect(NumberFormat* fmt, const Formattable& n, const char *exp, UErrorCode errorCode) { - expect(fmt, n, UnicodeString(exp, ""), errorCode); + expect(fmt, n, UnicodeString(exp, ""), TRUE, errorCode); } void expectCurrency(NumberFormat& nf, const Locale& locale, @@ -248,6 +325,20 @@ class NumberFormatTest: public CalendarTimeZoneTest { void checkRounding(DecimalFormat* df, double base, int iterations, double increment); double checkRound(DecimalFormat* df, double iValue, double lastParsed); + + void verifyRounding( + DecimalFormat& format, + const double *values, + const char * const *expected, + const DecimalFormat::ERoundingMode *roundingModes, + const char * const *descriptions, + int32_t valueSize, + int32_t roundingModeSize); + + void verifyFieldPositionIterator( + NumberFormatTest_Attributes *expected, + FieldPositionIterator &iter); + }; #endif /* #if !UCONFIG_NO_FORMATTING */