|
|
|
@ -4,15 +4,9 @@ |
|
|
|
|
|
|
|
|
|
#include "munit/munit.h" |
|
|
|
|
|
|
|
|
|
#ifndef READLINE_C |
|
|
|
|
#define READLINE_C |
|
|
|
|
#include "../src/readline.h" |
|
|
|
|
#endif |
|
|
|
|
#include "../src/request.h" |
|
|
|
|
#ifndef REQUESTRESPONSE_C |
|
|
|
|
#define REQUESTRESPONSE_C |
|
|
|
|
#include "../src/requestresponse.h" |
|
|
|
|
#endif /* ifndef REQUESTRESPONSE_C */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
@ -38,19 +32,25 @@ static requestTestFirstLine requestLine1Examples[] = { |
|
|
|
|
{ NULL, NULL, NULL, 80, NULL, 0, NULL, NULL } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
requestTestFirstLine* getLineObj( const MunitParameter params[] ){ |
|
|
|
|
const char *firstLine = munit_parameters_get(params, "L1" ); |
|
|
|
|
requestTestFirstLine *line = requestLine1Examples; |
|
|
|
|
|
|
|
|
|
while ( line->fullLine != NULL && strcmp( line->fullLine, firstLine ) != 0 ) |
|
|
|
|
line++; |
|
|
|
|
|
|
|
|
|
return line; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MunitResult testFirstLineProtocols(const MunitParameter params[], |
|
|
|
|
void* user_data_or_fixture){ |
|
|
|
|
Request *req; |
|
|
|
|
const char *firstLine = munit_parameters_get(params, "L1" ); |
|
|
|
|
requestTestFirstLine *line = requestLine1Examples; |
|
|
|
|
|
|
|
|
|
while ( line->fullLine != NULL && strcmp( line->fullLine, firstLine ) != 0 ) |
|
|
|
|
line++; |
|
|
|
|
|
|
|
|
|
requestTestFirstLine *line = getLineObj(params); |
|
|
|
|
|
|
|
|
|
if ( line->fullLine == NULL ) return MUNIT_ERROR; |
|
|
|
|
|
|
|
|
|
req = newRequest(); |
|
|
|
|
requestFirstLine( req, line->fullLine ); |
|
|
|
|
munit_assert_not_null( req->protocol ); |
|
|
|
@ -62,12 +62,7 @@ MunitResult testFirstLineProtocols(const MunitParameter params[], |
|
|
|
|
MunitResult testFirstLineMethod(const MunitParameter params[], |
|
|
|
|
void* user_data_or_fixture){ |
|
|
|
|
Request *req; |
|
|
|
|
const char *firstLine = munit_parameters_get(params, "L1" ); |
|
|
|
|
requestTestFirstLine *line = requestLine1Examples; |
|
|
|
|
|
|
|
|
|
while ( line->fullLine != NULL && strcmp( line->fullLine, firstLine ) != 0 ) |
|
|
|
|
line++; |
|
|
|
|
|
|
|
|
|
requestTestFirstLine *line = getLineObj(params); |
|
|
|
|
if ( line->fullLine == NULL ) return MUNIT_ERROR; |
|
|
|
|
req = newRequest(); |
|
|
|
|
requestFirstLine( req, line->fullLine ); |
|
|
|
@ -80,12 +75,7 @@ MunitResult testFirstLineMethod(const MunitParameter params[], |
|
|
|
|
MunitResult testFirstLineHosts(const MunitParameter params[], |
|
|
|
|
void* user_data_or_fixture){ |
|
|
|
|
Request *req; |
|
|
|
|
const char *firstLine = munit_parameters_get(params, "L1" ); |
|
|
|
|
requestTestFirstLine *line = requestLine1Examples; |
|
|
|
|
|
|
|
|
|
while ( line->fullLine != NULL && strcmp( line->fullLine, firstLine ) != 0 ) |
|
|
|
|
line++; |
|
|
|
|
|
|
|
|
|
requestTestFirstLine *line = getLineObj(params); |
|
|
|
|
if ( line->fullLine == NULL ) return MUNIT_ERROR; |
|
|
|
|
req = newRequest(); |
|
|
|
|
requestFirstLine( req, line->fullLine ); |
|
|
|
@ -98,12 +88,7 @@ MunitResult testFirstLineHosts(const MunitParameter params[], |
|
|
|
|
MunitResult testFirstLinePorts(const MunitParameter params[], |
|
|
|
|
void* user_data_or_fixture){ |
|
|
|
|
Request *req; |
|
|
|
|
const char *firstLine = munit_parameters_get(params, "L1" ); |
|
|
|
|
requestTestFirstLine *line = requestLine1Examples; |
|
|
|
|
|
|
|
|
|
while ( line->fullLine != NULL && strcmp( line->fullLine, firstLine ) != 0 ) |
|
|
|
|
line++; |
|
|
|
|
|
|
|
|
|
requestTestFirstLine *line = getLineObj(params); |
|
|
|
|
if ( line->fullLine == NULL ) return MUNIT_ERROR; |
|
|
|
|
req = newRequest(); |
|
|
|
|
requestFirstLine( req, line->fullLine ); |
|
|
|
@ -115,15 +100,8 @@ MunitResult testFirstLinePorts(const MunitParameter params[], |
|
|
|
|
MunitResult testFirstLinePaths(const MunitParameter params[], |
|
|
|
|
void* user_data_or_fixture){ |
|
|
|
|
Request *req; |
|
|
|
|
const char *firstLine = munit_parameters_get(params, "L1" ); |
|
|
|
|
requestTestFirstLine *line = requestLine1Examples; |
|
|
|
|
|
|
|
|
|
while ( line->fullLine != NULL && strcmp( line->fullLine, firstLine ) != 0 ) |
|
|
|
|
line++; |
|
|
|
|
|
|
|
|
|
requestTestFirstLine *line = getLineObj(params); |
|
|
|
|
if ( line->fullLine == NULL ) return MUNIT_ERROR; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
req = newRequest(); |
|
|
|
|
requestFirstLine( req, line->fullLine ); |
|
|
|
|
munit_assert_not_null( req->path ); |
|
|
|
@ -136,15 +114,8 @@ MunitResult testFirstLineVersions(const MunitParameter params[], |
|
|
|
|
void* user_data_or_fixture){ |
|
|
|
|
|
|
|
|
|
Request *req; |
|
|
|
|
const char *firstLine = munit_parameters_get(params, "L1" ); |
|
|
|
|
requestTestFirstLine *line = requestLine1Examples; |
|
|
|
|
|
|
|
|
|
while ( line->fullLine != NULL && strcmp( line->fullLine, firstLine ) != 0 ) |
|
|
|
|
line++; |
|
|
|
|
|
|
|
|
|
requestTestFirstLine *line = getLineObj(params); |
|
|
|
|
if ( line->fullLine == NULL ) return MUNIT_ERROR; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
req = newRequest(); |
|
|
|
|
requestFirstLine( req, line->fullLine ); |
|
|
|
|
munit_assert_float( req->version, ==, line->version ); |
|
|
|
@ -156,16 +127,8 @@ MunitResult testFirstLineVersions(const MunitParameter params[], |
|
|
|
|
MunitResult testFirstLineQueryString(const MunitParameter params[], |
|
|
|
|
void* user_data_or_fixture){ |
|
|
|
|
Request *req; |
|
|
|
|
|
|
|
|
|
const char *firstLine = munit_parameters_get(params, "L1" ); |
|
|
|
|
requestTestFirstLine *line = requestLine1Examples; |
|
|
|
|
|
|
|
|
|
while ( line->fullLine != NULL && strcmp( line->fullLine, firstLine ) != 0 ) |
|
|
|
|
line++; |
|
|
|
|
|
|
|
|
|
requestTestFirstLine *line = getLineObj(params); |
|
|
|
|
if ( line->fullLine == NULL ) return MUNIT_ERROR; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
req = newRequest(); |
|
|
|
|
requestFirstLine( req, line->fullLine ); |
|
|
|
|
munit_assert_not_null( req->queryString ); |
|
|
|
|