Projects
Mega:24.03
icu
_service:tar_scm:backport-remove-TestJitterbug6...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:backport-remove-TestJitterbug6175.patch of Package icu
From d4774599b63f72c887cf449d02b3d1e5b0acc960 Mon Sep 17 00:00:00 2001 From: Peter Edberg <pedberg@unicode.org> Date: Wed, 12 Mar 2008 23:22:07 +0000 Subject: [PATCH] ICU-6175 Test detecting empty segments in ISO-2022-x & HZ with UConverterCallbackReason==UCNV_IRREGULAR X-SVN-Rev: 23572 revert d4774599b63f72c887cf449d02b3d1e5b0acc960 --- source/test/cintltst/nucnvtst.c | 70 --------------------------------- 1 file changed, 70 deletions(-) diff --git a/source/test/cintltst/nucnvtst.c b/source/test/cintltst/nucnvtst.c index 73e0fde..1f96ded 100644 --- a/source/test/cintltst/nucnvtst.c +++ b/source/test/cintltst/nucnvtst.c @@ -101,7 +101,6 @@ static void TestJitterbug2346(void); static void TestJitterbug2411(void); static void TestJB5275(void); static void TestJB5275_1(void); -static void TestJitterbug6175(void); static void TestIsFixedWidth(void); #endif @@ -329,7 +328,6 @@ void addTestNewConvert(TestNode** root) #if !UCONFIG_NO_LEGACY_CONVERSION addTest(root, &TestJitterbug2346, "tsconv/nucnvtst/TestJitterbug2346"); addTest(root, &TestJitterbug2411, "tsconv/nucnvtst/TestJitterbug2411"); - addTest(root, &TestJitterbug6175, "tsconv/nucnvtst/TestJitterbug6175"); addTest(root, &TestIsFixedWidth, "tsconv/nucnvtst/TestIsFixedWidth"); #endif @@ -4591,74 +4589,6 @@ cleanup: free(offsets); } -/* Tests for empty segments in ISO-2022-JP/KR/CN, HZ, check that UConverterCallbackReason is UCNV_IRREGULAR */ -typedef struct { - const char * converterName; - const char * inputText; - int inputTextLength; -} EmptySegmentTest; - -/* Callback for TestJitterbug6175, should only get called for empty segment errors */ -static void UCNV_TO_U_CALLBACK_EMPTYSEGMENT( const void *context, UConverterToUnicodeArgs *toArgs, const char* codeUnits, - int32_t length, UConverterCallbackReason reason, UErrorCode * err ) { - // suppress compiler warnings about unused variables - (void)context; - (void)codeUnits; - (void)length; - if (reason > UCNV_IRREGULAR) { - return; - } - if (reason != UCNV_IRREGULAR) { - log_err("toUnicode callback invoked for empty segment but reason is not UCNV_IRREGULAR\n"); - } - /* Standard stuff below from UCNV_TO_U_CALLBACK_SUBSTITUTE */ - *err = U_ZERO_ERROR; - ucnv_cbToUWriteSub(toArgs,0,err); -} - -enum { kEmptySegmentToUCharsMax = 64 }; -static void TestJitterbug6175(void) { - static const char iso2022jp_a[] = { 0x61, 0x62, 0x1B,0x24,0x42, 0x1B,0x28,0x42, 0x63, 0x64, 0x0D, 0x0A }; - static const char iso2022kr_a[] = { 0x1B,0x24,0x29,0x43, 0x61, 0x0E, 0x0F, 0x62, 0x0D, 0x0A }; - static const char iso2022cn_a[] = { 0x61, 0x1B,0x24,0x29,0x41, 0x62, 0x0E, 0x0F, 0x1B,0x24,0x2A,0x48, 0x1B,0x4E, 0x6A,0x65, 0x63, 0x0D, 0x0A }; - static const char iso2022cn_b[] = { 0x61, 0x1B,0x24,0x29,0x41, 0x62, 0x0E, 0x1B,0x24,0x29,0x47, 0x68,0x64, 0x0F, 0x63, 0x0D, 0x0A }; - static const char hzGB2312_a[] = { 0x61, 0x62, 0x7E,0x7B, 0x7E,0x7D, 0x63, 0x64 }; - static const EmptySegmentTest emptySegmentTests[] = { - /* converterName inputText inputTextLength */ - { "ISO-2022-JP", iso2022jp_a, sizeof(iso2022jp_a) }, - { "ISO-2022-KR", iso2022kr_a, sizeof(iso2022kr_a) }, - { "ISO-2022-CN", iso2022cn_a, sizeof(iso2022cn_a) }, - { "ISO-2022-CN", iso2022cn_b, sizeof(iso2022cn_b) }, - { "HZ-GB-2312", hzGB2312_a, sizeof(hzGB2312_a) }, - /* terminator: */ - { NULL, NULL, 0, } - }; - const EmptySegmentTest * testPtr; - for (testPtr = emptySegmentTests; testPtr->converterName != NULL; ++testPtr) { - UErrorCode err = U_ZERO_ERROR; - UConverter * cnv = ucnv_open(testPtr->converterName, &err); - if (U_FAILURE(err)) { - log_data_err("Unable to open %s converter: %s\n", testPtr->converterName, u_errorName(err)); - return; - } - ucnv_setToUCallBack(cnv, UCNV_TO_U_CALLBACK_EMPTYSEGMENT, NULL, NULL, NULL, &err); - if (U_FAILURE(err)) { - log_data_err("Unable to setToUCallBack for %s converter: %s\n", testPtr->converterName, u_errorName(err)); - ucnv_close(cnv); - return; - } - { - UChar toUChars[kEmptySegmentToUCharsMax]; - UChar * toUCharsPtr = toUChars; - const UChar * toUCharsLimit = toUCharsPtr + kEmptySegmentToUCharsMax; - const char * inCharsPtr = testPtr->inputText; - const char * inCharsLimit = inCharsPtr + testPtr->inputTextLength; - ucnv_toUnicode(cnv, &toUCharsPtr, toUCharsLimit, &inCharsPtr, inCharsLimit, NULL, true, &err); - } - ucnv_close(cnv); - } -} - static void TestEBCDIC_STATEFUL() { /* test input */ -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2