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
d072d57e
Commit
d072d57e
authored
Aug 23, 2017
by
sigiesec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: no tests for zmq_timer_* with NULL timers argument
Solution: added tests
parent
8b263d58
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
test_timers.cpp
tests/test_timers.cpp
+55
-0
No files found.
tests/test_timers.cpp
View file @
d072d57e
...
...
@@ -48,6 +48,59 @@ int sleep_and_execute(void *timers_)
return
zmq_timers_execute
(
timers_
);
}
void
test_null_timer_pointers
()
{
void
*
timers
=
NULL
;
int
rc
=
zmq_timers_destroy
(
&
timers
);
assert
(
rc
==
-
1
&&
errno
==
EFAULT
);
// TODO this currently triggers an access violation
#if 0
rc = zmq_timers_destroy (NULL);
assert (rc == -1 && errno == EFAULT);
#endif
const
size_t
dummy_interval
=
100
;
const
int
dummy_timer_id
=
1
;
rc
=
zmq_timers_add
(
timers
,
dummy_interval
,
&
handler
,
NULL
);
assert
(
rc
==
-
1
&&
errno
==
EFAULT
);
rc
=
zmq_timers_add
(
&
timers
,
dummy_interval
,
&
handler
,
NULL
);
assert
(
rc
==
-
1
&&
errno
==
EFAULT
);
rc
=
zmq_timers_cancel
(
timers
,
dummy_timer_id
);
assert
(
rc
==
-
1
&&
errno
==
EFAULT
);
rc
=
zmq_timers_cancel
(
&
timers
,
dummy_timer_id
);
assert
(
rc
==
-
1
&&
errno
==
EFAULT
);
rc
=
zmq_timers_set_interval
(
timers
,
dummy_timer_id
,
dummy_interval
);
assert
(
rc
==
-
1
&&
errno
==
EFAULT
);
rc
=
zmq_timers_set_interval
(
&
timers
,
dummy_timer_id
,
dummy_interval
);
assert
(
rc
==
-
1
&&
errno
==
EFAULT
);
rc
=
zmq_timers_reset
(
timers
,
dummy_timer_id
);
assert
(
rc
==
-
1
&&
errno
==
EFAULT
);
rc
=
zmq_timers_reset
(
&
timers
,
dummy_timer_id
);
assert
(
rc
==
-
1
&&
errno
==
EFAULT
);
rc
=
zmq_timers_timeout
(
timers
);
assert
(
rc
==
-
1
&&
errno
==
EFAULT
);
rc
=
zmq_timers_timeout
(
&
timers
);
assert
(
rc
==
-
1
&&
errno
==
EFAULT
);
rc
=
zmq_timers_execute
(
timers
);
assert
(
rc
==
-
1
&&
errno
==
EFAULT
);
rc
=
zmq_timers_execute
(
&
timers
);
assert
(
rc
==
-
1
&&
errno
==
EFAULT
);
}
int
main
(
void
)
{
setup_test_environment
();
...
...
@@ -115,5 +168,7 @@ int main (void)
rc
=
zmq_timers_destroy
(
&
timers
);
assert
(
rc
==
0
);
test_null_timer_pointers
();
return
0
;
}
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