1 Star 0 Fork 34

huajingyun/icu

forked from src-openEuler/icu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-remove-TestJitterbug6175.patch 4.76 KB
一键复制 编辑 原始数据 按行查看 历史
周文培 提交于 2022-11-15 09:49 . update to icu4c-72.1
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/huajingyun/icu.git
git@gitee.com:huajingyun/icu.git
huajingyun
icu
icu
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385