2023-06-05 01:16:05 +02:00
|
|
|
/* SPDX-License-Identifier: MPL-2.0 */
|
2015-08-11 21:37:50 +02:00
|
|
|
|
|
|
|
#include "testutil.hpp"
|
2019-03-22 11:48:49 +01:00
|
|
|
#include "testutil_unity.hpp"
|
2015-08-11 21:37:50 +02:00
|
|
|
|
2019-03-23 13:04:57 +01:00
|
|
|
#include <string.h>
|
2019-03-22 11:48:49 +01:00
|
|
|
|
2019-03-24 17:51:28 +01:00
|
|
|
SETUP_TEARDOWN_TESTCONTEXT
|
2019-03-22 11:48:49 +01:00
|
|
|
|
|
|
|
void test_getsockopt_memset ()
|
2015-08-11 21:37:50 +02:00
|
|
|
{
|
|
|
|
int64_t more;
|
|
|
|
size_t more_size = sizeof (more);
|
|
|
|
|
2019-03-22 11:48:49 +01:00
|
|
|
void *sb = test_context_socket (ZMQ_PUB);
|
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "inproc://a"));
|
2015-08-11 21:37:50 +02:00
|
|
|
|
2019-03-22 11:48:49 +01:00
|
|
|
void *sc = test_context_socket (ZMQ_SUB);
|
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, "inproc://a"));
|
2015-08-11 21:37:50 +02:00
|
|
|
|
|
|
|
memset (&more, 0xFF, sizeof (int64_t));
|
2019-03-22 11:48:49 +01:00
|
|
|
TEST_ASSERT_SUCCESS_ERRNO (
|
|
|
|
zmq_getsockopt (sc, ZMQ_RCVMORE, &more, &more_size));
|
|
|
|
TEST_ASSERT_EQUAL_INT (sizeof (int), more_size);
|
|
|
|
TEST_ASSERT_EQUAL_INT (0, more);
|
2015-08-11 21:37:50 +02:00
|
|
|
|
|
|
|
// Cleanup
|
2019-03-22 11:48:49 +01:00
|
|
|
test_context_socket_close (sc);
|
|
|
|
test_context_socket_close (sb);
|
|
|
|
}
|
2015-08-11 21:37:50 +02:00
|
|
|
|
2019-03-22 11:48:49 +01:00
|
|
|
int main (void)
|
|
|
|
{
|
|
|
|
setup_test_environment ();
|
2015-08-11 21:37:50 +02:00
|
|
|
|
2019-03-22 11:48:49 +01:00
|
|
|
UNITY_BEGIN ();
|
|
|
|
RUN_TEST (test_getsockopt_memset);
|
|
|
|
return UNITY_END ();
|
2015-08-11 21:37:50 +02:00
|
|
|
}
|