X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/73c04bcfe1096173b00431f0cdc742894b15eef0..HEAD:/icuSources/test/intltest/tstnrapi.cpp diff --git a/icuSources/test/intltest/tstnrapi.cpp b/icuSources/test/intltest/tstnrapi.cpp index 6499fefe..744b0ce9 100644 --- a/icuSources/test/intltest/tstnrapi.cpp +++ b/icuSources/test/intltest/tstnrapi.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-2005, International Business Machines Corporation and + * Copyright (c) 1997-2010, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ @@ -10,7 +12,6 @@ #include "unicode/uniset.h" #include "unicode/usetiter.h" #include "unicode/schriter.h" -#include "unormimp.h" #include "tstnorm.h" #if !UCONFIG_NO_NORMALIZATION @@ -26,13 +27,13 @@ BasicNormalizerTest::TestNormalizerAPI() { StringCharacterIterator iter(s); Normalizer norm(iter, UNORM_NFC); if(norm.next()!=0xe4) { - errln("error in Normalizer(CharacterIterator).next()"); + dataerrln("error in Normalizer(CharacterIterator).next()"); } // test copy constructor Normalizer copy(norm); if(copy.next()!=0xac00) { - errln("error in Normalizer(Normalizer(CharacterIterator)).next()"); + dataerrln("error in Normalizer(Normalizer(CharacterIterator)).next()"); } // test clone(), ==, and hashCode() @@ -45,7 +46,7 @@ BasicNormalizerTest::TestNormalizerAPI() { errln("error in Normalizer(Normalizer(CharacterIterator)).clone()->hashCode()!=copy.hashCode()"); } if(clone->next()!=0x4e3d) { - errln("error in Normalizer(Normalizer(CharacterIterator)).clone()->next()"); + dataerrln("error in Normalizer(Normalizer(CharacterIterator)).clone()->next()"); } // position changed, must change hashCode() if(clone->hashCode()==copy.hashCode()) { @@ -63,7 +64,7 @@ BasicNormalizerTest::TestNormalizerAPI() { Normalizer::compose(tel, TRUE, 0, nfkc, errorCode); Normalizer::decompose(tel, TRUE, 0, nfkd, errorCode); if(U_FAILURE(errorCode)) { - errln("error in Normalizer::(de)compose(): %s", u_errorName(errorCode)); + dataerrln("error in Normalizer::(de)compose(): %s", u_errorName(errorCode)); } else if( nfkc!=UnicodeString("TE\\u0139TELTELTELTELTELTELTELTELTEL", "").unescape() || nfkd!=UnicodeString("TEL\\u0301TELTELTELTELTELTELTELTELTEL", "").unescape() @@ -74,7 +75,7 @@ BasicNormalizerTest::TestNormalizerAPI() { // test setIndex() norm.setIndexOnly(3); if(norm.current()!=0x4e3d) { - errln("error in Normalizer(CharacterIterator).setIndex(3)"); + dataerrln("error in Normalizer(CharacterIterator).setIndex(3)"); } // test setText(CharacterIterator) and getText() @@ -102,7 +103,7 @@ BasicNormalizerTest::TestNormalizerAPI() { errln("error in Normalizer::setMode() or Normalizer::getUMode()"); } if(copy.next()!=0x308 || copy.next()!=0x1100) { - errln("error in Normalizer::setText(UChar *) or Normalizer::setMode()"); + dataerrln("error in Normalizer::setText(UChar *) or Normalizer::setMode()"); } // test setText(UChar *, length=-1) @@ -145,42 +146,23 @@ BasicNormalizerTest::TestNormalizerAPI() { s.setTo((UChar)0xe4); Normalizer::normalize(s, UNORM_NFD, 0, s, status); if(s.charAt(1)!=0x308) { - errln("error in Normalizer::normalize(UNORM_NFD, self)"); + dataerrln("error in Normalizer::normalize(UNORM_NFD, self)"); } Normalizer::normalize(s, UNORM_NFC, 0, s, status); if(s.charAt(0)!=0xe4) { - errln("error in Normalizer::normalize(UNORM_NFC, self)"); + dataerrln("error in Normalizer::normalize(UNORM_NFC, self)"); } Normalizer::decompose(s, FALSE, 0, s, status); if(s.charAt(1)!=0x308) { - errln("error in Normalizer::decompose(self)"); + dataerrln("error in Normalizer::decompose(self)"); } Normalizer::compose(s, FALSE, 0, s, status); if(s.charAt(0)!=0xe4) { - errln("error in Normalizer::compose(self)"); + dataerrln("error in Normalizer::compose(self)"); } Normalizer::concatenate(s, s, s, UNORM_NFC, 0, status); if(s.charAt(1)!=0xe4) { - errln("error in Normalizer::decompose(self)"); - } - - // test internal normalization exclusion options - // s contains a compatibility CJK character and a Hangul syllable - s=UnicodeString("a\\uFACE\\uD7A3b", -1, US_INV).unescape(); - status=U_ZERO_ERROR; - Normalizer::decompose(s, FALSE, UNORM_NX_HANGUL, out, status); - if(U_FAILURE(status) || out!=UNICODE_STRING_SIMPLE("a\\u9F9C\\uD7A3b").unescape()) { - errln("Normalizer::decompose(UNORM_NX_HANGUL) failed - %s", u_errorName(status)); - } - status=U_ZERO_ERROR; - Normalizer::decompose(s, FALSE, UNORM_NX_CJK_COMPAT, out, status); - if(U_FAILURE(status) || out!=UNICODE_STRING_SIMPLE("a\\uFACE\\u1112\\u1175\\u11c2b").unescape()) { - errln("Normalizer::decompose(UNORM_NX_CJK_COMPAT) failed - %s", u_errorName(status)); - } - status=U_ZERO_ERROR; - Normalizer::decompose(s, FALSE, UNORM_NX_CJK_COMPAT|UNORM_NX_HANGUL, out, status); - if(U_FAILURE(status) || out!=UNICODE_STRING_SIMPLE("a\\uFACE\\uD7A3b").unescape()) { - errln("Normalizer::decompose(UNORM_NX_CJK_COMPAT|UNORM_NX_HANGUL) failed - %s", u_errorName(status)); + dataerrln("error in Normalizer::decompose(self)"); } }