Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
7bd57ba8
Commit
7bd57ba8
authored
Mar 15, 2018
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: test case tests multiple aspects
Solution: split test case
parent
3e374d98
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
7 deletions
+37
-7
test_poller.cpp
tests/test_poller.cpp
+37
-7
No files found.
tests/test_poller.cpp
View file @
7bd57ba8
...
@@ -395,31 +395,57 @@ TEST_CASE_FUNC_PARAM (call_poller_remove_fd_unregistered_fails,
...
@@ -395,31 +395,57 @@ TEST_CASE_FUNC_PARAM (call_poller_remove_fd_unregistered_fails,
TEST_CASE_FUNC_PARAM
(
call_poller_modify_fd_unregistered_fails
,
TEST_CASE_FUNC_PARAM
(
call_poller_modify_fd_unregistered_fails
,
test_with_empty_poller
)
test_with_empty_poller
)
void
test_wait_corner_cases
(
void
)
void
call_poller_wait_empty_with_timeout_fails
(
void
*
poller
,
void
*
/*socket*/
)
{
{
void
*
poller
=
zmq_poller_new
();
TEST_ASSERT_NOT_NULL
(
poller
);
zmq_poller_event_t
event
;
zmq_poller_event_t
event
;
// waiting on poller with no registered sockets should report error
// waiting on poller with no registered sockets should report error
TEST_ASSERT_FAILURE_ERRNO
(
EAGAIN
,
zmq_poller_wait
(
poller
,
&
event
,
0
));
TEST_ASSERT_FAILURE_ERRNO
(
EAGAIN
,
zmq_poller_wait
(
poller
,
&
event
,
0
));
}
void
call_poller_wait_empty_without_timeout_fails
(
void
*
poller
,
void
*
/*socket*/
)
{
zmq_poller_event_t
event
;
// this would never be able to return since no socket was registered, and should yield an error
// this would never be able to return since no socket was registered, and should yield an error
TEST_ASSERT_FAILURE_ERRNO
(
EFAULT
,
zmq_poller_wait
(
poller
,
&
event
,
-
1
));
TEST_ASSERT_FAILURE_ERRNO
(
EFAULT
,
zmq_poller_wait
(
poller
,
&
event
,
-
1
));
}
void
call_poller_wait_all_empty_negative_count_fails
(
void
*
poller
,
void
*
/*socket*/
)
{
zmq_poller_event_t
event
;
TEST_ASSERT_FAILURE_ERRNO
(
EINVAL
,
TEST_ASSERT_FAILURE_ERRNO
(
EINVAL
,
zmq_poller_wait_all
(
poller
,
&
event
,
-
1
,
0
));
zmq_poller_wait_all
(
poller
,
&
event
,
-
1
,
0
));
}
void
call_poller_wait_all_empty_without_timeout_fails
(
void
*
poller
,
void
*
/*socket*/
)
{
zmq_poller_event_t
event
;
TEST_ASSERT_FAILURE_ERRNO
(
EAGAIN
,
TEST_ASSERT_FAILURE_ERRNO
(
EAGAIN
,
zmq_poller_wait_all
(
poller
,
&
event
,
0
,
0
));
zmq_poller_wait_all
(
poller
,
&
event
,
0
,
0
));
}
void
call_poller_wait_all_empty_with_timeout_fails
(
void
*
poller
,
void
*
/*socket*/
)
{
zmq_poller_event_t
event
;
// this would never be able to return since no socket was registered, and should yield an error
// this would never be able to return since no socket was registered, and should yield an error
TEST_ASSERT_FAILURE_ERRNO
(
EFAULT
,
TEST_ASSERT_FAILURE_ERRNO
(
EFAULT
,
zmq_poller_wait_all
(
poller
,
&
event
,
0
,
-
1
));
zmq_poller_wait_all
(
poller
,
&
event
,
0
,
-
1
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_poller_destroy
(
&
poller
));
}
}
TEST_CASE_FUNC_PARAM
(
call_poller_wait_empty_with_timeout_fails
,
test_with_empty_poller
)
TEST_CASE_FUNC_PARAM
(
call_poller_wait_empty_without_timeout_fails
,
test_with_empty_poller
)
TEST_CASE_FUNC_PARAM
(
call_poller_wait_all_empty_negative_count_fails
,
test_with_empty_poller
)
TEST_CASE_FUNC_PARAM
(
call_poller_wait_all_empty_without_timeout_fails
,
test_with_empty_poller
)
TEST_CASE_FUNC_PARAM
(
call_poller_wait_all_empty_with_timeout_fails
,
test_with_empty_poller
)
void
bind_loopback_ipv4
(
void
*
socket
,
char
*
my_endpoint
,
size_t
len
)
void
bind_loopback_ipv4
(
void
*
socket
,
char
*
my_endpoint
,
size_t
len
)
{
{
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
socket
,
"tcp://127.0.0.1:*"
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
socket
,
"tcp://127.0.0.1:*"
));
...
@@ -588,7 +614,11 @@ int main (void)
...
@@ -588,7 +614,11 @@ int main (void)
RUN_TEST
(
test_call_poller_remove_fd_unregistered_fails
);
RUN_TEST
(
test_call_poller_remove_fd_unregistered_fails
);
RUN_TEST
(
test_call_poller_modify_fd_unregistered_fails
);
RUN_TEST
(
test_call_poller_modify_fd_unregistered_fails
);
RUN_TEST
(
test_wait_corner_cases
);
RUN_TEST
(
test_call_poller_wait_empty_with_timeout_fails
);
RUN_TEST
(
test_call_poller_wait_empty_without_timeout_fails
);
RUN_TEST
(
test_call_poller_wait_all_empty_negative_count_fails
);
RUN_TEST
(
test_call_poller_wait_all_empty_without_timeout_fails
);
RUN_TEST
(
test_call_poller_wait_all_empty_with_timeout_fails
);
RUN_TEST
(
test_poll_basic
);
RUN_TEST
(
test_poll_basic
);
RUN_TEST
(
test_poll_fd
);
RUN_TEST
(
test_poll_fd
);
...
...
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