• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     void testFormatMillisecond();
38 
39     /**
40      * Test formatting using user defined DateIntervalInfo
41      */
42     void testFormatUserDII();
43 
44     /**
45      * Test for no unwanted side effects when setting
46      * interval patterns.
47      */
48     void testSetIntervalPatternNoSideEffect();
49 
50     /**
51      * Tests different year formats.
52      */
53     void testYearFormats();
54 
55     /**
56      * Stress test -- stress test formatting on 40 locales
57      */
58     void testStress();
59 
60     void testTicket11583_2();
61 
62     void testTicket11985();
63 
64     void testTicket11669();
65     void threadFunc11669(int32_t threadNum);
66 
67     void testTicket12065();
68 
69     void testFormattedDateInterval();
70     void testCreateInstanceForAllLocales();
71 
72     void testTicket20707();
73 
74 private:
75     /**
76      * Test formatting against expected result
77      */
78     void expect(const char** data, int32_t data_length);
79 
80     /**
81      * Test formatting against expected result using user defined
82      * DateIntervalInfo
83      */
84     void expectUserDII(const char** data, int32_t data_length);
85 
86     /**
87      * Stress test formatting
88      */
89     void stress(const char** data, int32_t data_length, const Locale& loc,
90                 const char* locName);
91 };
92 
93 #endif /* #if !UCONFIG_NO_FORMATTING */
94 
95 #endif
96