Remove NULL sentinels from test runner.

PR-URL: https://github.com/nodejs-private/http-parser-private/pull/1
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
make-http-max-header-size-gyp-configurable
Ben Noordhuis 7 years ago
parent 705e519bf5
commit 214fa6fb0d

@ -41,6 +41,8 @@
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*x))
static http_parser *parser;
struct message {
@ -1171,8 +1173,6 @@ const struct message requests[] =
,.headers= { { "Host", "example.com" } }
,.body= ""
}
, {.name= NULL } /* sentinel */
};
/* * R E S P O N S E S * */
@ -1950,8 +1950,6 @@ const struct message responses[] =
,.num_chunks_complete= 3
,.chunk_lengths= { 2, 2 }
}
, {.name= NULL } /* sentinel */
};
/* strnlen() is a POSIX.2008 addition. Can't rely on it being available so
@ -4101,9 +4099,7 @@ int
main (void)
{
parser = NULL;
int i, j, k;
int request_count;
int response_count;
unsigned i, j, k;
unsigned long version;
unsigned major;
unsigned minor;
@ -4117,9 +4113,6 @@ main (void)
printf("sizeof(http_parser) = %u\n", (unsigned int)sizeof(http_parser));
for (request_count = 0; requests[request_count].name; request_count++);
for (response_count = 0; responses[response_count].name; response_count++);
//// API
test_preserve_data();
test_parse_url();
@ -4162,23 +4155,23 @@ main (void)
test_simple_type("HTTP/1.01 200 OK\r\n\r\n", HPE_INVALID_VERSION, HTTP_RESPONSE);
test_simple_type("HTTP/1.1\t200 OK\r\n\r\n", HPE_INVALID_VERSION, HTTP_RESPONSE);
for (i = 0; i < response_count; i++) {
for (i = 0; i < ARRAY_SIZE(responses); i++) {
test_message(&responses[i]);
}
for (i = 0; i < response_count; i++) {
for (i = 0; i < ARRAY_SIZE(responses); i++) {
test_message_pause(&responses[i]);
}
for (i = 0; i < response_count; i++) {
for (i = 0; i < ARRAY_SIZE(responses); i++) {
test_message_connect(&responses[i]);
}
for (i = 0; i < response_count; i++) {
for (i = 0; i < ARRAY_SIZE(responses); i++) {
if (!responses[i].should_keep_alive) continue;
for (j = 0; j < response_count; j++) {
for (j = 0; j < ARRAY_SIZE(responses); j++) {
if (!responses[j].should_keep_alive) continue;
for (k = 0; k < response_count; k++) {
for (k = 0; k < ARRAY_SIZE(responses); k++) {
test_multiple3(&responses[i], &responses[j], &responses[k]);
}
}
@ -4394,19 +4387,19 @@ main (void)
/* check to make sure our predefined requests are okay */
for (i = 0; requests[i].name; i++) {
for (i = 0; i < ARRAY_SIZE(requests); i++) {
test_message(&requests[i]);
}
for (i = 0; i < request_count; i++) {
for (i = 0; i < ARRAY_SIZE(requests); i++) {
test_message_pause(&requests[i]);
}
for (i = 0; i < request_count; i++) {
for (i = 0; i < ARRAY_SIZE(requests); i++) {
if (!requests[i].should_keep_alive) continue;
for (j = 0; j < request_count; j++) {
for (j = 0; j < ARRAY_SIZE(requests); j++) {
if (!requests[j].should_keep_alive) continue;
for (k = 0; k < request_count; k++) {
for (k = 0; k < ARRAY_SIZE(requests); k++) {
test_multiple3(&requests[i], &requests[j], &requests[k]);
}
}

Loading…
Cancel
Save