Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
9c485347
Commit
9c485347
authored
Jan 22, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added stub for test_mg_upload()
parent
81e21a3a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
unit_test.c
test/unit_test.c
+16
-10
No files found.
test/unit_test.c
View file @
9c485347
...
@@ -175,12 +175,19 @@ static void *event_handler(enum mg_event event, struct mg_connection *conn) {
...
@@ -175,12 +175,19 @@ static void *event_handler(enum mg_event event, struct mg_connection *conn) {
return
NULL
;
return
NULL
;
}
}
static
void
test_mg_fetch
(
void
)
{
static
const
char
*
OPTIONS
[]
=
{
static
const
char
*
options
[]
=
{
"document_root"
,
"."
,
"document_root"
,
"."
,
"listening_ports"
,
LISTENING_ADDR
,
"listening_ports"
,
LISTENING_ADDR
,
NULL
,
NULL
,
};
};
static
void
test_mg_upload
(
void
)
{
struct
mg_context
*
ctx
;
ASSERT
((
ctx
=
mg_start
(
event_handler
,
NULL
,
OPTIONS
))
!=
NULL
);
mg_stop
(
ctx
);
}
static
void
test_mg_fetch
(
void
)
{
char
buf
[
2000
],
buf2
[
2000
];
char
buf
[
2000
],
buf2
[
2000
];
int
n
,
length
;
int
n
,
length
;
struct
mg_context
*
ctx
;
struct
mg_context
*
ctx
;
...
@@ -189,7 +196,7 @@ static void test_mg_fetch(void) {
...
@@ -189,7 +196,7 @@ static void test_mg_fetch(void) {
struct
file
file
;
struct
file
file
;
FILE
*
fp
;
FILE
*
fp
;
ASSERT
((
ctx
=
mg_start
(
event_handler
,
NULL
,
options
))
!=
NULL
);
ASSERT
((
ctx
=
mg_start
(
event_handler
,
NULL
,
OPTIONS
))
!=
NULL
);
// Failed fetch, pass invalid URL
// Failed fetch, pass invalid URL
ASSERT
(
mg_fetch
(
ctx
,
"localhost"
,
tmp_file
,
buf
,
sizeof
(
buf
),
&
ri
)
==
NULL
);
ASSERT
(
mg_fetch
(
ctx
,
"localhost"
,
tmp_file
,
buf
,
sizeof
(
buf
),
&
ri
)
==
NULL
);
...
@@ -369,10 +376,9 @@ static void *user_data_tester(enum mg_event event, struct mg_connection *conn) {
...
@@ -369,10 +376,9 @@ static void *user_data_tester(enum mg_event event, struct mg_connection *conn) {
}
}
static
void
test_user_data
(
void
)
{
static
void
test_user_data
(
void
)
{
static
const
char
*
options
[]
=
{
"listening_ports"
,
LISTENING_ADDR
,
NULL
};
struct
mg_context
*
ctx
;
struct
mg_context
*
ctx
;
ASSERT
((
ctx
=
mg_start
(
user_data_tester
,
(
void
*
)
123
,
options
))
!=
NULL
);
ASSERT
((
ctx
=
mg_start
(
user_data_tester
,
(
void
*
)
123
,
OPTIONS
))
!=
NULL
);
ASSERT
(
ctx
->
user_data
==
(
void
*
)
123
);
ASSERT
(
ctx
->
user_data
==
(
void
*
)
123
);
call_user
(
fc
(
ctx
),
MG_NEW_REQUEST
);
call_user
(
fc
(
ctx
),
MG_NEW_REQUEST
);
mg_stop
(
ctx
);
mg_stop
(
ctx
);
...
@@ -380,8 +386,7 @@ static void test_user_data(void) {
...
@@ -380,8 +386,7 @@ static void test_user_data(void) {
static
void
test_mg_stat
(
void
)
{
static
void
test_mg_stat
(
void
)
{
static
struct
mg_context
ctx
;
static
struct
mg_context
ctx
;
struct
file
file
;
struct
file
file
=
STRUCT_FILE_INITIALIZER
;
memset
(
&
file
,
'A'
,
sizeof
(
file
));
ASSERT
(
!
mg_stat
(
fc
(
&
ctx
),
" does not exist "
,
&
file
));
ASSERT
(
!
mg_stat
(
fc
(
&
ctx
),
" does not exist "
,
&
file
));
}
}
...
@@ -415,6 +420,7 @@ int __cdecl main(void) {
...
@@ -415,6 +420,7 @@ int __cdecl main(void) {
test_next_option
();
test_next_option
();
test_user_data
();
test_user_data
();
test_mg_stat
();
test_mg_stat
();
test_mg_upload
();
#ifdef USE_LUA
#ifdef USE_LUA
test_lua
();
test_lua
();
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment