1 /******************************************************************** 2 * COPYRIGHT: 3 * Copyright (c) 1997-2010, International Business Machines Corporation and 4 * others. All Rights Reserved. 5 ********************************************************************/ 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" 15 #include "unicode/msgfmt.h" 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 */); 58 /** 59 * tests MesageFormat functionality with a PluralFormat. 60 **/ 61 void testMsgFormatPlural(/* char* par */); 62 63 /** 64 * tests MessageFormat functionality with a SelectFormat. 65 **/ 66 void testMsgFormatSelect(/* char* par */); 67 68 /** 69 * Internal method to format a MessageFormat object with passed args 70 **/ 71 void internalFormat(MessageFormat* msgFmt , 72 Formattable* args , int32_t numOfArgs , 73 UnicodeString expected ,char* errMsg); 74 75 /** 76 * Internal method to create a MessageFormat object with passed args 77 **/ 78 MessageFormat* internalCreate( 79 UnicodeString pattern ,Locale locale , UErrorCode& err, char* errMsg); 80 81 /** 82 * Verify that MessageFormat accomodates more than 10 arguments 83 * and more than 10 subformats. 84 */ 85 void TestUnlimitedArgsAndSubformats(); 86 87 /** 88 * Test RBNF extensions to MessageFormat. 89 */ 90 void TestRBNF(); 91 92 // 93 /** 94 * ------------ API tests ---------- 95 * These routines test various API functionality. 96 * In addition to the methods their name suggests, 97 * they often test other methods as well. 98 **/ 99 void testCopyConstructor(void); 100 void testCopyConstructor2(void); 101 void testAssignment(void); 102 void testClone(void); 103 void testEquals(void); 104 void testNotEquals(void); 105 void testSetLocale(void); 106 void testFormat(void); 107 void testParse(void); 108 void testAdopt(void); 109 void TestTurkishCasing(void); 110 void testAutoQuoteApostrophe(void); 111 112 /* Provide better code coverage */ 113 void testCoverage(void); 114 115 private: 116 }; 117 118 #endif /* #if !UCONFIG_NO_FORMATTING */ 119 120 #endif 121