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
f2184782
Commit
f2184782
authored
May 13, 2018
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: test_heartbeats use no test framework
Solution: migrate to unity
parent
df2fe88b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
21 deletions
+68
-21
Makefile.am
Makefile.am
+2
-1
test_heartbeats.cpp
tests/test_heartbeats.cpp
+66
-20
No files found.
Makefile.am
View file @
f2184782
...
...
@@ -651,7 +651,8 @@ tests_test_setsockopt_SOURCES = tests/test_setsockopt.cpp
tests_test_setsockopt_LDADD
=
src/libzmq.la
tests_test_heartbeats_SOURCES
=
tests/test_heartbeats.cpp
tests_test_heartbeats_LDADD
=
src/libzmq.la
tests_test_heartbeats_LDADD
=
src/libzmq.la
${
UNITY_LIBS
}
tests_test_heartbeats_CPPFLAGS
=
${
UNITY_CPPFLAGS
}
tests_test_stream_exceeds_buffer_SOURCES
=
tests/test_stream_exceeds_buffer.cpp
tests_test_stream_exceeds_buffer_LDADD
=
src/libzmq.la
...
...
tests/test_heartbeats.cpp
View file @
f2184782
...
...
@@ -29,6 +29,19 @@ typedef SOCKET raw_socket;
typedef
int
raw_socket
;
#endif
#include <unity.h>
void
setUp
()
{
// setup_test_context ();
}
void
tearDown
()
{
// teardown_test_context ();
}
// Read one event off the monitor socket; return value and address
// by reference, if not null, and event number by value. Returns -1
// in case of error.
...
...
@@ -340,29 +353,62 @@ test_heartbeat_notimeout (int is_curve, int client_type, int server_type)
assert
(
rc
==
0
);
}
void
test_heartbeat_timeout_router
()
{
test_heartbeat_timeout
(
ZMQ_ROUTER
);
}
void
test_heartbeat_timeout_rep
()
{
test_heartbeat_timeout
(
ZMQ_REP
);
}
#define DEFINE_TESTS(first, second, first_define, second_define) \
void test_heartbeat_ttl_##first##_##second () \
{ \
test_heartbeat_ttl (first_define, second_define); \
} \
void test_heartbeat_notimeout_##first##_##second () \
{ \
test_heartbeat_notimeout (0, first_define, second_define); \
} \
void test_heartbeat_notimeout_##first##_##second##_with_curve () \
{ \
test_heartbeat_notimeout (1, first_define, second_define); \
}
DEFINE_TESTS
(
dealer
,
router
,
ZMQ_DEALER
,
ZMQ_ROUTER
)
DEFINE_TESTS
(
req
,
rep
,
ZMQ_REQ
,
ZMQ_REP
)
DEFINE_TESTS
(
pull
,
push
,
ZMQ_PULL
,
ZMQ_PUSH
)
DEFINE_TESTS
(
sub
,
pub
,
ZMQ_SUB
,
ZMQ_PUB
)
DEFINE_TESTS
(
pair
,
pair
,
ZMQ_PAIR
,
ZMQ_PAIR
)
int
main
(
void
)
{
setup_test_environment
();
test_heartbeat_timeout
(
ZMQ_ROUTER
);
test_heartbeat_timeout
(
ZMQ_REP
);
UNITY_BEGIN
();
RUN_TEST
(
test_heartbeat_timeout_router
);
RUN_TEST
(
test_heartbeat_timeout_rep
);
RUN_TEST
(
test_heartbeat_ttl_dealer_router
);
RUN_TEST
(
test_heartbeat_ttl_req_rep
);
RUN_TEST
(
test_heartbeat_ttl_pull_push
);
RUN_TEST
(
test_heartbeat_ttl_sub_pub
);
RUN_TEST
(
test_heartbeat_ttl_pair_pair
);
RUN_TEST
(
test_heartbeat_notimeout_dealer_router
);
RUN_TEST
(
test_heartbeat_notimeout_req_rep
);
RUN_TEST
(
test_heartbeat_notimeout_pull_push
);
RUN_TEST
(
test_heartbeat_notimeout_sub_pub
);
RUN_TEST
(
test_heartbeat_notimeout_pair_pair
);
RUN_TEST
(
test_heartbeat_notimeout_dealer_router_with_curve
);
RUN_TEST
(
test_heartbeat_notimeout_req_rep_with_curve
);
RUN_TEST
(
test_heartbeat_notimeout_pull_push_with_curve
);
RUN_TEST
(
test_heartbeat_notimeout_sub_pub_with_curve
);
RUN_TEST
(
test_heartbeat_notimeout_pair_pair_with_curve
);
test_heartbeat_ttl
(
ZMQ_DEALER
,
ZMQ_ROUTER
);
test_heartbeat_ttl
(
ZMQ_REQ
,
ZMQ_REP
);
test_heartbeat_ttl
(
ZMQ_PULL
,
ZMQ_PUSH
);
test_heartbeat_ttl
(
ZMQ_SUB
,
ZMQ_PUB
);
test_heartbeat_ttl
(
ZMQ_PAIR
,
ZMQ_PAIR
);
// Run this test without curve
test_heartbeat_notimeout
(
0
,
ZMQ_DEALER
,
ZMQ_ROUTER
);
test_heartbeat_notimeout
(
0
,
ZMQ_REQ
,
ZMQ_REP
);
test_heartbeat_notimeout
(
0
,
ZMQ_PULL
,
ZMQ_PUSH
);
test_heartbeat_notimeout
(
0
,
ZMQ_SUB
,
ZMQ_PUB
);
test_heartbeat_notimeout
(
0
,
ZMQ_PAIR
,
ZMQ_PAIR
);
// Then rerun it with curve
test_heartbeat_notimeout
(
1
,
ZMQ_DEALER
,
ZMQ_ROUTER
);
test_heartbeat_notimeout
(
1
,
ZMQ_REQ
,
ZMQ_REP
);
test_heartbeat_notimeout
(
1
,
ZMQ_PULL
,
ZMQ_PUSH
);
test_heartbeat_notimeout
(
1
,
ZMQ_SUB
,
ZMQ_PUB
);
test_heartbeat_notimeout
(
1
,
ZMQ_PAIR
,
ZMQ_PAIR
);
return
UNITY_END
();
}
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