Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard via Newlib <newlib@sourceware.org>2020-07-10 02:58:48 +0300
committerCorinna Vinschen <corinna@vinschen.de>2020-07-10 11:51:43 +0300
commitb21ad33e088e1c302e3b88e052f6a4ee903fa51b (patch)
tree349ba02d250b4e60dd8fe1544ebdcd0e6df23d23 /newlib/testsuite
parent24f3c6195395b8836f51fbfaeca35062c60bb056 (diff)
testsuite: Fix iconv tests to use new encoding config defines
_ICONV_CONVERTER -> ICONV_FROM_ENCODING. It's not perfect, as the library can support different from/to encodings now, but at least in the default configurations the tests now work. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'newlib/testsuite')
-rw-r--r--newlib/testsuite/newlib.iconv/iconvjp.c61
-rw-r--r--newlib/testsuite/newlib.iconv/iconvnm.c8
-rw-r--r--newlib/testsuite/newlib.iconv/iconvru.c26
3 files changed, 47 insertions, 48 deletions
diff --git a/newlib/testsuite/newlib.iconv/iconvjp.c b/newlib/testsuite/newlib.iconv/iconvjp.c
index 2022851a3..6c85399c7 100644
--- a/newlib/testsuite/newlib.iconv/iconvjp.c
+++ b/newlib/testsuite/newlib.iconv/iconvjp.c
@@ -31,12 +31,12 @@
#ifdef _ICONV_ENABLED
-#if defined(_ICONV_CONVERTER_UTF_8) || \
- defined(_ICONV_CONVERTER_EUC_JP) || \
- defined(_ICONV_CONVERTER_SHIFT_JIS) || \
- defined(_ICONV_CONVERTER_UCS_2_INTERNAL)
+#if defined(_ICONV_FROM_ENCODING_UTF_8) || \
+ defined(_ICONV_FROM_ENCODING_EUC_JP) || \
+ defined(_ICONV_FROM_ENCODING_SHIFT_JIS) || \
+ defined(_ICONV_FROM_ENCODING_UCS_2_INTERNAL)
-#ifdef _ICONV_CONVERTER_UTF_8
+#ifdef _ICONV_FROM_ENCODING_UTF_8
char utf8[] =
{
0xe8,0x89,0xb2,0xe3,0x80,0x85,0xe3,0x83,0x86,0xe3,
@@ -227,9 +227,9 @@ char utf8[] =
0x95,0xe3,0x82,0xa9,0xe3,0x83,0xbc,0xe3,0x83,0x9e,
0xe3,0x83,0x83,0xe3,0x83,0x88,0x0d,0xa
};
-#endif /* ifdef _ICONV_CONVERTER_UTF_8 */
-
-#ifdef _ICONV_CONVERTER_EUC_JP
+#endif /* ifdef _ICONV_FROM_ENCODING_UTF_8 */
+
+#ifdef _ICONV_FROM_ENCODING_EUC_JP
char euc_jp[] =
{
0xbf,0xa7,0xa1,0xb9,0xa5,0xc6,0xa5,0xad,0xa5,0xb9,
@@ -394,10 +394,10 @@ char utf8[] =
0xa5,0xca,0xa5,0xea,0x49,0x49,0xa5,0xd5,0xa5,0xa9,
0xa1,0xbc,0xa5,0xde,0xa5,0xc3,0xa5,0xc8,0x0d,0x0a
};
-#endif /* #ifdef _ICONV_CONVERTER_EUC_JP */
+#endif /* #ifdef _ICONV_FROM_ENCODING_EUC_JP */
-#ifdef _ICONV_CONVERTER_SHIFT_JIS
-char shift_jis[] =
+#ifdef _ICONV_FROM_ENCODING_SHIFT_JIS
+char shift_jis[] =
{
0x90,0x46,0x81,0x58,0x83,0x65,0x83,0x4c,0x83,0x58,
0x83,0x67,0x83,0x74,0x83,0x40,0x83,0x43,0x83,0x8b,
@@ -561,9 +561,9 @@ char shift_jis[] =
0x83,0x69,0x83,0x8a,0x49,0x49,0x83,0x74,0x83,0x48,
0x81,0x5b,0x83,0x7d,0x83,0x62,0x83,0x67,0x0d,0x0a
};
-#endif /* _ICONV_CONVERTER_SHIFT_JIS */
+#endif /* _ICONV_FROM_ENCODING_SHIFT_JIS */
-#ifdef _ICONV_CONVERTER_UCS_2_INTERNAL
+#ifdef _ICONV_FROM_ENCODING_UCS_2_INTERNAL
short ucs2[] =
{
0x8272,0x3005,0x30c6,0x30ad,0x30b9,
@@ -849,18 +849,18 @@ struct iconv_data
#define CONVERSIONS 4
-struct iconv_data data[] =
+struct iconv_data data[] =
{
-#ifdef _ICONV_CONVERTER_EUC_JP
+#if defined(_ICONV_FROM_ENCODING_EUC_JP) && defined(_ICONV_TO_ENCODING_EUC_JP)
{sizeof(euc_jp), "EUC-JP", (char *)euc_jp},
#endif
-#ifdef _ICONV_CONVERTER_SHIFT_JIS
+#if defined(_ICONV_FROM_ENCODING_SHIFT_JIS) && defined(_ICONV_TO_ENCODING_SHIFT_JIS)
{sizeof(shift_jis), "SHIFT-JIS", (char *)shift_jis},
#endif
-#ifdef _ICONV_CONVERTER_UTF_8
+#if defined(_ICONV_FROM_ENCODING_UTF_8) && defined(_ICONV_TO_ENCODING_UTF_8)
{sizeof(utf8), "UTF-8", (char *)utf8},
#endif
-#ifdef _ICONV_CONVERTER_UCS_2_INTERNAL
+#if defined(_ICONV_FROM_ENCODING_UCS_2_INTERNAL) && defined(_ICONV_TO_ENCODING_UCS_2_INTERNAL)
{sizeof(ucs2), "UCS-2-INTERNAL", (char *)ucs2},
#endif
{0, NULL, NULL}
@@ -881,7 +881,7 @@ int main(int argc, char **argv)
int conversions = sizeof(data)/sizeof(struct iconv_data) - 1;
puts("JP iconv test");
-
+
for (i = 0; i < conversions; i++)
{
for (j = 0; j < conversions; j++)
@@ -895,7 +895,7 @@ int main(int argc, char **argv)
}
}
}
-
+
d = 0;
for (i = 0; i < conversions; i++)
{
@@ -911,8 +911,8 @@ int main(int argc, char **argv)
perror("Can't reset shift state");
CHECK(ERROR);
}
-
- n = iconv(descs[d++], (const char **)&(inbuf), &inbytes,
+
+ n = iconv(descs[d++], (const char **)&(inbuf), &inbytes,
(char **)&outbuf, &outbytes);
if (n == (size_t)-1)
{
@@ -921,7 +921,7 @@ int main(int argc, char **argv)
perror("");
CHECK(ERROR);
}
-
+
if (data[j].len != OUTBUF_LEN - outbytes)
{
printf("Conversion from %s to %s FAILED",
@@ -930,7 +930,7 @@ int main(int argc, char **argv)
OUTBUF_LEN - outbytes, data[j].len);
CHECK(ERROR);
}
-
+
for (k = 0; k < data[j].len; k++)
{
if (ob[k] != data[j].data[k])
@@ -940,18 +940,18 @@ int main(int argc, char **argv)
printf("Error: byte %d is wrong\n", k);
printf("outbuf value: %#x, inbuf value %#x, "
"right value: %#x\n",
- (int)ob[k], (int)(data[i].data[k]),
+ (int)ob[k], (int)(data[i].data[k]),
(int)(data[j].data[k]));
CHECK(ERROR);
}
}
printf("iconv from %s to %s was successfully done\n",
- data[i].name, data[j].name);
-
+ data[i].name, data[j].name);
+
}
}
-
+
d = 0;
for (i = 0; i < conversions; i++)
for (j = 0; j < conversions; j++)
@@ -960,14 +960,14 @@ int main(int argc, char **argv)
exit(0);
}
-#else /* #if defined(_ICONV_CONVERTER_UTF_8) || ... */
+#else /* #if defined(_ICONV_FROM_ENCODING_UTF_8) || ... */
int main(int argc, char **argv)
{
puts("None of UTF-8, EUC-JP, SHIFT-JIS and UCS-2_INTERNAL converters "
"linked, SKIP test");
exit(0);
}
-#endif /* #if defined(_ICONV_CONVERTER_UTF_8) || ... */
+#endif /* #if defined(_ICONV_FROM_ENCODING_UTF_8) || ... */
#else /* #ifdef _ICONV_ENABLED */
int main(int argc, char **argv)
@@ -976,4 +976,3 @@ int main(int argc, char **argv)
exit(0);
}
#endif /* #ifdef _ICONV_ENABLED */
-
diff --git a/newlib/testsuite/newlib.iconv/iconvnm.c b/newlib/testsuite/newlib.iconv/iconvnm.c
index d7ef2162c..b3ebc4765 100644
--- a/newlib/testsuite/newlib.iconv/iconvnm.c
+++ b/newlib/testsuite/newlib.iconv/iconvnm.c
@@ -33,13 +33,13 @@
#ifdef _ICONV_ENABLED
char *good_names[] = {
-#ifdef _ICONV_CONVERTER_ISO_8859_5
+#ifdef _ICONV_FROM_ENCODING_ISO_8859_5
"iso_8859_5", "iso-8859-5", "iso-8859_5", "IsO-8859_5"
-#elif defined _ICONV_CONVERTER_US_ASCII
+#elif defined _ICONV_FROM_ENCODING_US_ASCII
"us_ascii", "US_ASCII", "us-ASCII", "US-ASCII"
-#elif defined _ICONV_CONVERTER_EUC_JP
+#elif defined _ICONV_FROM_ENCODING_EUC_JP
"euc-jp", "EUC_JP", "euc-JP", "EUC-JP"
-#elif defined _ICONV_CONVERTER_UTF_8
+#elif defined _ICONV_FROM_ENCODING_UTF_8
"utf_8", "UTF_8", "uTf-8", "UTF-8"
#else
#endif
diff --git a/newlib/testsuite/newlib.iconv/iconvru.c b/newlib/testsuite/newlib.iconv/iconvru.c
index 7f02ebcbd..aa56603e6 100644
--- a/newlib/testsuite/newlib.iconv/iconvru.c
+++ b/newlib/testsuite/newlib.iconv/iconvru.c
@@ -32,11 +32,11 @@
#ifdef _ICONV_ENABLED
-#if defined(_ICONV_CONVERTER_UTF_8) || \
- defined(_ICONV_CONVERTER_ISO_8859_5) || \
- defined(_ICONV_CONVERTER_KOI8_R)
+#if defined(_ICONV_FROM_ENCODING_UTF_8) || \
+ defined(_ICONV_FROM_ENCODING_ISO_8859_5) || \
+ defined(_ICONV_FROM_ENCODING_KOI8_R)
-#ifdef _ICONV_CONVERTER_ISO_8859_5
+#ifdef _ICONV_FROM_ENCODING_ISO_8859_5
char iso_8859_5[] =
{
0xbe,0xdf,0xd5,0xe0,0xd0,0xe2,0xde,0xe0,0xeb,0x20,
@@ -137,9 +137,9 @@ char iso_8859_5[] =
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x2d,
0x2d,0x2d,0x3e,0x0a
};
-#endif /* #ifdef _ICONV_CONVERTER_ISO_8859_5 */
+#endif /* #ifdef _ICONV_FROM_ENCODING_ISO_8859_5 */
-#ifdef _ICONV_CONVERTER_KOI8_R
+#ifdef _ICONV_FROM_ENCODING_KOI8_R
char koi8_r[] =
{
0xef,0xd0,0xc5,0xd2,0xc1,0xd4,0xcf,0xd2,0xd9,0x20,
@@ -240,9 +240,9 @@ char koi8_r[] =
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x2d,
0x2d,0x2d,0x3e,0x0a
};
-#endif /* #ifdef _ICONV_CONVERTER_KOI8_R */
+#endif /* #ifdef _ICONV_FROM_ENCODING_KOI8_R */
-#ifdef _ICONV_CONVERTER_UTF_8
+#ifdef _ICONV_FROM_ENCODING_UTF_8
char utf8[] =
{
0xd0,0x9e,0xd0,0xbf,0xd0,0xb5,0xd1,0x80,0xd0,0xb0,
@@ -365,13 +365,13 @@ struct iconv_data
struct iconv_data data[] =
{
-#ifdef _ICONV_CONVERTER_ISO_8859_5
+#ifdef _ICONV_FROM_ENCODING_ISO_8859_5
{sizeof(iso_8859_5), "ISO-8859-5", (char *)iso_8859_5},
#endif
-#ifdef _ICONV_CONVERTER_KOI8_R
+#ifdef _ICONV_FROM_ENCODING_KOI8_R
{sizeof(koi8_r), "KOI8-R", (char *)koi8_r},
#endif
-#ifdef _ICONV_CONVERTER_UTF_8
+#ifdef _ICONV_FROM_ENCODING_UTF_8
{sizeof(utf8), "UTF-8", (char *)utf8},
#endif
{0, NULL, NULL}
@@ -471,13 +471,13 @@ int main(int argc, char **argv)
exit(0);
}
-#else /* #if defined(_ICONV_CONVERTER_UTF_8) || ... */
+#else /* #if defined(_ICONV_FROM_ENCODING_UTF_8) || ... */
int main(int argc, char **argv)
{
puts("None of ISO-8859-5, KOI8-R and UTF-8 converters linked, SKIP test");
exit(0);
}
-#endif /* #if defined(_ICONV_CONVERTER_UTF_8) || ... */
+#endif /* #if defined(_ICONV_FROM_ENCODING_UTF_8) || ... */
#else /* #ifdef _ICONV_ENABLED */
int main(int argc, char **argv)