X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Funiconv%2Ftest-u32-strconv-from-enc.c;h=85b58e0440351164c2eb1be9b7b5c8a0431afced;hb=1276a2c5f24c0c932426aca9c899fa524d2443f2;hp=ab8b86c147a95738b5b897796a7f75e1ec28617c;hpb=ed19b2c7ddd7da88eb8e0c2472e4a332cf409113;p=gnulib.git
diff --git a/tests/uniconv/test-u32-strconv-from-enc.c b/tests/uniconv/test-u32-strconv-from-enc.c
index ab8b86c14..85b58e044 100644
--- a/tests/uniconv/test-u32-strconv-from-enc.c
+++ b/tests/uniconv/test-u32-strconv-from-enc.c
@@ -1,10 +1,10 @@
/* Test of conversion to UTF-32 from legacy encodings.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 Free Software Foundation, Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -12,23 +12,18 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program. If not, see . */
/* Written by Bruno Haible , 2007. */
-#ifdef HAVE_CONFIG_H
-# include
-#endif
+#include
#include "uniconv.h"
#include
#include "unistr.h"
-
-#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(expr) if (!(expr)) abort ();
+#include "macros.h"
int
main ()
@@ -47,11 +42,11 @@ main ()
enum iconv_ilseq_handler handler = handlers[h];
static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
static const uint32_t expected[] = /* Ãrger mit bösen Bübchen ohne Augenmaà */
- {
- 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's',
- 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h',
- 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0
- };
+ {
+ 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's',
+ 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h',
+ 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0
+ };
uint32_t *result = u32_strconv_from_encoding (input, "ISO-8859-1", handler);
ASSERT (result != NULL);
ASSERT (u32_strcmp (result, expected) == 0);
@@ -64,10 +59,10 @@ main ()
enum iconv_ilseq_handler handler = handlers[h];
static const char input[] = "Rafa\263 Maszkowski"; /* RafaÅ Maszkowski */
static const uint32_t expected[] =
- {
- 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w',
- 's', 'k', 'i', 0
- };
+ {
+ 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w',
+ 's', 'k', 'i', 0
+ };
uint32_t *result = u32_strconv_from_encoding (input, "ISO-8859-2", handler);
ASSERT (result != NULL);
ASSERT (u32_strcmp (result, expected) == 0);
@@ -75,16 +70,16 @@ main ()
}
/* autodetect_jp is only supported when iconv() support ISO-2022-JP-2. */
-# if defined _LIBICONV_VERSION || !(defined _AIX || defined __sgi || defined __hpux || defined __osf__)
+# if defined _LIBICONV_VERSION || !(defined _AIX || defined __sgi || defined __hpux || defined __osf__ || defined __sun)
/* Test conversions from autodetect_jp to UTF-16. */
for (h = 0; h < SIZEOF (handlers); h++)
{
enum iconv_ilseq_handler handler = handlers[h];
static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* ããã«ã¡ã¯ in EUC-JP */
static const uint32_t expected[] = /* ããã«ã¡ã¯ */
- {
- 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0
- };
+ {
+ 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0
+ };
uint32_t *result = u32_strconv_from_encoding (input, "autodetect_jp", handler);
ASSERT (result != NULL);
ASSERT (u32_strcmp (result, expected) == 0);
@@ -95,9 +90,9 @@ main ()
enum iconv_ilseq_handler handler = handlers[h];
static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* ããã«ã¡ã¯ in Shift_JIS */
static const uint32_t expected[] = /* ããã«ã¡ã¯ */
- {
- 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0
- };
+ {
+ 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0
+ };
uint32_t *result = u32_strconv_from_encoding (input, "autodetect_jp", handler);
ASSERT (result != NULL);
ASSERT (u32_strcmp (result, expected) == 0);
@@ -108,9 +103,9 @@ main ()
enum iconv_ilseq_handler handler = handlers[h];
static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* ããã«ã¡ã¯ in ISO-2022-JP-2 */
static const uint32_t expected[] = /* ããã«ã¡ã¯ */
- {
- 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0
- };
+ {
+ 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0
+ };
uint32_t *result = u32_strconv_from_encoding (input, "autodetect_jp", handler);
ASSERT (result != NULL);
ASSERT (u32_strcmp (result, expected) == 0);