home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / test / intltest / dtfmttst.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-16  |  4.5 KB  |  155 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 _DATEFORMATTEST_
  15. #define _DATEFORMATTEST_
  16.  
  17. #include "utypes.h"
  18. #include "caltztst.h"
  19. #include "datefmt.h"
  20.  
  21. /** 
  22.  * Performs many different tests for DataeFormat and SimpleDateFormat
  23.  **/
  24. class DateFormatTest: public CalendarTimeZoneTest {
  25.     // IntlTest override
  26.     void runIndexedTest( int32_t index, bool_t exec, char* &name, char* par );
  27. public:
  28.     /**
  29.      *  "Test written by Wally Wedel and emailed to me."
  30.      *  Test handling of timezone offsets
  31.      **/
  32.     virtual void TestWallyWedel(void);
  33.     /**
  34.      * Test operator==
  35.      */
  36.     virtual void TestEquals(void);
  37.     /**
  38.      * Test the parsing of 2-digit years.
  39.      */
  40.     virtual void TestTwoDigitYearDSTParse();
  41.  
  42. public: // package
  43.     // internal utility routine (genrates escape sequences for characters)
  44.     static UnicodeString& escape(UnicodeString& s);
  45.     static char* fieldNames[];
  46.  
  47. public:
  48.     /**
  49.      * Verify that returned field position indices are correct.
  50.      */
  51.     virtual void TestFieldPosition(void);
  52.  
  53. public: // package
  54.     // internal utility function
  55.     static void getFieldText(DateFormat* df, int32_t field, UDate date, UnicodeString& str);
  56.  
  57. public:
  58.     /**
  59.      * Verify that strings which contain incomplete specifications are parsed
  60.      * correctly.  In some instances, this means not being parsed at all, and
  61.      * returning an appropriate error.
  62.      */
  63.     virtual void TestPartialParse994(void);
  64.  
  65. public: // package
  66.     // internal test subroutine, used by TestPartialParse994
  67.     virtual void tryPat994(SimpleDateFormat* format, const char* pat, const char* str, UDate expected);
  68.  
  69. public:
  70.     /**
  71.      * Verify the behavior of patterns in which digits for different fields run together
  72.      * without intervening separators.
  73.      */
  74.     virtual void TestRunTogetherPattern985(void);
  75.     /**
  76.      * Verify the behavior of patterns in which digits for different fields run together
  77.      * without intervening separators.
  78.      */
  79.     virtual void TestRunTogetherPattern917(void);
  80.  
  81. public: // package
  82.     // internal test subroutine, used by TestRunTogetherPattern917
  83.     virtual void testIt917(SimpleDateFormat* fmt, UnicodeString& str, UDate expected);
  84.  
  85. public:
  86.     /**
  87.      * Verify the handling of Czech June and July, which have the unique attribute that
  88.      * one is a proper prefix substring of the other.
  89.      */
  90.     virtual void TestCzechMonths459(void);
  91.     /**
  92.      * Test the handling of 'D' in patterns.
  93.      */
  94.     virtual void TestLetterDPattern212(void);
  95.     /**
  96.      * Test the day of year pattern.
  97.      */
  98.     virtual void TestDayOfYearPattern195(void);
  99.  
  100. public: // package
  101.     // interl test subroutine, used by TestDayOfYearPattern195
  102.     virtual void tryPattern(SimpleDateFormat& sdf, UDate d, const char* pattern, UDate expected);
  103.  
  104. public:
  105.     /**
  106.      * Test the handling of single quotes in patterns.
  107.      */
  108.     virtual void TestQuotePattern161(void);
  109.     /**
  110.      * Verify the correct behavior when handling invalid input strings.
  111.      */
  112.     virtual void TestBadInput135(void);
  113.  
  114. private:
  115.     static const char* parseFormats[];
  116.     static const char* inputStrings[];
  117.  
  118.     static const DateFormat::EField fgCalendarToDateFormatField [];
  119.  
  120. public:
  121.     /**
  122.      * Verify the correct behavior when parsing an array of inputs against an
  123.      * array of patterns, with known results.  The results are encoded after
  124.      * the input strings in each row.
  125.      */
  126.     virtual void TestBadInput135a(void);
  127.     /**
  128.      * Test the parsing of two-digit years.
  129.      */
  130.     virtual void TestTwoDigitYear(void);
  131.  
  132. public: // package
  133.     // internal test subroutine, used by TestTwoDigitYear
  134.     virtual void parse2DigitYear(DateFormat& fmt, const char* str, UDate expected);
  135.  
  136. public:
  137.     /**
  138.      * Test the formatting of time zones.
  139.      */
  140.     virtual void TestDateFormatZone061(void);
  141.     /**
  142.      * Further test the formatting of time zones.
  143.      */
  144.     virtual void TestDateFormatZone146(void);
  145.  
  146. public: // package
  147.     /**
  148.      * Test the formatting of dates in different locales.
  149.      */
  150.     virtual void TestLocaleDateFormat(void);
  151. };
  152.  
  153. #endif // _DATEFORMATTEST_
  154. //eof
  155.