Commit dc2764f5 authored by Simon Giesecke's avatar Simon Giesecke

Problem: test_last_endpoint not using unity

Solution: migrate to unity
parent 1747cbdc
...@@ -493,7 +493,8 @@ tests_test_immediate_LDADD = src/libzmq.la ${UNITY_LIBS} ...@@ -493,7 +493,8 @@ tests_test_immediate_LDADD = src/libzmq.la ${UNITY_LIBS}
tests_test_immediate_CPPFLAGS = ${UNITY_CPPFLAGS} tests_test_immediate_CPPFLAGS = ${UNITY_CPPFLAGS}
tests_test_last_endpoint_SOURCES = tests/test_last_endpoint.cpp 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_SOURCES = tests/test_term_endpoint.cpp
tests_test_term_endpoint_LDADD = src/libzmq.la tests_test_term_endpoint_LDADD = src/libzmq.la
......
...@@ -28,6 +28,19 @@ ...@@ -28,6 +28,19 @@
*/ */
#include "testutil.hpp" #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) 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) ...@@ -39,27 +52,24 @@ static void do_bind_and_verify (void *s, const char *endpoint)
assert (rc == 0 && strcmp (reported, endpoint) == 0); assert (rc == 0 && strcmp (reported, endpoint) == 0);
} }
int main (void) void test_last_endpoint ()
{ {
setup_test_environment (); void *sb = test_context_socket (ZMQ_ROUTER);
// Create the infrastructure
void *ctx = zmq_ctx_new ();
assert (ctx);
void *sb = zmq_socket (ctx, ZMQ_ROUTER);
assert (sb);
int val = 0; int val = 0;
int rc = zmq_setsockopt (sb, ZMQ_LINGER, &val, sizeof (val)); TEST_ASSERT_SUCCESS_ERRNO (
assert (rc == 0); zmq_setsockopt (sb, ZMQ_LINGER, &val, sizeof (val)));
do_bind_and_verify (sb, ENDPOINT_1); do_bind_and_verify (sb, ENDPOINT_1);
do_bind_and_verify (sb, ENDPOINT_2); do_bind_and_verify (sb, ENDPOINT_2);
rc = zmq_close (sb); test_context_socket_close (sb);
assert (rc == 0); }
rc = zmq_ctx_term (ctx); int main (void)
assert (rc == 0); {
setup_test_environment ();
return 0; UNITY_BEGIN ();
RUN_TEST (test_last_endpoint);
return UNITY_END ();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment