• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /********************************************************************
2  * COPYRIGHT:
3  * Copyright (c) 1997-2003, International Business Machines Corporation and
4  * others. All Rights Reserved.
5  ********************************************************************/
6 
7 #ifndef _INTLTESTDATEFORMAT
8 #define _INTLTESTDATEFORMAT
9 
10 #include "unicode/utypes.h"
11 
12 #if !UCONFIG_NO_FORMATTING
13 
14 #include "unicode/unistr.h"
15 #include "unicode/datefmt.h"
16 #include "intltest.h"
17 
18 /**
19  *  Performs some tests in many variations on DateFormat
20  **/
21 class IntlTestDateFormat: public IntlTest {
22     void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
23 
24 private:
25 
26     /**
27      *  test DateFormat::getAvailableLocales
28      **/
29     void testAvailableLocales(/* char* par */);
30     /**
31      *  call testLocale for all locales
32      **/
33     void monsterTest(/* char *par */);
34 
35     /**
36      *  call tryDate with variations, called by testLocale
37      **/
38     void testFormat(/* char* par */);
39     /**
40      *  perform tests using date and fFormat, called in many variations
41      **/
42     void tryDate(UDate date);
43     /**
44      *  call testFormat for different DateFormat::EStyle's, etc
45      **/
46     void testLocale(/*char *par, */const Locale&, const UnicodeString&);
47     /**
48      *  return a random number
49      **/
50     double randDouble(void);
51     /**
52      * generate description for verbose test output
53      **/
54     void describeTest(void);
55 
56     DateFormat *fFormat;
57     UnicodeString fTestName;
58     int32_t fLimit; // How many iterations it should take to reach convergence
59 
60     enum
61     {
62         // Values in milliseconds (== Date)
63         ONESECOND = 1000,
64         ONEMINUTE = 60 * ONESECOND,
65         ONEHOUR = 60 * ONEMINUTE,
66         ONEDAY = 24 * ONEHOUR
67     };
68     static const double ONEYEAR;
69     enum EMode
70     {
71         GENERIC,
72         TIME,
73         DATE,
74         DATE_TIME
75     };
76 public:
77     virtual ~IntlTestDateFormat();
78 };
79 
80 #endif /* #if !UCONFIG_NO_FORMATTING */
81 
82 #endif
83