Commit 23b3403f authored by Bitiquinho's avatar Bitiquinho

Remove printf and add asserts on test

parent 977e7008
...@@ -89,8 +89,6 @@ int str_recv_from (void *s_, char **ptr_content_, void **ptr_address_, size_t *p ...@@ -89,8 +89,6 @@ int str_recv_from (void *s_, char **ptr_content_, void **ptr_address_, size_t *p
memcpy (*ptr_content_, zmq_msg_data (&msg), zmq_msg_size (&msg)); memcpy (*ptr_content_, zmq_msg_data (&msg), zmq_msg_size (&msg));
*ptr_content_ [zmq_msg_size (&msg)] = '\0'; *ptr_content_ [zmq_msg_size (&msg)] = '\0';
printf( "received string: %s", *ptr_content_ );
zmq_msg_close (&msg); zmq_msg_close (&msg);
return rc; return rc;
...@@ -123,6 +121,7 @@ int main (void) ...@@ -123,6 +121,7 @@ int main (void)
rc = str_recv_from (listener, &message_string, &address, &address_length); rc = str_recv_from (listener, &message_string, &address, &address_length);
assert (rc == 0); assert (rc == 0);
assert (address_length == sizeof(sockaddr_in)); assert (address_length == sizeof(sockaddr_in));
assert (strcmp(message_string, "Is someone there ?") == 0);
rc = str_send_to (sender, "Yes, there is !", address, address_length); rc = str_send_to (sender, "Yes, there is !", address, address_length);
assert (rc == 0); assert (rc == 0);
...@@ -148,6 +147,7 @@ int main (void) ...@@ -148,6 +147,7 @@ int main (void)
rc = str_recv_from (listener, &message_string, &address, &address_length); rc = str_recv_from (listener, &message_string, &address, &address_length);
assert (rc == 0); assert (rc == 0);
assert (address_length == sizeof(sockaddr_in)); assert (address_length == sizeof(sockaddr_in));
assert (strcmp(message_string, "Is someone there ?") == 0);
rc = str_send_to (sender, "Yes, there is [MULTICAST]!", address, address_length); rc = str_send_to (sender, "Yes, there is [MULTICAST]!", address, address_length);
assert (rc == 0); assert (rc == 0);
......
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