Tests for module 'uniconv/u16-conv-to-enc'.
[gnulib.git] / tests / uniconv / test-u32-strconv-from-enc.c
index ab648cb..885aa58 100644 (file)
 
 /* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
 
 #include "uniconv.h"
 
+#include <stdio.h>
 #include <stdlib.h>
 
 #include "unistr.h"
 
 #define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+  do                                                                        \
+    {                                                                       \
+      if (!(expr))                                                          \
+        {                                                                   \
+          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+          abort ();                                                         \
+        }                                                                   \
+    }                                                                       \
+  while (0)
 
 int
 main ()
@@ -74,6 +82,8 @@ main ()
       free (result);
     }
 
+  /* autodetect_jp is only supported when iconv() support ISO-2022-JP-2.  */
+# if defined _LIBICONV_VERSION || !(defined _AIX || defined __sgi || defined __hpux || defined __osf__)
   /* Test conversions from autodetect_jp to UTF-16.  */
   for (h = 0; h < SIZEOF (handlers); h++)
     {
@@ -114,6 +124,7 @@ main ()
       ASSERT (u32_strcmp (result, expected) == 0);
       free (result);
     }
+# endif
 
 #endif