home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / test / intltest / numfmtst.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-16  |  2.5 KB  |  87 lines

  1.  
  2. /*
  3. ********************************************************************
  4. * COPYRIGHT: 
  5. * (C) Copyright Taligent, Inc., 1997
  6. * (C) Copyright International Business Machines Corporation, 1997 - 1998
  7. * Licensed Material - Program-Property of IBM - All Rights Reserved. 
  8. * US Government Users Restricted Rights - Use, duplication, or disclosure 
  9. * restricted by GSA ADP Schedule Contract with IBM Corp. 
  10. *
  11. ********************************************************************
  12. */
  13.  
  14. #ifndef _NUMBERFORMATTEST_
  15. #define _NUMBERFORMATTEST_
  16.  
  17. #include "utypes.h"
  18. #include "caltztst.h"
  19. class NumberFormat;
  20. class DecimalFormat;
  21.  
  22. /**
  23.  * Performs various in-depth test on NumberFormat
  24.  **/
  25. class NumberFormatTest: public CalendarTimeZoneTest {
  26.     // IntlTest override
  27.     void runIndexedTest( int32_t index, bool_t exec, char* &name, char* par );
  28. public:
  29.     /*
  30.      * Test the handling of quotes
  31.      **/
  32.     virtual void TestQuotes();
  33.     /**
  34.      * Test patterns with exponential representation
  35.      **/
  36.     virtual void TestExponential();
  37.     /**
  38.      * Test handling of patterns with currency symbols
  39.      **/
  40.     virtual void TestCurrencySign();
  41.     /**
  42.      * Test different format patterns
  43.      **/
  44.     virtual void TestPatterns();
  45.  
  46. public: // package
  47.     // internal utility routine
  48.     static UnicodeString& escape(UnicodeString& s);
  49.  
  50. public:
  51.     /**
  52.      * Test localized currency patterns.
  53.      */
  54.     virtual void TestCurrency();
  55.     /**
  56.      * Do rudimentary testing of parsing.
  57.      */
  58.     virtual void TestParse();
  59.     /**
  60.      * Test proper rounding by the format method.
  61.      */
  62.     virtual void TestRounding487();
  63.  
  64.     // New tests for alphaWorks upgrade
  65.     virtual void TestExponent();
  66.     virtual void TestScientific();
  67.     void expect(NumberFormat& fmt, const UnicodeString& str, int32_t n);
  68.     void expect(NumberFormat& fmt, const Formattable& n,
  69.                 const UnicodeString& exp);
  70.     void expect(NumberFormat* fmt, const Formattable& n,
  71.                 const UnicodeString& exp, UErrorCode);
  72.     void TestPad();
  73.     void TestPatterns2();
  74.     void expectPad(DecimalFormat& fmt, const UnicodeString& pat,
  75.                    int32_t pos);
  76.     void expectPad(DecimalFormat& fmt, const UnicodeString& pat,
  77.                    int32_t pos, int32_t width, UChar pad);
  78.     void expectPat(DecimalFormat& fmt, const UnicodeString& exp);
  79.     enum { ILLEGAL = -1 };
  80.  
  81. public: // package
  82.     // internal subtest used by TestRounding487
  83.     virtual void roundingTest(NumberFormat& nf, double x, int32_t maxFractionDigits, const char* expected);
  84. };
  85.  
  86. #endif // _NUMBERFORMATTEST_
  87.