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
74078029
Commit
74078029
authored
Mar 22, 2019
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: tests without test framework
Solution: migrate to Unity
parent
e17232f7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
42 deletions
+52
-42
Makefile.am
Makefile.am
+4
-2
test_pair_vmci.cpp
tests/test_pair_vmci.cpp
+24
-20
test_reqrep_vmci.cpp
tests/test_reqrep_vmci.cpp
+24
-20
No files found.
Makefile.am
View file @
74078029
...
...
@@ -941,12 +941,14 @@ if HAVE_VMCI
test_apps
+=
test_pair_vmci test_reqrep_vmci
test_pair_vmci_SOURCES
=
tests/test_pair_vmci.cpp
test_pair_vmci_LDADD
=
src/libzmq.la
test_pair_vmci_LDADD
=
src/libzmq.la
${
UNITY_LIBS
}
test_pair_vmci_CPPFLAGS
=
${
UNITY_CPPFLAGS
}
test_pair_vmci_LDFLAGS
=
@LIBZMQ_VMCI_LDFLAGS@
test_pair_vmci_CXXFLAGS
=
@LIBZMQ_VMCI_CXXFLAGS@
test_reqrep_vmci_SOURCES
=
tests/test_reqrep_vmci.cpp
test_reqrep_vmci_LDADD
=
src/libzmq.la
test_reqrep_vmci_LDADD
=
src/libzmq.la
${
UNITY_LIBS
}
test_reqrep_vmci_CPPFLAGS
=
${
UNITY_CPPFLAGS
}
test_reqrep_vmci_LDFLAGS
=
@LIBZMQ_VMCI_LDFLAGS@
test_reqrep_vmci_CXXFLAGS
=
@LIBZMQ_VMCI_CXXFLAGS@
...
...
tests/test_pair_vmci.cpp
View file @
74078029
...
...
@@ -32,37 +32,41 @@
#include <vmci_sockets.h>
#include "testutil.hpp"
#include "testutil_unity.hpp"
int
main
(
void
)
void
setUp
(
)
{
setup_test_environment
();
void
*
ctx
=
zmq_ctx_new
();
assert
(
ctx
);
setup_test_context
();
}
void
tearDown
()
{
teardown_test_context
();
}
void
test_pair_vmci
()
{
std
::
stringstream
s
;
s
<<
"vmci://"
<<
VMCISock_GetLocalCID
()
<<
":"
<<
5560
;
std
::
string
endpoint
=
s
.
str
();
void
*
sb
=
zmq_socket
(
ctx
,
ZMQ_PAIR
);
assert
(
sb
);
int
rc
=
zmq_bind
(
sb
,
endpoint
.
c_str
());
assert
(
rc
==
0
);
void
*
sb
=
test_context_socket
(
ZMQ_PAIR
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
sb
,
endpoint
.
c_str
()));
void
*
sc
=
zmq_socket
(
ctx
,
ZMQ_PAIR
);
assert
(
sc
);
rc
=
zmq_connect
(
sc
,
endpoint
.
c_str
());
assert
(
rc
==
0
);
void
*
sc
=
test_context_socket
(
ZMQ_PAIR
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_connect
(
sc
,
endpoint
.
c_str
()));
bounce
(
sb
,
sc
);
rc
=
zmq_close
(
sc
);
assert
(
rc
==
0
);
rc
=
zmq_close
(
sb
);
assert
(
rc
==
0
);
test_context_socket_close
(
sc
);
test_context_socket_close
(
sb
);
}
rc
=
zmq_ctx_term
(
ctx
);
assert
(
rc
==
0
);
int
main
(
void
)
{
setup_test_environment
();
return
0
;
UNITY_BEGIN
();
RUN_TEST
(
test_pair_vmci
);
return
UNITY_END
();
}
tests/test_reqrep_vmci.cpp
View file @
74078029
...
...
@@ -32,37 +32,41 @@
#include <vmci_sockets.h>
#include "testutil.hpp"
#include "testutil_unity.hpp"
int
main
(
void
)
void
setUp
(
)
{
setup_test_environment
();
void
*
ctx
=
zmq_ctx_new
();
assert
(
ctx
);
setup_test_context
();
}
void
tearDown
()
{
teardown_test_context
();
}
void
test_reqrep_vmci
()
{
std
::
stringstream
s
;
s
<<
"vmci://"
<<
VMCISock_GetLocalCID
()
<<
":"
<<
5560
;
std
::
string
endpoint
=
s
.
str
();
void
*
sb
=
zmq_socket
(
ctx
,
ZMQ_REP
);
assert
(
sb
);
int
rc
=
zmq_bind
(
sb
,
endpoint
.
c_str
());
assert
(
rc
==
0
);
void
*
sb
=
test_context_socket
(
ZMQ_REP
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
sb
,
endpoint
.
c_str
()));
void
*
sc
=
zmq_socket
(
ctx
,
ZMQ_REQ
);
assert
(
sc
);
rc
=
zmq_connect
(
sc
,
endpoint
.
c_str
());
assert
(
rc
==
0
);
void
*
sc
=
test_context_socket
(
ZMQ_REQ
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_connect
(
sc
,
endpoint
.
c_str
()));
bounce
(
sb
,
sc
);
rc
=
zmq_close
(
sc
);
assert
(
rc
==
0
);
rc
=
zmq_close
(
sb
);
assert
(
rc
==
0
);
test_context_socket_close
(
sc
);
test_context_socket_close
(
sb
);
}
rc
=
zmq_ctx_term
(
ctx
);
assert
(
rc
==
0
);
int
main
(
void
)
{
setup_test_environment
();
return
0
;
UNITY_BEGIN
();
RUN_TEST
(
test_reqrep_vmci
);
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