Problem: test_last_endpoint not using unity

Solution: migrate to unity
This commit is contained in:
Simon Giesecke 2018-03-16 16:35:31 +01:00
parent 1747cbdcac
commit dc2764f58c
2 changed files with 29 additions and 18 deletions

View File

@ -493,7 +493,8 @@ tests_test_immediate_LDADD = src/libzmq.la ${UNITY_LIBS}
tests_test_immediate_CPPFLAGS = ${UNITY_CPPFLAGS}
tests_test_last_endpoint_SOURCES = tests/test_last_endpoint.cpp
tests_test_last_endpoint_LDADD = src/libzmq.la
tests_test_last_endpoint_LDADD = src/libzmq.la ${UNITY_LIBS}
tests_test_last_endpoint_CPPFLAGS = ${UNITY_CPPFLAGS}
tests_test_term_endpoint_SOURCES = tests/test_term_endpoint.cpp
tests_test_term_endpoint_LDADD = src/libzmq.la

View File

@ -28,6 +28,19 @@
*/
#include "testutil.hpp"
#include "testutil_unity.hpp"
#include <unity.h>
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
static void do_bind_and_verify (void *s, const char *endpoint)
{
@ -39,27 +52,24 @@ static void do_bind_and_verify (void *s, const char *endpoint)
assert (rc == 0 && strcmp (reported, endpoint) == 0);
}
int main (void)
void test_last_endpoint ()
{
setup_test_environment ();
// Create the infrastructure
void *ctx = zmq_ctx_new ();
assert (ctx);
void *sb = zmq_socket (ctx, ZMQ_ROUTER);
assert (sb);
void *sb = test_context_socket (ZMQ_ROUTER);
int val = 0;
int rc = zmq_setsockopt (sb, ZMQ_LINGER, &val, sizeof (val));
assert (rc == 0);
TEST_ASSERT_SUCCESS_ERRNO (
zmq_setsockopt (sb, ZMQ_LINGER, &val, sizeof (val)));
do_bind_and_verify (sb, ENDPOINT_1);
do_bind_and_verify (sb, ENDPOINT_2);
rc = zmq_close (sb);
assert (rc == 0);
rc = zmq_ctx_term (ctx);
assert (rc == 0);
return 0;
test_context_socket_close (sb);
}
int main (void)
{
setup_test_environment ();
UNITY_BEGIN ();
RUN_TEST (test_last_endpoint);
return UNITY_END ();
}