2010-01-16 03:07:18 +00:00
|
|
|
/********************************************************************
|
2000-01-15 02:00:06 +00:00
|
|
|
* COPYRIGHT:
|
2010-01-16 03:07:18 +00:00
|
|
|
* Copyright (c) 1997-2010, International Business Machines Corporation and
|
|
|
|
* others. All Rights Reserved.
|
|
|
|
********************************************************************/
|
1999-08-16 21:50:52 +00:00
|
|
|
#ifndef _TESTMESSAGEFORMAT
|
|
|
|
#define _TESTMESSAGEFORMAT
|
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#include "unicode/utypes.h"
|
|
|
|
|
|
|
|
#if !UCONFIG_NO_FORMATTING
|
|
|
|
|
2001-10-08 23:26:58 +00:00
|
|
|
#include "unicode/unistr.h"
|
|
|
|
#include "unicode/fmtable.h"
|
2010-01-16 03:07:18 +00:00
|
|
|
#include "unicode/msgfmt.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
#include "intltest.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TestMessageFormat tests MessageFormat, and also a few unctions in ChoiceFormat
|
|
|
|
*/
|
|
|
|
class TestMessageFormat: public IntlTest {
|
|
|
|
public:
|
2000-08-14 21:42:36 +00:00
|
|
|
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* regression test for a specific bug regarding ChoiceFormat boundaries
|
|
|
|
**/
|
|
|
|
void testBug1(void);
|
|
|
|
/**
|
|
|
|
* regression test for a specific bug regarding MessageFormat using ChoiceFormat
|
|
|
|
**/
|
|
|
|
void testBug2(void);
|
|
|
|
/**
|
|
|
|
* regression test for a specific bug involving NumberFormat and Locales
|
|
|
|
**/
|
|
|
|
void testBug3(void);
|
|
|
|
/**
|
|
|
|
* test MessageFormat with various given patterns
|
|
|
|
**/
|
|
|
|
void PatternTest(void);
|
|
|
|
/**
|
|
|
|
* test MesageFormat formatting functionality in a simple example
|
|
|
|
**/
|
|
|
|
void sample(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* tests the static MessageFormat::format method
|
|
|
|
**/
|
2000-08-23 19:11:16 +00:00
|
|
|
void testStaticFormat(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
/**
|
|
|
|
* tests MesageFormat functionality with a simple format
|
|
|
|
**/
|
2000-08-23 19:11:16 +00:00
|
|
|
void testSimpleFormat(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
/**
|
|
|
|
* tests MesageFormat functionality with a format including a ChoiceFormat
|
|
|
|
**/
|
2000-08-23 19:11:16 +00:00
|
|
|
void testMsgFormatChoice(/* char* par */);
|
2007-12-17 01:39:55 +00:00
|
|
|
/**
|
|
|
|
* tests MesageFormat functionality with a PluralFormat.
|
|
|
|
**/
|
|
|
|
void testMsgFormatPlural(/* char* par */);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2010-01-16 03:07:18 +00:00
|
|
|
/**
|
|
|
|
* tests MessageFormat functionality with a SelectFormat.
|
|
|
|
**/
|
|
|
|
void testMsgFormatSelect(/* char* par */);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal method to format a MessageFormat object with passed args
|
|
|
|
**/
|
|
|
|
void internalFormat(MessageFormat* msgFmt ,
|
|
|
|
Formattable* args , int32_t numOfArgs ,
|
|
|
|
UnicodeString expected ,char* errMsg);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal method to create a MessageFormat object with passed args
|
|
|
|
**/
|
|
|
|
MessageFormat* internalCreate(
|
|
|
|
UnicodeString pattern ,Locale locale , UErrorCode& err, char* errMsg);
|
|
|
|
|
2003-01-28 22:13:43 +00:00
|
|
|
/**
|
|
|
|
* Verify that MessageFormat accomodates more than 10 arguments
|
|
|
|
* and more than 10 subformats.
|
|
|
|
*/
|
|
|
|
void TestUnlimitedArgsAndSubformats();
|
|
|
|
|
2004-08-04 05:57:45 +00:00
|
|
|
/**
|
|
|
|
* Test RBNF extensions to MessageFormat.
|
|
|
|
*/
|
|
|
|
void TestRBNF();
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
//
|
|
|
|
/**
|
|
|
|
* ------------ API tests ----------
|
|
|
|
* These routines test various API functionality.
|
|
|
|
* In addition to the methods their name suggests,
|
|
|
|
* they often test other methods as well.
|
|
|
|
**/
|
|
|
|
void testCopyConstructor(void);
|
2003-01-28 22:13:43 +00:00
|
|
|
void testCopyConstructor2(void);
|
1999-08-16 21:50:52 +00:00
|
|
|
void testAssignment(void);
|
|
|
|
void testClone(void);
|
|
|
|
void testEquals(void);
|
|
|
|
void testNotEquals(void);
|
|
|
|
void testSetLocale(void);
|
|
|
|
void testFormat(void);
|
|
|
|
void testParse(void);
|
|
|
|
void testAdopt(void);
|
2004-12-22 19:25:19 +00:00
|
|
|
void TestTurkishCasing(void);
|
2005-05-27 22:07:16 +00:00
|
|
|
void testAutoQuoteApostrophe(void);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2009-09-16 20:55:05 +00:00
|
|
|
/* Provide better code coverage */
|
|
|
|
void testCoverage(void);
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
private:
|
|
|
|
};
|
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#endif /* #if !UCONFIG_NO_FORMATTING */
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
#endif
|