-/********************************************************************
- * COPYRIGHT:
- * Copyright (c) 1997-2004, International Business Machines Corporation and
- * others. All Rights Reserved.
- ********************************************************************/
-
+/************************************************************************
+ * COPYRIGHT:
+ * Copyright (c) 1997-2012, International Business Machines Corporation
+ * and others. All Rights Reserved.
+ ************************************************************************/
+
#ifndef _NUMBERFORMATTEST_
#define _NUMBERFORMATTEST_
#if !UCONFIG_NO_FORMATTING
#include "unicode/numfmt.h"
-#include "unicode/decimfmt.h"
+#include "unicode/decimfmt.h"
#include "caltztst.h"
/**
/**
* Test APIs (to increase code coverage)
- */
+ */
void TestAPI(void);
+
+ void TestCoverage(void);
+
/**
* Test the handling of quotes
**/
/**
* API coverage for DigitList
**/
- void TestDigitList(void);
-
+ //void TestDigitList(void);
+
/**
* Test localized currency patterns.
*/
void TestSecondaryGrouping(void);
void TestWhiteSpaceParsing(void);
-
+
void TestComplexCurrency(void);
-
+
void TestPad(void);
void TestPatterns2(void);
void TestCurrencyNames(void);
+ void TestCurrencyAmount(void);
+
+ void TestCurrencyUnit(void);
+
void TestSymbolsWithBadLocale(void);
void TestAdoptDecimalFormatSymbols(void);
void TestCases(void);
+ void TestJB3832(void);
+
+ void TestHost(void);
+
+ void TestHostClone(void);
+
+ void TestCurrencyFormat(void);
+
+ /* Port of ICU4J rounding test. */
+ void TestRounding(void);
+
+ void TestRoundingPattern(void);
+
+ void TestNonpositiveMultiplier(void);
+
+ void TestNumberingSystems();
+
+
+ void TestSpaceParsing();
+ void TestMultiCurrencySign();
+ void TestCurrencyFormatForMixParsing();
+ void TestDecimalFormatCurrencyParse();
+ void TestCurrencyIsoPluralFormat();
+ void TestCurrencyParsing();
+ void TestParseCurrencyInUCurr();
+ void TestFormatAttributes();
+ void TestFieldPositionIterator();
+
+ void TestLenientParse();
+
+ void TestDecimal();
+ void TestCurrencyFractionDigits();
+
+ void TestExponentParse();
+ void TestExplicitParents();
+ void TestAvailableNumberingSystems();
+ void Test9087();
+ void TestFormatFastpaths();
+
+ void TestFormattableSize();
+
+ void TestEnumSet();
+
private:
static UBool equalValue(const Formattable& a, const Formattable& b);
+ void expectPositions(FieldPositionIterator& iter, int32_t *values, int32_t tupleCount,
+ const UnicodeString& str);
+
+ void expectPosition(FieldPosition& pos, int32_t id, int32_t start, int32_t limit,
+ const UnicodeString& str);
+
void expect2(NumberFormat& fmt, const Formattable& n, const UnicodeString& str);
+ void expect3(NumberFormat& fmt, const Formattable& n, const UnicodeString& str);
+
void expect2(NumberFormat& fmt, const Formattable& n, const char* str) {
expect2(fmt, n, UnicodeString(str, ""));
}
void expectCurrency(NumberFormat& nf, const Locale& locale,
double value, const UnicodeString& string);
- void expectPat(DecimalFormat& fmt, const UnicodeString& exp);
-
- void expectPat(DecimalFormat& fmt, const char *exp) {
- expectPat(fmt, UnicodeString(exp, ""));
- }
-
- void expectPad(DecimalFormat& fmt, const UnicodeString& pat,
- int32_t pos);
-
- void expectPad(DecimalFormat& fmt, const char *pat,
- int32_t pos) {
- expectPad(fmt, pat, pos, 0, (UChar)0);
- }
-
void expectPad(DecimalFormat& fmt, const UnicodeString& pat,
int32_t pos, int32_t width, UChar pad);
expectPad(fmt, UnicodeString(pat, ""), pos, width, pad);
}
+ void expectPat(DecimalFormat& fmt, const UnicodeString& exp);
+
+ void expectPat(DecimalFormat& fmt, const char *exp) {
+ expectPat(fmt, UnicodeString(exp, ""));
+ }
+
+ void expectPad(DecimalFormat& fmt, const UnicodeString& pat,
+ int32_t pos);
+
+ void expectPad(DecimalFormat& fmt, const char *pat,
+ int32_t pos) {
+ expectPad(fmt, pat, pos, 0, (UChar)0);
+ }
+
+ void expect_rbnf(NumberFormat& fmt, const UnicodeString& str, const Formattable& n);
+
+ void expect_rbnf(NumberFormat& fmt, const Formattable& n,
+ const UnicodeString& exp, UBool rt=TRUE);
+
// internal utility routine
static UnicodeString& escape(UnicodeString& s);
// internal subtest used by TestRounding487
void roundingTest(NumberFormat& nf, double x, int32_t maxFractionDigits, const char* expected);
+
+ // internal rounding checking for TestRounding
+ void checkRounding(DecimalFormat* df, double base, int iterations, double increment);
+
+ double checkRound(DecimalFormat* df, double iValue, double lastParsed);
};
#endif /* #if !UCONFIG_NO_FORMATTING */
-
+
#endif // _NUMBERFORMATTEST_