1 // © 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html 3 /******************************************************************** 4 * COPYRIGHT: 5 * Copyright (c) 2005-2016, International Business Machines Corporation and 6 * others. All Rights Reserved. 7 ********************************************************************/ 8 /************************************************************************ 9 * Tests for the UText and UTextIterator text abstraction classses 10 * 11 ************************************************************************/ 12 13 14 #ifndef UTXTTEST_H 15 #define UTXTTEST_H 16 17 #include "unicode/utypes.h" 18 #include "unicode/unistr.h" 19 #include "unicode/utext.h" 20 21 #include "intltest.h" 22 23 /** 24 * @test 25 * @summary Testing the Replaceable class 26 */ 27 class UTextTest : public IntlTest { 28 public: 29 UTextTest(); 30 virtual ~UTextTest(); 31 32 void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=NULL); 33 void TextTest(); 34 void ErrorTest(); 35 void FreezeTest(); 36 void Ticket5560(); 37 void Ticket6847(); 38 void Ticket10562(); 39 void Ticket10983(); 40 void Ticket12130(); 41 void Ticket13344(); 42 43 private: 44 struct m { // Map between native indices & code points. 45 int nativeIdx; 46 UChar32 cp; 47 }; 48 49 void TestString(const UnicodeString &s); 50 void TestAccess(const UnicodeString &us, UText *ut, int cpCount, m *cpMap); 51 void TestAccessNoClone(const UnicodeString &us, UText *ut, int cpCount, m *cpMap); 52 void TestCMR (const UnicodeString &us, UText *ut, int cpCount, m *nativeMap, m *utf16Map); 53 void TestCopyMove(const UnicodeString &us, UText *ut, UBool move, 54 int32_t nativeStart, int32_t nativeLimit, int32_t nativeDest, 55 int32_t u16Start, int32_t u16Limit, int32_t u16Dest); 56 void TestReplace(const UnicodeString &us, // reference UnicodeString in which to do the replace 57 UText *ut, // UnicodeText object under test. 58 int32_t nativeStart, // Range to be replaced, in UText native units. 59 int32_t nativeLimit, 60 int32_t u16Start, // Range to be replaced, in UTF-16 units 61 int32_t u16Limit, // for use in the reference UnicodeString. 62 const UnicodeString &repStr); // The replacement string 63 64 65 }; 66 67 68 #endif 69