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