2005-05-22 04:58:36 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
2012-01-31 01:14:41 +00:00
|
|
|
* Copyright (c) 2005-2012, International Business Machines Corporation and
|
2005-05-22 04:58:36 +00:00
|
|
|
* others. All Rights Reserved.
|
|
|
|
********************************************************************/
|
|
|
|
/************************************************************************
|
|
|
|
* Tests for the UText and UTextIterator text abstraction classses
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef UTXTTEST_H
|
|
|
|
#define UTXTTEST_H
|
|
|
|
|
|
|
|
#include "unicode/utypes.h"
|
|
|
|
#include "unicode/unistr.h"
|
|
|
|
#include "unicode/utext.h"
|
|
|
|
|
|
|
|
#include "intltest.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
* @summary Testing the Replaceable class
|
|
|
|
*/
|
|
|
|
class UTextTest : public IntlTest {
|
|
|
|
public:
|
|
|
|
UTextTest();
|
|
|
|
virtual ~UTextTest();
|
|
|
|
|
|
|
|
void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=NULL);
|
|
|
|
void TextTest();
|
2005-07-01 00:39:24 +00:00
|
|
|
void ErrorTest();
|
2006-02-17 02:16:01 +00:00
|
|
|
void FreezeTest();
|
2009-04-16 23:41:36 +00:00
|
|
|
void Ticket5560();
|
|
|
|
void Ticket6847();
|
2005-05-22 04:58:36 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
struct m { // Map between native indices & code points.
|
|
|
|
int nativeIdx;
|
|
|
|
UChar32 cp;
|
|
|
|
};
|
|
|
|
|
|
|
|
void TestString(const UnicodeString &s);
|
2005-05-31 03:43:53 +00:00
|
|
|
void TestAccess(const UnicodeString &us, UText *ut, int cpCount, m *cpMap);
|
2006-08-29 23:21:59 +00:00
|
|
|
void TestAccessNoClone(const UnicodeString &us, UText *ut, int cpCount, m *cpMap);
|
2005-06-30 05:22:08 +00:00
|
|
|
void TestCMR (const UnicodeString &us, UText *ut, int cpCount, m *nativeMap, m *utf16Map);
|
|
|
|
void TestCopyMove(const UnicodeString &us, UText *ut, UBool move,
|
2009-04-16 23:41:36 +00:00
|
|
|
int32_t nativeStart, int32_t nativeLimit, int32_t nativeDest,
|
|
|
|
int32_t u16Start, int32_t u16Limit, int32_t u16Dest);
|
2005-06-30 05:22:08 +00:00
|
|
|
void TestReplace(const UnicodeString &us, // reference UnicodeString in which to do the replace
|
|
|
|
UText *ut, // UnicodeText object under test.
|
|
|
|
int32_t nativeStart, // Range to be replaced, in UText native units.
|
|
|
|
int32_t nativeLimit,
|
|
|
|
int32_t u16Start, // Range to be replaced, in UTF-16 units
|
|
|
|
int32_t u16Limit, // for use in the reference UnicodeString.
|
|
|
|
const UnicodeString &repStr); // The replacement string
|
|
|
|
|
|
|
|
|
2005-05-22 04:58:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|