]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(special): Add tests for a too small buffer for ecvt_r and fcvt_r.
authorUlrich Drepper <drepper@redhat.com>
Wed, 10 Nov 1999 08:13:56 +0000 (08:13 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 10 Nov 1999 08:13:56 +0000 (08:13 +0000)
misc/tst-efgcvt.c

index cfbaa21cb108f94dddba674fbfd633ae7e49c45c..74dd6bd8d3c0f1ea3f2f9de2be2e3fb8bf68cc45 100644 (file)
@@ -120,9 +120,10 @@ test (testcase tests[], efcvt_func efcvt, const char *name)
 void
 special (void)
 {
-  int decpt, sign;
+  int decpt, sign, res;
   char *p;
-
+  char buf [1024];
+  
   p = ecvt (NAN, 10, &decpt, &sign);
   if (sign != 0 || strcmp (p, "nan") != 0)
     output_error ("ecvt", NAN, 10, "nan", 0, 0, p, decpt, sign);
@@ -135,6 +136,20 @@ special (void)
   (void) ecvt (123.456, 10000, &decpt, &sign);
   (void) fcvt (123.456, 10000, &decpt, &sign);
 
+  /* Some tests for for the reentrant functions.  */
+  /* Use a too small buffer.  */
+  res = ecvt_r (123.456, 10, &decpt, &sign, buf, 1);
+  if (res == 0)
+    {
+      printf ("ecvt_r with a too small buffer was succesful.\n");
+      ++error_count;
+    }
+  res = fcvt_r (123.456, 10, &decpt, &sign, buf, 1);
+  if (res == 0)
+    {
+      printf ("fcvt_r with a too small buffer was succesful.\n");
+      ++error_count;
+    }
 }