[Pkg-gnupg-commit] [libassuan] 369/437: vasprintf.c: Improve test code.

Eric Dorland eric at moszumanska.debian.org
Fri May 22 05:34:05 UTC 2015


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository libassuan.

commit ff9a8c2e64ea2345f2ebe85a527b7c43033ba53e
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Dec 13 18:22:22 2011 +0100

    vasprintf.c: Improve test code.
    
    * src/vasprintf.c (checkit): Set flag for a test failure.
    (main): Return error on any failure.
---
 src/vasprintf.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/vasprintf.c b/src/vasprintf.c
index e55408a..bacb71c 100644
--- a/src/vasprintf.c
+++ b/src/vasprintf.c
@@ -33,10 +33,10 @@ Boston, MA 02111-1307, USA.  */
 #define va_copy(d, s) (*(d) = *(s))
 #elif defined (MUST_COPY_VA_BYVAL)
 #define va_copy(d, s) ((d) = (s))
-#else 
+#else
 #define va_copy(d, s) memcpy ((d), (s), sizeof (va_list))
-#endif 
-#endif 
+#endif
+#endif
 
 
 #ifdef TEST
@@ -175,6 +175,7 @@ _assuan_asprintf (char **buf, const char *fmt, ...)
 
 #define asprintf  _assuan_asprintf
 #define vasprintf _assuan_vasprintf
+static int any_failed;
 
 void
 checkit (const char* format, ...)
@@ -187,7 +188,10 @@ checkit (const char* format, ...)
   if (strlen (result) < global_total_width)
     printf ("PASS: ");
   else
-    printf ("FAIL: ");
+    {
+      any_failed = 1;
+      printf ("FAIL: ");
+    }
   printf ("%d %s\n", global_total_width, result);
 }
 
@@ -201,5 +205,7 @@ main (void)
   checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
 777777777777777777333333333333366666666666622222222222777777777777733333");
   checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx");
+  checkit ("%2$f%4$s%3$d%1$s", "asdjffffffffffffffiiiiiiiiiiixxxxx", 1.0, 77, "foo");
+  return any_failed;
 }
 #endif /* TEST */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/libassuan.git



More information about the Pkg-gnupg-commit mailing list