aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/test_http_reasons.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/test_http_reasons.c')
-rw-r--r--src/microhttpd/test_http_reasons.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/microhttpd/test_http_reasons.c b/src/microhttpd/test_http_reasons.c
index 4d0484ad..7c2c3efd 100644
--- a/src/microhttpd/test_http_reasons.c
+++ b/src/microhttpd/test_http_reasons.c
@@ -28,7 +28,8 @@
28#include "microhttpd.h" 28#include "microhttpd.h"
29#include "mhd_str.h" 29#include "mhd_str.h"
30 30
31static int expect_result (int code, const char*expected) 31static int
32expect_result (int code, const char*expected)
32{ 33{
33 const char*const reason = MHD_get_reason_phrase_for (code); 34 const char*const reason = MHD_get_reason_phrase_for (code);
34 if (MHD_str_equal_caseless_ (reason, expected)) 35 if (MHD_str_equal_caseless_ (reason, expected))
@@ -39,12 +40,16 @@ static int expect_result (int code, const char*expected)
39 return 1; 40 return 1;
40} 41}
41 42
42static int expect_absent (int code) 43
44static int
45expect_absent (int code)
43{ 46{
44 return expect_result (code, "unknown"); 47 return expect_result (code, "unknown");
45} 48}
46 49
47static int test_absent_codes (void) 50
51static int
52test_absent_codes (void)
48{ 53{
49 int errcount = 0; 54 int errcount = 0;
50 errcount += expect_absent (0); 55 errcount += expect_absent (0);
@@ -58,7 +63,9 @@ static int test_absent_codes (void)
58 return errcount; 63 return errcount;
59} 64}
60 65
61static int test_1xx (void) 66
67static int
68test_1xx (void)
62{ 69{
63 int errcount = 0; 70 int errcount = 0;
64 errcount += expect_result (MHD_HTTP_CONTINUE, "continue"); 71 errcount += expect_result (MHD_HTTP_CONTINUE, "continue");
@@ -68,7 +75,9 @@ static int test_1xx (void)
68 return errcount; 75 return errcount;
69} 76}
70 77
71static int test_2xx (void) 78
79static int
80test_2xx (void)
72{ 81{
73 int errcount = 0; 82 int errcount = 0;
74 errcount += expect_result (MHD_HTTP_OK, "ok"); 83 errcount += expect_result (MHD_HTTP_OK, "ok");
@@ -80,7 +89,9 @@ static int test_2xx (void)
80 return errcount; 89 return errcount;
81} 90}
82 91
83static int test_3xx (void) 92
93static int
94test_3xx (void)
84{ 95{
85 int errcount = 0; 96 int errcount = 0;
86 errcount += expect_result (MHD_HTTP_MULTIPLE_CHOICES, "multiple choices"); 97 errcount += expect_result (MHD_HTTP_MULTIPLE_CHOICES, "multiple choices");
@@ -91,7 +102,9 @@ static int test_3xx (void)
91 return errcount; 102 return errcount;
92} 103}
93 104
94static int test_4xx (void) 105
106static int
107test_4xx (void)
95{ 108{
96 int errcount = 0; 109 int errcount = 0;
97 errcount += expect_result (MHD_HTTP_BAD_REQUEST, "bad request"); 110 errcount += expect_result (MHD_HTTP_BAD_REQUEST, "bad request");
@@ -108,7 +121,9 @@ static int test_4xx (void)
108 return errcount; 121 return errcount;
109} 122}
110 123
111static int test_5xx (void) 124
125static int
126test_5xx (void)
112{ 127{
113 int errcount = 0; 128 int errcount = 0;
114 errcount += expect_result (MHD_HTTP_INTERNAL_SERVER_ERROR, 129 errcount += expect_result (MHD_HTTP_INTERNAL_SERVER_ERROR,
@@ -123,7 +138,9 @@ static int test_5xx (void)
123 return errcount; 138 return errcount;
124} 139}
125 140
126int main (int argc, char *argv[]) 141
142int
143main (int argc, char *argv[])
127{ 144{
128 int errcount = 0; 145 int errcount = 0;
129 (void) argc; (void) argv; /* Unused. Silent compiler warning. */ 146 (void) argc; (void) argv; /* Unused. Silent compiler warning. */