]>
Commit | Line | Data |
---|---|---|
729e4ab9 | 1 | /******************************************************************** |
b75a7d8f | 2 | * COPYRIGHT: |
51004dcb | 3 | * Copyright (c) 1997-2012, International Business Machines Corporation and |
729e4ab9 A |
4 | * others. All Rights Reserved. |
5 | ********************************************************************/ | |
b75a7d8f A |
6 | #ifndef _TESTMESSAGEFORMAT |
7 | #define _TESTMESSAGEFORMAT | |
8 | ||
9 | #include "unicode/utypes.h" | |
10 | ||
11 | #if !UCONFIG_NO_FORMATTING | |
12 | ||
13 | #include "unicode/unistr.h" | |
14 | #include "unicode/fmtable.h" | |
729e4ab9 | 15 | #include "unicode/msgfmt.h" |
b75a7d8f A |
16 | #include "intltest.h" |
17 | ||
18 | /** | |
19 | * TestMessageFormat tests MessageFormat, and also a few unctions in ChoiceFormat | |
20 | */ | |
21 | class TestMessageFormat: public IntlTest { | |
22 | public: | |
23 | void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ); | |
24 | ||
25 | /** | |
26 | * regression test for a specific bug regarding ChoiceFormat boundaries | |
27 | **/ | |
28 | void testBug1(void); | |
29 | /** | |
30 | * regression test for a specific bug regarding MessageFormat using ChoiceFormat | |
31 | **/ | |
32 | void testBug2(void); | |
33 | /** | |
34 | * regression test for a specific bug involving NumberFormat and Locales | |
35 | **/ | |
36 | void testBug3(void); | |
37 | /** | |
38 | * test MessageFormat with various given patterns | |
39 | **/ | |
40 | void PatternTest(void); | |
41 | /** | |
42 | * test MesageFormat formatting functionality in a simple example | |
43 | **/ | |
44 | void sample(void); | |
45 | ||
46 | /** | |
47 | * tests the static MessageFormat::format method | |
48 | **/ | |
49 | void testStaticFormat(/* char* par */); | |
50 | /** | |
51 | * tests MesageFormat functionality with a simple format | |
52 | **/ | |
53 | void testSimpleFormat(/* char* par */); | |
54 | /** | |
55 | * tests MesageFormat functionality with a format including a ChoiceFormat | |
56 | **/ | |
57 | void testMsgFormatChoice(/* char* par */); | |
46f4442e A |
58 | /** |
59 | * tests MesageFormat functionality with a PluralFormat. | |
60 | **/ | |
61 | void testMsgFormatPlural(/* char* par */); | |
b75a7d8f | 62 | |
729e4ab9 A |
63 | /** |
64 | * tests MessageFormat functionality with a SelectFormat. | |
65 | **/ | |
66 | void testMsgFormatSelect(/* char* par */); | |
67 | ||
4388f060 A |
68 | void testApostropheInPluralAndSelect(); |
69 | ||
729e4ab9 A |
70 | /** |
71 | * Internal method to format a MessageFormat object with passed args | |
72 | **/ | |
73 | void internalFormat(MessageFormat* msgFmt , | |
74 | Formattable* args , int32_t numOfArgs , | |
4388f060 | 75 | UnicodeString expected, const char* errMsg); |
729e4ab9 A |
76 | |
77 | /** | |
78 | * Internal method to create a MessageFormat object with passed args | |
79 | **/ | |
80 | MessageFormat* internalCreate( | |
81 | UnicodeString pattern ,Locale locale , UErrorCode& err, char* errMsg); | |
82 | ||
b75a7d8f A |
83 | /** |
84 | * Verify that MessageFormat accomodates more than 10 arguments | |
85 | * and more than 10 subformats. | |
86 | */ | |
87 | void TestUnlimitedArgsAndSubformats(); | |
88 | ||
374ca955 A |
89 | /** |
90 | * Test RBNF extensions to MessageFormat. | |
91 | */ | |
92 | void TestRBNF(); | |
93 | ||
4388f060 A |
94 | void TestApostropheMode(); |
95 | ||
96 | void TestCompatibleApostrophe(); | |
97 | ||
b75a7d8f A |
98 | /** |
99 | * ------------ API tests ---------- | |
100 | * These routines test various API functionality. | |
101 | * In addition to the methods their name suggests, | |
102 | * they often test other methods as well. | |
103 | **/ | |
104 | void testCopyConstructor(void); | |
105 | void testCopyConstructor2(void); | |
106 | void testAssignment(void); | |
107 | void testClone(void); | |
108 | void testEquals(void); | |
109 | void testNotEquals(void); | |
110 | void testSetLocale(void); | |
111 | void testFormat(void); | |
112 | void testParse(void); | |
113 | void testAdopt(void); | |
73c04bcf A |
114 | void TestTurkishCasing(void); |
115 | void testAutoQuoteApostrophe(void); | |
51004dcb A |
116 | void testCoverage(); |
117 | void testGetFormatNames(); | |
4388f060 | 118 | void TestTrimArgumentName(); |
51004dcb | 119 | void TestSelectOrdinal(); |
729e4ab9 | 120 | |
b75a7d8f | 121 | private: |
4388f060 | 122 | UnicodeString GetPatternAndSkipSyntax(const MessagePattern& pattern); |
b75a7d8f A |
123 | }; |
124 | ||
125 | #endif /* #if !UCONFIG_NO_FORMATTING */ | |
126 | ||
127 | #endif |