Home | History | Annotate | Download | only in intltest
      1 // Copyright (C) 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 
     42 private:
     43     struct m {                              // Map between native indices & code points.
     44         int         nativeIdx;
     45         UChar32     cp;
     46     };
     47 
     48     void TestString(const UnicodeString &s);
     49     void TestAccess(const UnicodeString &us, UText *ut, int cpCount, m *cpMap);
     50     void TestAccessNoClone(const UnicodeString &us, UText *ut, int cpCount, m *cpMap);
     51     void TestCMR   (const UnicodeString &us, UText *ut, int cpCount, m *nativeMap, m *utf16Map);
     52     void TestCopyMove(const UnicodeString &us, UText *ut, UBool move,
     53                       int32_t nativeStart, int32_t nativeLimit, int32_t nativeDest,
     54                       int32_t u16Start, int32_t u16Limit, int32_t u16Dest);
     55     void TestReplace(const UnicodeString &us,  // reference UnicodeString in which to do the replace
     56             UText         *ut,                 // UnicodeText object under test.
     57             int32_t       nativeStart,         // Range to be replaced, in UText native units.
     58             int32_t       nativeLimit,
     59             int32_t       u16Start,            // Range to be replaced, in UTF-16 units
     60             int32_t       u16Limit,            //    for use in the reference UnicodeString.
     61             const UnicodeString &repStr);      // The replacement string
     62 
     63 
     64 };
     65 
     66 
     67 #endif
     68