unigbrk: New modules for grapheme clusters.
[pspp] / tests / test-inttostr.c
index e53d22a064a7b7a632bfec700a42bebae0763a58..1ff35c08c3d7f4ab99af83b14e34c7e8f04637d8 100644 (file)
 int
 main (void)
 {
-  CK (int,          inttostr);
-  CK (unsigned int, uinttostr);
-  CK (off_t,        offtostr);
-  CK (uintmax_t,    umaxtostr);
-  CK (intmax_t,     imaxtostr);
-  return 0;
+  size_t b_size = 2;
+  char *b = malloc (b_size);
+  ASSERT (b);
+
+  /* Ideally we would rely on the snprintf-posix module, in which case
+     this guard would not be required, but due to limitations in gnulib's
+     implementation (see modules/snprintf-posix), we cannot.  */
+  if (snprintf (b, b_size, "%ju", (uintmax_t) 3) == 1
+      && b[0] == '3' && b[1] == '\0')
+    {
+      CK (int,          inttostr);
+      CK (unsigned int, uinttostr);
+      CK (off_t,        offtostr);
+      CK (uintmax_t,    umaxtostr);
+      CK (intmax_t,     imaxtostr);
+      return 0;
+    }
+
+  /* snprintf doesn't accept %ju; skip this test.  */
+  return 77;
 }