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