gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 08/29: tests: minor improvemnts


From: gnunet
Subject: [libmicrohttpd] 08/29: tests: minor improvemnts
Date: Tue, 20 Jun 2023 22:24:21 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit dce208464a89dfe8e72a4bc4e7aa6b0c8b2563bf
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Jun 12 20:23:25 2023 +0300

    tests: minor improvemnts
---
 src/microhttpd/test_mhd_version.c | 25 ++++++++++++++++---------
 src/testcurl/test_long_header.c   |  2 ++
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/src/microhttpd/test_mhd_version.c 
b/src/microhttpd/test_mhd_version.c
index 654acf30..bd91d64d 100644
--- a/src/microhttpd/test_mhd_version.c
+++ b/src/microhttpd/test_mhd_version.c
@@ -18,7 +18,7 @@
 */
 
 /**
- * @file microhttpd/test_mhd_version.h
+ * @file microhttpd/test_mhd_version.с
  * @brief  Tests for MHD versions identifiers
  * @author Karlson2k (Evgeny Grin)
  */
@@ -103,16 +103,22 @@ test_macro2_vs_func_str (void)
 static int
 test_func_str_vs_macro_bin (void)
 {
-#ifdef HAVE_SNPRINTF
-  char bin_print[10];
+  char bin_print[64];
   int res;
   const char *str_func = MHD_get_version ();
 
   printf ("Checking MHD_get_version() function vs MHD_VERSION macro.\n");
+#ifdef HAVE_SNPRINTF
   res = snprintf (bin_print, sizeof(bin_print), "%X.%X.%X",
                   (unsigned int) ((bin_macro >> 24) & 0xFF),
                   (unsigned int) ((bin_macro >> 16) & 0xFF),
                   (unsigned int) ((bin_macro >> 8) & 0xFF));
+#else  /* ! HAVE_SNPRINTF */
+  res = sprintf (bin_print, "%X.%X.%X",
+                 (unsigned int) ((bin_macro >> 24) & 0xFF),
+                 (unsigned int) ((bin_macro >> 16) & 0xFF),
+                 (unsigned int) ((bin_macro >> 8) & 0xFF));
+#endif /* ! HAVE_SNPRINTF */
   if ((9 < res) || (0 >= res))
   {
     fprintf (stderr, "snprintf() error.\n");
@@ -132,11 +138,6 @@ test_func_str_vs_macro_bin (void)
            bin_macro,
            bin_print);
   return 0;
-#else  /* ! HAVE_SNPRINTF */
-  fprintf (stderr, "snprintf() function is not available. "
-           "Cannot check binary/string match.\n");
-  return 0;
-#endif /* ! HAVE_SNPRINTF */
 }
 
 
@@ -219,5 +220,11 @@ main (void)
   res += test_macro_vs_func_bin ();
   res += test_func_bin_format ();
 
-  return 0 == res ? 0 : 1;
+  if (0 != res)
+  {
+    fprintf (stderr, "Test failed. Number of errors: %d\n", res);
+    return 1;
+  }
+  printf ("Test succeed.\n");
+  return 0;
 }
diff --git a/src/testcurl/test_long_header.c b/src/testcurl/test_long_header.c
index a423d3b5..0f679d63 100644
--- a/src/testcurl/test_long_header.c
+++ b/src/testcurl/test_long_header.c
@@ -304,6 +304,8 @@ main (int argc, char *const *argv)
   errorCount += testLongHeaderGet (VERY_LONG / 2 + 1893);
   if (errorCount != 0)
     fprintf (stderr, "Error (code: %u)\n", errorCount);
+  else
+    printf ("Test succeed.\n");
   curl_global_cleanup ();
   return (0 == errorCount) ? 0 : 1;       /* 0 == pass */
 }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]