X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/4388f060552cc537e71e957d32f35e9d75a61233..0f5d89e82340278ed3d7d50029f37cab2c41a57e:/icuSources/test/intltest/citrtest.cpp diff --git a/icuSources/test/intltest/citrtest.cpp b/icuSources/test/intltest/citrtest.cpp index be8803d6..84a2b69e 100644 --- a/icuSources/test/intltest/citrtest.cpp +++ b/icuSources/test/intltest/citrtest.cpp @@ -1,6 +1,8 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /**************************************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2011, International Business Machines Corporation and + * Copyright (c) 1997-2014, International Business Machines Corporation and * others. All Rights Reserved. * Modification History: * @@ -9,7 +11,7 @@ ****************************************************************************************/ #include -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/chariter.h" #include "unicode/ustring.h" @@ -20,6 +22,7 @@ #include "unicode/putil.h" #include "unicode/utf16.h" #include "citrtest.h" +#include "cmemory.h" class SCharacterIterator : public CharacterIterator { @@ -139,8 +142,6 @@ private: }; const char SCharacterIterator::fgClassID=0; -#define LENGTHOF(array) ((int32_t)(sizeof(array)/sizeof((array)[0]))) - CharIterTest::CharIterTest() { } @@ -610,7 +611,7 @@ void CharIterTest::TestIterationUChar32() { errln("setIndex32() isn't working right"); if (c != CharacterIterator::DONE) { c = iter.next32(); - i=UTF16_NEED_MULTIPLE_UCHAR(c) ? i+2 : i+1; + i += U16_LENGTH(c); } } while (c != CharacterIterator::DONE); if(iter.hasNext() == TRUE) @@ -649,7 +650,7 @@ void CharIterTest::TestIterationUChar32() { errln("getIndex() isn't working right"); if (c != CharacterIterator::DONE) { c = iter.previous32(); - i=UTF16_NEED_MULTIPLE_UCHAR(c) ? i-2 : i-1; + i -= U16_LENGTH(c); } } while (c != CharacterIterator::DONE); if(iter.hasPrevious() == TRUE) @@ -683,7 +684,7 @@ void CharIterTest::TestIterationUChar32() { if(c != text.char32At(i)) errln("Character mismatch at position %d, iterator has %X, string has %X", i, c, text.char32At(i)); - i=UTF16_NEED_MULTIPLE_UCHAR(c) ? i+2 : i+1; + i += U16_LENGTH(c); if(iter.getIndex() != i) errln("getIndex() aftr next32PostInc() isn't working right"); if(iter.current32() != text.char32At(i)) @@ -724,7 +725,7 @@ void CharIterTest::TestIterationUChar32() { if (c != CharacterIterator::DONE) { c = iter.next32(); - i=UTF16_NEED_MULTIPLE_UCHAR(c) ? i+2 : i+1; + i += U16_LENGTH(c); } } while (c != CharacterIterator::DONE); c=iter.next32(); @@ -752,7 +753,7 @@ void CharIterTest::TestIterationUChar32() { if (c != CharacterIterator::DONE) { c = iter.previous32(); - i=UTF16_NEED_MULTIPLE_UCHAR(c) ? i-2 : i-1; + i -= U16_LENGTH(c); } } while (c != CharacterIterator::DONE); @@ -967,7 +968,7 @@ class SubCharIter : public CharacterIterator { public: // public default constructor, to get coverage of CharacterIterator() SubCharIter() : CharacterIterator() { - textLength=end=LENGTHOF(s); + textLength=end=UPRV_LENGTHOF(s); s[0]=0x61; // 'a' s[1]=0xd900; // U+50400 s[2]=0xdd00; @@ -976,7 +977,7 @@ public: // useful stuff, mostly dummy but testing coverage and subclassability virtual UChar nextPostInc() { - if(pos