diff options
-rw-r--r-- | src/microhttpd/test_mhd_version.c | 25 | ||||
-rw-r--r-- | 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 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * @file microhttpd/test_mhd_version.h | 21 | * @file microhttpd/test_mhd_version.с |
22 | * @brief Tests for MHD versions identifiers | 22 | * @brief Tests for MHD versions identifiers |
23 | * @author Karlson2k (Evgeny Grin) | 23 | * @author Karlson2k (Evgeny Grin) |
24 | */ | 24 | */ |
@@ -103,16 +103,22 @@ test_macro2_vs_func_str (void) | |||
103 | static int | 103 | static int |
104 | test_func_str_vs_macro_bin (void) | 104 | test_func_str_vs_macro_bin (void) |
105 | { | 105 | { |
106 | #ifdef HAVE_SNPRINTF | 106 | char bin_print[64]; |
107 | char bin_print[10]; | ||
108 | int res; | 107 | int res; |
109 | const char *str_func = MHD_get_version (); | 108 | const char *str_func = MHD_get_version (); |
110 | 109 | ||
111 | printf ("Checking MHD_get_version() function vs MHD_VERSION macro.\n"); | 110 | printf ("Checking MHD_get_version() function vs MHD_VERSION macro.\n"); |
111 | #ifdef HAVE_SNPRINTF | ||
112 | res = snprintf (bin_print, sizeof(bin_print), "%X.%X.%X", | 112 | res = snprintf (bin_print, sizeof(bin_print), "%X.%X.%X", |
113 | (unsigned int) ((bin_macro >> 24) & 0xFF), | 113 | (unsigned int) ((bin_macro >> 24) & 0xFF), |
114 | (unsigned int) ((bin_macro >> 16) & 0xFF), | 114 | (unsigned int) ((bin_macro >> 16) & 0xFF), |
115 | (unsigned int) ((bin_macro >> 8) & 0xFF)); | 115 | (unsigned int) ((bin_macro >> 8) & 0xFF)); |
116 | #else /* ! HAVE_SNPRINTF */ | ||
117 | res = sprintf (bin_print, "%X.%X.%X", | ||
118 | (unsigned int) ((bin_macro >> 24) & 0xFF), | ||
119 | (unsigned int) ((bin_macro >> 16) & 0xFF), | ||
120 | (unsigned int) ((bin_macro >> 8) & 0xFF)); | ||
121 | #endif /* ! HAVE_SNPRINTF */ | ||
116 | if ((9 < res) || (0 >= res)) | 122 | if ((9 < res) || (0 >= res)) |
117 | { | 123 | { |
118 | fprintf (stderr, "snprintf() error.\n"); | 124 | fprintf (stderr, "snprintf() error.\n"); |
@@ -132,11 +138,6 @@ test_func_str_vs_macro_bin (void) | |||
132 | bin_macro, | 138 | bin_macro, |
133 | bin_print); | 139 | bin_print); |
134 | return 0; | 140 | return 0; |
135 | #else /* ! HAVE_SNPRINTF */ | ||
136 | fprintf (stderr, "snprintf() function is not available. " | ||
137 | "Cannot check binary/string match.\n"); | ||
138 | return 0; | ||
139 | #endif /* ! HAVE_SNPRINTF */ | ||
140 | } | 141 | } |
141 | 142 | ||
142 | 143 | ||
@@ -219,5 +220,11 @@ main (void) | |||
219 | res += test_macro_vs_func_bin (); | 220 | res += test_macro_vs_func_bin (); |
220 | res += test_func_bin_format (); | 221 | res += test_func_bin_format (); |
221 | 222 | ||
222 | return 0 == res ? 0 : 1; | 223 | if (0 != res) |
224 | { | ||
225 | fprintf (stderr, "Test failed. Number of errors: %d\n", res); | ||
226 | return 1; | ||
227 | } | ||
228 | printf ("Test succeed.\n"); | ||
229 | return 0; | ||
223 | } | 230 | } |
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) | |||
304 | errorCount += testLongHeaderGet (VERY_LONG / 2 + 1893); | 304 | errorCount += testLongHeaderGet (VERY_LONG / 2 + 1893); |
305 | if (errorCount != 0) | 305 | if (errorCount != 0) |
306 | fprintf (stderr, "Error (code: %u)\n", errorCount); | 306 | fprintf (stderr, "Error (code: %u)\n", errorCount); |
307 | else | ||
308 | printf ("Test succeed.\n"); | ||
307 | curl_global_cleanup (); | 309 | curl_global_cleanup (); |
308 | return (0 == errorCount) ? 0 : 1; /* 0 == pass */ | 310 | return (0 == errorCount) ? 0 : 1; /* 0 == pass */ |
309 | } | 311 | } |