Macros | Functions | Variables
unit_test.c File Reference
#include "../mongoose.c"
Include dependency graph for unit_test.c:

Go to the source code of this file.

Macros

#define ASSERT(expr)
 
#define BOUNDARY   "--xyz"
 
#define CRLF   "\r\n"
 
#define DISP   "Content-Disposition: form/data; "
 
#define FAIL(str, line)
 
#define HTTP_PORT   "45772"
 
#define LISTENING_ADDR   "127.0.0.1:" HTTP_PORT
 
#define MONGOOSE_POST_SIZE_LIMIT   999
 
#define NS_ENABLE_IPV6
 
#define NS_ENABLE_SSL
 
#define RUN_TEST(test)
 

Functions

static int evh1 (struct mg_connection *conn, enum mg_event ev)
 
static int evh2 (struct mg_connection *conn, enum mg_event ev)
 
int __cdecl main (void)
 
static char * read_file (const char *path, int *size)
 
static const char * run_all_tests (void)
 
static const char * test_base64_encode (void)
 
static const char * test_get_var (void)
 
static const char * test_match_prefix (void)
 
static const char * test_mg_parse_header (void)
 
static const char * test_mg_set_option (void)
 
static const char * test_next_option (void)
 
static const char * test_parse_http_message ()
 
static const char * test_parse_multipart (void)
 
static const char * test_remove_double_dots ()
 
static const char * test_rewrites (void)
 
static const char * test_server (void)
 
static const char * test_should_keep_alive (void)
 
static const char * test_to64 (void)
 
static const char * test_url_decode (void)
 
static const char * test_url_encode (void)
 

Variables

static int static_num_tests = 0
 

Macro Definition Documentation

◆ ASSERT

#define ASSERT (   expr)
Value:
do { \
static_num_tests++; \
if (!(expr)) FAIL(#expr, __LINE__); \
} while (0)

Definition at line 19 of file unit_test.c.

◆ BOUNDARY

#define BOUNDARY   "--xyz"

Definition at line 420 of file unit_test.c.

◆ CRLF

#define CRLF   "\r\n"

Definition at line 419 of file unit_test.c.

◆ DISP

#define DISP   "Content-Disposition: form/data; "

Definition at line 418 of file unit_test.c.

◆ FAIL

#define FAIL (   str,
  line 
)
Value:
do { \
printf("Fail on line %d: [%s]\n", line, str); \
return str; \
} while (0)

Definition at line 14 of file unit_test.c.

◆ HTTP_PORT

#define HTTP_PORT   "45772"

Definition at line 27 of file unit_test.c.

◆ LISTENING_ADDR

#define LISTENING_ADDR   "127.0.0.1:" HTTP_PORT

Definition at line 28 of file unit_test.c.

◆ MONGOOSE_POST_SIZE_LIMIT

#define MONGOOSE_POST_SIZE_LIMIT   999

Definition at line 9 of file unit_test.c.

◆ NS_ENABLE_IPV6

#define NS_ENABLE_IPV6

Definition at line 6 of file unit_test.c.

◆ NS_ENABLE_SSL

#define NS_ENABLE_SSL

Definition at line 7 of file unit_test.c.

◆ RUN_TEST

#define RUN_TEST (   test)
Value:
do { const char *msg = test(); \
if (msg) return msg; } while (0)

Definition at line 24 of file unit_test.c.

Function Documentation

◆ evh1()

static int evh1 ( struct mg_connection conn,
enum mg_event  ev 
)
static

Definition at line 357 of file unit_test.c.

◆ evh2()

static int evh2 ( struct mg_connection conn,
enum mg_event  ev 
)
static

Definition at line 453 of file unit_test.c.

◆ main()

int __cdecl main ( void  )

Definition at line 529 of file unit_test.c.

◆ read_file()

static char* read_file ( const char *  path,
int *  size 
)
static

Definition at line 80 of file unit_test.c.

◆ run_all_tests()

static const char* run_all_tests ( void  )
static

Definition at line 510 of file unit_test.c.

◆ test_base64_encode()

static const char* test_base64_encode ( void  )
static

Definition at line 297 of file unit_test.c.

◆ test_get_var()

static const char* test_get_var ( void  )
static

Definition at line 225 of file unit_test.c.

◆ test_match_prefix()

static const char* test_match_prefix ( void  )
static

Definition at line 168 of file unit_test.c.

◆ test_mg_parse_header()

static const char* test_mg_parse_header ( void  )
static

Definition at line 311 of file unit_test.c.

◆ test_mg_set_option()

static const char* test_mg_set_option ( void  )
static

Definition at line 481 of file unit_test.c.

◆ test_next_option()

static const char* test_next_option ( void  )
static

Definition at line 341 of file unit_test.c.

◆ test_parse_http_message()

static const char* test_parse_http_message ( )
static

Definition at line 93 of file unit_test.c.

◆ test_parse_multipart()

static const char* test_parse_multipart ( void  )
static

Definition at line 421 of file unit_test.c.

◆ test_remove_double_dots()

static const char* test_remove_double_dots ( )
static

Definition at line 200 of file unit_test.c.

◆ test_rewrites()

static const char* test_rewrites ( void  )
static

Definition at line 489 of file unit_test.c.

◆ test_server()

static const char* test_server ( void  )
static

Definition at line 394 of file unit_test.c.

◆ test_should_keep_alive()

static const char* test_should_keep_alive ( void  )
static

Definition at line 145 of file unit_test.c.

◆ test_to64()

static const char* test_to64 ( void  )
static

Definition at line 288 of file unit_test.c.

◆ test_url_decode()

static const char* test_url_decode ( void  )
static

Definition at line 252 of file unit_test.c.

◆ test_url_encode()

static const char* test_url_encode ( void  )
static

Definition at line 277 of file unit_test.c.

Variable Documentation

◆ static_num_tests

int static_num_tests = 0
static

Definition at line 30 of file unit_test.c.

FAIL
#define FAIL(str, line)
Definition: unit_test.c:14
str
const char * str
Definition: unit1398.c:33
test
int test(char *URL)
Definition: lib1500.c:30


rc_tagdetect_client
Author(s): Monika Florek-Jasinska , Raphael Schaller
autogenerated on Sun May 15 2022 02:25:02