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) 2008-2016 International Business Machines Corporation and 6 * others. All Rights Reserved. 7 ********************************************************************/ 8 9 #ifndef _INTLTESTDATEINTERVALFORMAT 10 #define _INTLTESTDATEINTERVALFORMAT 11 12 #include "unicode/utypes.h" 13 #include "unicode/locid.h" 14 15 #if !UCONFIG_NO_FORMATTING 16 17 #include "intltest.h" 18 #include "itformat.h" 19 20 /** 21 * Test basic functionality of various API functions 22 **/ 23 class DateIntervalFormatTest: public IntlTestWithFieldPosition { 24 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ); 25 26 public: 27 /** 28 * Performs tests on many API functions, see detailed comments in source code 29 **/ 30 void testAPI(); 31 32 /** 33 * Test formatting 34 */ 35 void testFormat(); 36 37 38 /** 39 * Test handling of hour and day period metacharacters 40 */ 41 void testHourMetacharacters(); 42 43 void testFormatMillisecond(); 44 45 /** 46 * Test formatting using user defined DateIntervalInfo 47 */ 48 void testFormatUserDII(); 49 50 /* 51 * Test format using UDisplayContext 52 */ 53 void testContext(); 54 55 /** 56 * Test for no unwanted side effects when setting 57 * interval patterns. 58 */ 59 void testSetIntervalPatternNoSideEffect(); 60 61 /** 62 * Tests different year formats. 63 */ 64 void testYearFormats(); 65 66 /** 67 * Stress test -- stress test formatting on 40 locales 68 */ 69 void testStress(); 70 71 void testTicket11583_2(); 72 73 void testTicket11985(); 74 75 void testTicket11669(); 76 void threadFunc11669(int32_t threadNum); 77 78 void testTicket12065(); 79 80 void testFormattedDateInterval(); 81 void testCreateInstanceForAllLocales(); 82 83 void testTicket20707(); 84 85 private: 86 /** 87 * Test formatting against expected result 88 */ 89 void expect(const char** data, int32_t data_length); 90 91 /** 92 * Test formatting against expected result using user defined 93 * DateIntervalInfo 94 */ 95 void expectUserDII(const char** data, int32_t data_length); 96 97 /** 98 * Stress test formatting 99 */ 100 void stress(const char** data, int32_t data_length, const Locale& loc, 101 const char* locName); 102 }; 103 104 #endif /* #if !UCONFIG_NO_FORMATTING */ 105 106 #endif 107