Home | History | Annotate | Download | only in intltest
      1 
      2 /********************************************************************
      3  * Copyright (c) 1997-2010, International Business Machines
      4  * Corporation and others. All Rights Reserved.
      5  ********************************************************************/
      6 
      7 #ifndef __TimeZoneTest__
      8 #define __TimeZoneTest__
      9 
     10 #include "unicode/utypes.h"
     11 
     12 #if !UCONFIG_NO_FORMATTING
     13 
     14 #include "unicode/simpletz.h"
     15 #include "caltztst.h"
     16 
     17 /**
     18  * Various tests for TimeZone
     19  **/
     20 class TimeZoneTest: public CalendarTimeZoneTest {
     21     // IntlTest override
     22     void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par );
     23 public: // package
     24     static const int32_t millisPerHour;
     25 
     26 public:
     27     /**
     28      * Test the offset of the PRT timezone.
     29      */
     30     virtual void TestPRTOffset(void);
     31     /**
     32      * Regress a specific bug with a sequence of API calls.
     33      */
     34     virtual void TestVariousAPI518(void);
     35     /**
     36      * Test the call which retrieves the available IDs.
     37      */
     38     virtual void TestGetAvailableIDs913(void);
     39 
     40     /**
     41      * Generic API testing for API coverage.
     42      */
     43     virtual void TestGenericAPI(void);
     44     /**
     45      * Test the setStartRule/setEndRule API calls.
     46      */
     47     virtual void TestRuleAPI(void);
     48 
     49     void findTransition(const TimeZone& tz,
     50                         UDate min, UDate max);
     51 
     52    /**
     53      * subtest used by TestRuleAPI
     54      **/
     55     void testUsingBinarySearch(const TimeZone& tz,
     56                                UDate min, UDate max,
     57                                UDate expectedBoundary);
     58 
     59 
     60     /**
     61      *  Test short zone IDs for compliance
     62      */
     63     virtual void TestShortZoneIDs(void);
     64 
     65 
     66     /**
     67      *  Test parsing custom zones
     68      */
     69     virtual void TestCustomParse(void);
     70 
     71     /**
     72      *  Test new getDisplayName() API
     73      */
     74     virtual void TestDisplayName(void);
     75 
     76     void TestDSTSavings(void);
     77     void TestAlternateRules(void);
     78 
     79     void TestCountries(void);
     80 
     81     void TestHistorical(void);
     82 
     83     void TestEquivalentIDs(void);
     84 
     85     void TestAliasedNames(void);
     86 
     87     void TestFractionalDST(void);
     88 
     89     void TestFebruary(void);
     90 
     91     void TestCanonicalID(void);
     92 
     93     virtual void TestDisplayNamesMeta();
     94 
     95     static const UDate INTERVAL;
     96 
     97 private:
     98     // internal functions
     99     static UnicodeString& formatOffset(int32_t offset, UnicodeString& rv);
    100     static UnicodeString& formatTZID(int32_t offset, UnicodeString& rv);
    101 
    102     // Some test case data is current date/tzdata version sensitive and producing errors
    103     // when year/rule are changed.
    104     static const int32_t REFERENCE_YEAR;
    105     static const char *REFERENCE_DATA_VERSION;
    106 };
    107 
    108 #endif /* #if !UCONFIG_NO_FORMATTING */
    109 
    110 #endif // __TimeZoneTest__
    111