]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/tmsgfmt.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /********************************************************************
5 * Copyright (c) 1997-2016, International Business Machines Corporation and
6 * others. All Rights Reserved.
7 ********************************************************************/
8 #ifndef _TESTMESSAGEFORMAT
9 #define _TESTMESSAGEFORMAT
11 #include "unicode/utypes.h"
13 #if !UCONFIG_NO_FORMATTING
15 #include "unicode/unistr.h"
16 #include "unicode/fmtable.h"
17 #include "unicode/msgfmt.h"
21 * TestMessageFormat tests MessageFormat, and also a few unctions in ChoiceFormat
23 class TestMessageFormat
: public IntlTest
{
25 void runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* par
= NULL
);
28 * regression test for a specific bug regarding ChoiceFormat boundaries
32 * regression test for a specific bug regarding MessageFormat using ChoiceFormat
36 * regression test for a specific bug involving NumberFormat and Locales
40 * test MessageFormat with various given patterns
42 void PatternTest(void);
44 * test MesageFormat formatting functionality in a simple example
49 * tests the static MessageFormat::format method
51 void testStaticFormat(/* char* par */);
53 * tests MesageFormat functionality with a simple format
55 void testSimpleFormat(/* char* par */);
57 * tests MesageFormat functionality with a format including a ChoiceFormat
59 void testMsgFormatChoice(/* char* par */);
61 * tests MesageFormat functionality with a PluralFormat.
63 void testMsgFormatPlural(/* char* par */);
66 * tests MessageFormat functionality with a SelectFormat.
68 void testMsgFormatSelect(/* char* par */);
70 void testApostropheInPluralAndSelect();
73 * Internal method to format a MessageFormat object with passed args
75 void internalFormat(MessageFormat
* msgFmt
,
76 Formattable
* args
, int32_t numOfArgs
,
77 UnicodeString expected
, const char* errMsg
);
80 * Internal method to create a MessageFormat object with passed args
82 MessageFormat
* internalCreate(
83 UnicodeString pattern
,Locale locale
, UErrorCode
& err
, char* errMsg
);
86 * Verify that MessageFormat accomodates more than 10 arguments
87 * and more than 10 subformats.
89 void TestUnlimitedArgsAndSubformats();
92 * Test RBNF extensions to MessageFormat.
96 void TestApostropheMode();
98 void TestCompatibleApostrophe();
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.
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);
116 void TestTurkishCasing(void);
117 void testAutoQuoteApostrophe(void);
119 void testGetFormatNames();
120 void TestTrimArgumentName();
121 void TestSelectOrdinal();
123 void TestArgIsPrefixOfAnother();
124 void TestMessageFormatNumberSkeleton();
125 void TestMessageFormatDateSkeleton();
126 void TestMessageFormatTimeSkeleton();
129 UnicodeString
GetPatternAndSkipSyntax(const MessagePattern
& pattern
);
130 void doTheRealDateTimeSkeletonTesting(UDate testDate
,
131 const char16_t* messagePattern
, const char* localeName
, const char16_t* expected
,
132 IcuTestErrorCode
& status
);
135 #endif /* #if !UCONFIG_NO_FORMATTING */