Commit 8e257029 authored by Olivier Crête's avatar Olivier Crête

tests: Use g_assert_true() instead of g_assert() everywhere

parent 69c2015c
...@@ -65,13 +65,13 @@ main (void) ...@@ -65,13 +65,13 @@ main (void)
g_assert_cmpuint (nice_agent_add_stream (agent, 10), ==, 2); g_assert_cmpuint (nice_agent_add_stream (agent, 10), ==, 2);
g_assert_cmpuint (nice_agent_add_stream (agent, 2), ==, 3); g_assert_cmpuint (nice_agent_add_stream (agent, 2), ==, 3);
g_assert (NULL != agent->streams); g_assert_true (NULL != agent->streams);
nice_agent_remove_stream (agent, 1); nice_agent_remove_stream (agent, 1);
nice_agent_remove_stream (agent, 2); nice_agent_remove_stream (agent, 2);
nice_agent_remove_stream (agent, 3); nice_agent_remove_stream (agent, 3);
g_assert (NULL == agent->streams); g_assert_true (NULL == agent->streams);
g_object_unref (agent); g_object_unref (agent);
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
......
...@@ -61,7 +61,7 @@ test_ipv4 (void) ...@@ -61,7 +61,7 @@ test_ipv4 (void)
/* same address */ /* same address */
nice_address_set_ipv4 (&other, 0x01020304); nice_address_set_ipv4 (&other, 0x01020304);
g_assert (TRUE == nice_address_equal (&addr, &other)); g_assert_true (TRUE == nice_address_equal (&addr, &other));
/* from sockaddr_in */ /* from sockaddr_in */
nice_address_set_port (&other, 9876); /* in native byte order */ nice_address_set_port (&other, 9876); /* in native byte order */
...@@ -70,84 +70,84 @@ test_ipv4 (void) ...@@ -70,84 +70,84 @@ test_ipv4 (void)
nice_address_set_port (&addr, 9876); /* in native byte order */ nice_address_set_port (&addr, 9876); /* in native byte order */
nice_address_to_string (&addr, str); nice_address_to_string (&addr, str);
nice_address_to_string (&other, str); nice_address_to_string (&other, str);
g_assert (TRUE == nice_address_equal (&addr, &other)); g_assert_true (TRUE == nice_address_equal (&addr, &other));
/* different IP */ /* different IP */
nice_address_set_ipv4 (&other, 0x01020305); nice_address_set_ipv4 (&other, 0x01020305);
g_assert (FALSE == nice_address_equal (&addr, &other)); g_assert_true (FALSE == nice_address_equal (&addr, &other));
/* different port */ /* different port */
nice_address_set_ipv4 (&other, 0x01020304); nice_address_set_ipv4 (&other, 0x01020304);
nice_address_set_port (&addr, 1); nice_address_set_port (&addr, 1);
g_assert (FALSE == nice_address_equal (&addr, &other)); g_assert_true (FALSE == nice_address_equal (&addr, &other));
/* test private address check */ /* test private address check */
{ {
NiceAddress *heap_addr = nice_address_new (); NiceAddress *heap_addr = nice_address_new ();
g_assert (nice_address_set_from_string (heap_addr, "127.0.0.1.1") != TRUE); g_assert_true (nice_address_set_from_string (heap_addr, "127.0.0.1.1") != TRUE);
g_assert (nice_address_set_from_string (heap_addr, "127.0.0.1") == TRUE); g_assert_true (nice_address_set_from_string (heap_addr, "127.0.0.1") == TRUE);
g_assert (nice_address_is_private (heap_addr) == TRUE); g_assert_true (nice_address_is_private (heap_addr) == TRUE);
g_assert (nice_address_set_from_string (heap_addr, "127.1.1.1") == TRUE); g_assert_true (nice_address_set_from_string (heap_addr, "127.1.1.1") == TRUE);
g_assert (nice_address_is_private (heap_addr) == TRUE); g_assert_true (nice_address_is_private (heap_addr) == TRUE);
g_assert (nice_address_set_from_string(heap_addr, "192.168.2.0")); g_assert_true (nice_address_set_from_string(heap_addr, "192.168.2.0"));
g_assert (nice_address_is_private (heap_addr) == TRUE); g_assert_true (nice_address_is_private (heap_addr) == TRUE);
g_assert (nice_address_set_from_string(heap_addr, "192.168.15.69")); g_assert_true (nice_address_set_from_string(heap_addr, "192.168.15.69"));
g_assert (nice_address_is_private (heap_addr) == TRUE); g_assert_true (nice_address_is_private (heap_addr) == TRUE);
g_assert (nice_address_set_from_string(heap_addr, "192.169.0.0")); g_assert_true (nice_address_set_from_string(heap_addr, "192.169.0.0"));
g_assert (nice_address_is_private (heap_addr) == FALSE); g_assert_true (nice_address_is_private (heap_addr) == FALSE);
g_assert (nice_address_set_from_string(heap_addr, "192.167.0.0")); g_assert_true (nice_address_set_from_string(heap_addr, "192.167.0.0"));
g_assert (nice_address_is_private (heap_addr) == FALSE); g_assert_true (nice_address_is_private (heap_addr) == FALSE);
g_assert (nice_address_set_from_string(heap_addr, "10.2.1.2")); g_assert_true (nice_address_set_from_string(heap_addr, "10.2.1.2"));
g_assert (nice_address_is_private (heap_addr) == TRUE); g_assert_true (nice_address_is_private (heap_addr) == TRUE);
g_assert (nice_address_set_from_string(heap_addr, "11.0.0.0")); g_assert_true (nice_address_set_from_string(heap_addr, "11.0.0.0"));
g_assert (nice_address_is_private (heap_addr) == FALSE); g_assert_true (nice_address_is_private (heap_addr) == FALSE);
g_assert (nice_address_set_from_string(heap_addr, "9.255.255.255")); g_assert_true (nice_address_set_from_string(heap_addr, "9.255.255.255"));
g_assert (nice_address_is_private (heap_addr) == FALSE); g_assert_true (nice_address_is_private (heap_addr) == FALSE);
g_assert (nice_address_set_from_string(heap_addr, "172.15.255.255")); g_assert_true (nice_address_set_from_string(heap_addr, "172.15.255.255"));
g_assert (nice_address_is_private (heap_addr) == FALSE); g_assert_true (nice_address_is_private (heap_addr) == FALSE);
g_assert (nice_address_set_from_string(heap_addr, "172.16.0.0")); g_assert_true (nice_address_set_from_string(heap_addr, "172.16.0.0"));
g_assert (nice_address_is_private (heap_addr) == TRUE); g_assert_true (nice_address_is_private (heap_addr) == TRUE);
g_assert (nice_address_set_from_string(heap_addr, "172.31.255.255")); g_assert_true (nice_address_set_from_string(heap_addr, "172.31.255.255"));
g_assert (nice_address_is_private (heap_addr) == TRUE); g_assert_true (nice_address_is_private (heap_addr) == TRUE);
g_assert (nice_address_set_from_string(heap_addr, "172.32.0.0")); g_assert_true (nice_address_set_from_string(heap_addr, "172.32.0.0"));
g_assert (nice_address_is_private (heap_addr) == FALSE); g_assert_true (nice_address_is_private (heap_addr) == FALSE);
g_assert (nice_address_set_from_string(heap_addr, "172.63.0.0")); g_assert_true (nice_address_set_from_string(heap_addr, "172.63.0.0"));
g_assert (nice_address_is_private (heap_addr) == FALSE); g_assert_true (nice_address_is_private (heap_addr) == FALSE);
g_assert (nice_address_set_from_string(heap_addr, "169.253.255.255")); g_assert_true (nice_address_set_from_string(heap_addr, "169.253.255.255"));
g_assert (nice_address_is_private (heap_addr) == FALSE); g_assert_true (nice_address_is_private (heap_addr) == FALSE);
g_assert (nice_address_set_from_string(heap_addr, "169.254.0.0")); g_assert_true (nice_address_set_from_string(heap_addr, "169.254.0.0"));
g_assert (nice_address_is_private (heap_addr) == TRUE); g_assert_true (nice_address_is_private (heap_addr) == TRUE);
g_assert (nice_address_set_from_string(heap_addr, "169.254.255.255")); g_assert_true (nice_address_set_from_string(heap_addr, "169.254.255.255"));
g_assert (nice_address_is_private (heap_addr) == TRUE); g_assert_true (nice_address_is_private (heap_addr) == TRUE);
g_assert (nice_address_set_from_string(heap_addr, "169.255.0.0")); g_assert_true (nice_address_set_from_string(heap_addr, "169.255.0.0"));
g_assert (nice_address_is_private (heap_addr) == FALSE); g_assert_true (nice_address_is_private (heap_addr) == FALSE);
g_assert (nice_address_set_from_string(heap_addr, "fe70::0")); g_assert_true (nice_address_set_from_string(heap_addr, "fe70::0"));
g_assert (nice_address_is_private (heap_addr) == FALSE); g_assert_true (nice_address_is_private (heap_addr) == FALSE);
g_assert (nice_address_set_from_string(heap_addr, "fe80::0")); g_assert_true (nice_address_set_from_string(heap_addr, "fe80::0"));
g_assert (nice_address_is_private (heap_addr) == TRUE); g_assert_true (nice_address_is_private (heap_addr) == TRUE);
g_assert (nice_address_set_from_string(heap_addr, "fe81::0")); g_assert_true (nice_address_set_from_string(heap_addr, "fe81::0"));
g_assert (nice_address_is_private (heap_addr) == TRUE); g_assert_true (nice_address_is_private (heap_addr) == TRUE);
nice_address_free (heap_addr); nice_address_free (heap_addr);
} }
...@@ -163,7 +163,7 @@ test_ipv6 (void) ...@@ -163,7 +163,7 @@ test_ipv6 (void)
struct sockaddr addr; struct sockaddr addr;
} sin, sin2; } sin, sin2;
g_assert (nice_address_set_from_string (&v4addr, "172.1.0.1") == TRUE); g_assert_true (nice_address_set_from_string (&v4addr, "172.1.0.1") == TRUE);
memset (&sin, 0, sizeof (sin)); memset (&sin, 0, sizeof (sin));
memset (&sin2, 0, sizeof (sin2)); memset (&sin2, 0, sizeof (sin2));
...@@ -188,7 +188,7 @@ test_ipv6 (void) ...@@ -188,7 +188,7 @@ test_ipv6 (void)
nice_address_copy_to_sockaddr (&other, &sin2.addr); nice_address_copy_to_sockaddr (&other, &sin2.addr);
nice_address_copy_to_sockaddr (&addr, &sin.addr); nice_address_copy_to_sockaddr (&addr, &sin.addr);
g_assert (nice_address_equal (&addr, &other) == TRUE); g_assert_true (nice_address_equal (&addr, &other) == TRUE);
nice_address_to_string (&addr, str); nice_address_to_string (&addr, str);
nice_address_to_string (&other, str); nice_address_to_string (&other, str);
...@@ -200,20 +200,20 @@ test_ipv6 (void) ...@@ -200,20 +200,20 @@ test_ipv6 (void)
"\x00\x00\x00\x00" "\x00\x00\x00\x00"
"\x00\x00\x00\x00" "\x00\x00\x00\x00"
"\x00\x00\x00\x01"); "\x00\x00\x00\x01");
g_assert (nice_address_is_private (&addr) == TRUE); g_assert_true (nice_address_is_private (&addr) == TRUE);
nice_address_set_ipv6 (&addr, (guchar *) nice_address_set_ipv6 (&addr, (guchar *)
"\x00\x00\x00\x00" "\x00\x00\x00\x00"
"\x00\x00\x00\x00" "\x00\x00\x00\x00"
"\x00\x00\x00\x00" "\x00\x00\x00\x00"
"\x00\x00\x00\x01"); "\x00\x00\x00\x01");
g_assert (nice_address_is_private (&addr) == TRUE); g_assert_true (nice_address_is_private (&addr) == TRUE);
/* mismatching address families */ /* mismatching address families */
g_assert (nice_address_equal (&addr, &v4addr) != TRUE); g_assert_true (nice_address_equal (&addr, &v4addr) != TRUE);
/* mismatched type */ /* mismatched type */
addr.s.addr.sa_family = AF_UNSPEC; addr.s.addr.sa_family = AF_UNSPEC;
/*g_assert (nice_address_equal (&addr, &v4addr) != TRUE);*/ /*g_assert_true (nice_address_equal (&addr, &v4addr) != TRUE);*/
} }
int int
......
...@@ -65,7 +65,7 @@ test_socket_initial_properties (void) ...@@ -65,7 +65,7 @@ test_socket_initial_properties (void)
sock = nice_udp_bsd_socket_new (NULL, &error); sock = nice_udp_bsd_socket_new (NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (sock != NULL); g_assert_true (sock != NULL);
// not bound to a particular interface // not bound to a particular interface
g_assert_cmpint (sock->addr.s.ip4.sin_addr.s_addr, ==, 0); g_assert_cmpint (sock->addr.s.ip4.sin_addr.s_addr, ==, 0);
...@@ -84,9 +84,9 @@ test_socket_address_properties (void) ...@@ -84,9 +84,9 @@ test_socket_address_properties (void)
sock = nice_udp_bsd_socket_new (NULL, &error); sock = nice_udp_bsd_socket_new (NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (sock != NULL); g_assert_true (sock != NULL);
g_assert (nice_address_set_from_string (&tmp, "127.0.0.1")); g_assert_true (nice_address_set_from_string (&tmp, "127.0.0.1"));
g_assert_cmpuint (nice_address_get_port (&sock->addr), !=, 0); g_assert_cmpuint (nice_address_get_port (&sock->addr), !=, 0);
nice_address_set_port (&tmp, nice_address_get_port (&sock->addr)); nice_address_set_port (&tmp, nice_address_get_port (&sock->addr));
g_assert_cmpuint (nice_address_get_port (&tmp), !=, 0); g_assert_cmpuint (nice_address_get_port (&tmp), !=, 0);
...@@ -105,13 +105,13 @@ test_simple_send_recv (void) ...@@ -105,13 +105,13 @@ test_simple_send_recv (void)
server = nice_udp_bsd_socket_new (NULL, &error); server = nice_udp_bsd_socket_new (NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (server != NULL); g_assert_true (server != NULL);
client = nice_udp_bsd_socket_new (NULL, &error); client = nice_udp_bsd_socket_new (NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (client != NULL); g_assert_true (client != NULL);
g_assert (nice_address_set_from_string (&tmp, "127.0.0.1")); g_assert_true (nice_address_set_from_string (&tmp, "127.0.0.1"));
nice_address_set_port (&tmp, nice_address_get_port (&server->addr)); nice_address_set_port (&tmp, nice_address_get_port (&server->addr));
/* Send and receive stuff. */ /* Send and receive stuff. */
...@@ -143,9 +143,9 @@ test_zero_send_recv (void) ...@@ -143,9 +143,9 @@ test_zero_send_recv (void)
sock = nice_udp_bsd_socket_new (NULL, &error); sock = nice_udp_bsd_socket_new (NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (sock != NULL); g_assert_true (sock != NULL);
g_assert (nice_address_set_from_string (&tmp, "127.0.0.1")); g_assert_true (nice_address_set_from_string (&tmp, "127.0.0.1"));
g_assert_cmpuint (nice_address_get_port (&sock->addr), !=, 0); g_assert_cmpuint (nice_address_get_port (&sock->addr), !=, 0);
nice_address_set_port (&tmp, nice_address_get_port (&sock->addr)); nice_address_set_port (&tmp, nice_address_get_port (&sock->addr));
g_assert_cmpuint (nice_address_get_port (&tmp), !=, 0); g_assert_cmpuint (nice_address_get_port (&tmp), !=, 0);
...@@ -181,13 +181,13 @@ test_multi_buffer_recv (void) ...@@ -181,13 +181,13 @@ test_multi_buffer_recv (void)
server = nice_udp_bsd_socket_new (NULL, &error); server = nice_udp_bsd_socket_new (NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (server != NULL); g_assert_true (server != NULL);
client = nice_udp_bsd_socket_new (NULL, &error); client = nice_udp_bsd_socket_new (NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (client != NULL); g_assert_true (client != NULL);
g_assert (nice_address_set_from_string (&tmp, "127.0.0.1")); g_assert_true (nice_address_set_from_string (&tmp, "127.0.0.1"));
nice_address_set_port (&tmp, nice_address_get_port (&server->addr)); nice_address_set_port (&tmp, nice_address_get_port (&server->addr));
/* Send and receive stuff. */ /* Send and receive stuff. */
...@@ -255,13 +255,13 @@ test_multi_message_recv (guint n_sends, guint n_receives, ...@@ -255,13 +255,13 @@ test_multi_message_recv (guint n_sends, guint n_receives,
server = nice_udp_bsd_socket_new (NULL, &error); server = nice_udp_bsd_socket_new (NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (server != NULL); g_assert_true (server != NULL);
client = nice_udp_bsd_socket_new (NULL, &error); client = nice_udp_bsd_socket_new (NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (client != NULL); g_assert_true (client != NULL);
g_assert (nice_address_set_from_string (&tmp, "127.0.0.1")); g_assert_true (nice_address_set_from_string (&tmp, "127.0.0.1"));
nice_address_set_port (&tmp, nice_address_get_port (&server->addr)); nice_address_set_port (&tmp, nice_address_get_port (&server->addr));
/* Send and receive stuff. */ /* Send and receive stuff. */
......
This diff is collapsed.
...@@ -197,7 +197,7 @@ static void priv_get_local_addr (NiceAgent *agent, guint stream_id, guint compon ...@@ -197,7 +197,7 @@ static void priv_get_local_addr (NiceAgent *agent, guint stream_id, guint compon
for (i = cands; i; i = i->next) { for (i = cands; i; i = i->next) {
NiceCandidate *cand = i->data; NiceCandidate *cand = i->data;
if (cand) { if (cand) {
g_assert (dstaddr); g_assert_true (dstaddr);
*dstaddr = cand->addr; *dstaddr = cand->addr;
} }
} }
...@@ -264,8 +264,8 @@ static int run_consent_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress * ...@@ -264,8 +264,8 @@ static int run_consent_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *
global_ragent_gathering_done != TRUE) { global_ragent_gathering_done != TRUE) {
g_debug ("test-consent: Added streams, running mainloop until 'candidate-gathering-done'..."); g_debug ("test-consent: Added streams, running mainloop until 'candidate-gathering-done'...");
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
g_assert (global_lagent_gathering_done == TRUE); g_assert_true (global_lagent_gathering_done == TRUE);
g_assert (global_ragent_gathering_done == TRUE); g_assert_true (global_ragent_gathering_done == TRUE);
} }
/* step: find out the local candidates of each agent */ /* step: find out the local candidates of each agent */
...@@ -319,8 +319,8 @@ static int run_consent_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress * ...@@ -319,8 +319,8 @@ static int run_consent_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
/* note: verify that STUN binding requests were sent */ /* note: verify that STUN binding requests were sent */
g_assert (global_lagent_ibr_received == TRUE); g_assert_true (global_lagent_ibr_received == TRUE);
g_assert (global_ragent_ibr_received == TRUE); g_assert_true (global_ragent_ibr_received == TRUE);
/* note: verify that correct number of local candidates were reported */ /* note: verify that correct number of local candidates were reported */
g_assert_cmpint (global_lagent_cands, ==, 2); g_assert_cmpint (global_lagent_cands, ==, 2);
g_assert_cmpint (global_ragent_cands, ==, 2); g_assert_cmpint (global_ragent_cands, ==, 2);
...@@ -336,12 +336,12 @@ static int run_consent_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress * ...@@ -336,12 +336,12 @@ static int run_consent_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *
global_components_failed = 0; global_components_failed = 0;
/* step: synthesize marking the components as consent failed */ /* step: synthesize marking the components as consent failed */
g_assert (nice_agent_consent_lost (ragent, rs_id, NICE_COMPONENT_TYPE_RTP)); g_assert_true (nice_agent_consent_lost (ragent, rs_id, NICE_COMPONENT_TYPE_RTP));
g_assert (nice_agent_consent_lost (ragent, rs_id, NICE_COMPONENT_TYPE_RTCP)); g_assert_true (nice_agent_consent_lost (ragent, rs_id, NICE_COMPONENT_TYPE_RTCP));
/* step: synthesize marking the components as consent failed */ /* step: synthesize marking the components as consent failed */
g_assert (nice_agent_consent_lost (lagent, rs_id, NICE_COMPONENT_TYPE_RTP)); g_assert_true (nice_agent_consent_lost (lagent, rs_id, NICE_COMPONENT_TYPE_RTP));
g_assert (nice_agent_consent_lost (lagent, rs_id, NICE_COMPONENT_TYPE_RTCP)); g_assert_true (nice_agent_consent_lost (lagent, rs_id, NICE_COMPONENT_TYPE_RTCP));
/* transition to failed will take roughly 4-6 seconds as that's the pacing /* transition to failed will take roughly 4-6 seconds as that's the pacing
* of the consent connection checks */ * of the consent connection checks */
...@@ -401,8 +401,8 @@ static int run_consent_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress * ...@@ -401,8 +401,8 @@ static int run_consent_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
/* note: verify binding requests were resent after restart */ /* note: verify binding requests were resent after restart */
g_assert (global_lagent_ibr_received == TRUE); g_assert_true (global_lagent_ibr_received == TRUE);
g_assert (global_ragent_ibr_received == TRUE); g_assert_true (global_ragent_ibr_received == TRUE);
/* send another packet after consent lost and after ice restart that will succeed */ /* send another packet after consent lost and after ice restart that will succeed */
g_assert_cmpint (nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678"), ==, 16); g_assert_cmpint (nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678"), ==, 16);
......
...@@ -78,7 +78,7 @@ static void swap_candidates(NiceAgent *local, guint local_id, NiceAgent *remote, ...@@ -78,7 +78,7 @@ static void swap_candidates(NiceAgent *local, guint local_id, NiceAgent *remote,
g_debug ("test-credentials:%s", G_STRFUNC); g_debug ("test-credentials:%s", G_STRFUNC);
cands = nice_agent_get_local_candidates(local, local_id, cands = nice_agent_get_local_candidates(local, local_id,
NICE_COMPONENT_TYPE_RTP); NICE_COMPONENT_TYPE_RTP);
g_assert (nice_agent_set_remote_candidates(remote, remote_id, g_assert_true (nice_agent_set_remote_candidates(remote, remote_id,
NICE_COMPONENT_TYPE_RTP, cands)); NICE_COMPONENT_TYPE_RTP, cands));
g_slist_free_full (cands, (GDestroyNotify) nice_candidate_free); g_slist_free_full (cands, (GDestroyNotify) nice_candidate_free);
...@@ -121,11 +121,11 @@ static void setup(NiceAgent *lagent, NiceAgent *ragent) ...@@ -121,11 +121,11 @@ static void setup(NiceAgent *lagent, NiceAgent *ragent)
g_assert_cmpuint (nice_agent_add_stream (lagent, 1), ==, 1); g_assert_cmpuint (nice_agent_add_stream (lagent, 1), ==, 1);
g_assert_cmpuint (nice_agent_add_stream (ragent, 1), ==, 1); g_assert_cmpuint (nice_agent_add_stream (ragent, 1), ==, 1);
g_assert (NULL != lagent->streams); g_assert_true (NULL != lagent->streams);
g_assert (NULL != ragent->streams); g_assert_true (NULL != ragent->streams);
nice_address_init (&addr); nice_address_init (&addr);
g_assert (nice_address_set_from_string (&addr, "127.0.0.1")); g_assert_true (nice_address_set_from_string (&addr, "127.0.0.1"));
nice_agent_add_local_address (lagent, &addr); nice_agent_add_local_address (lagent, &addr);
nice_agent_add_local_address (ragent, &addr); nice_agent_add_local_address (ragent, &addr);
......
...@@ -144,9 +144,9 @@ int main (void) ...@@ -144,9 +144,9 @@ int main (void)
nice_agent_set_remote_credentials (ragent, rs_id_2, lufrag, lpassword); nice_agent_set_remote_credentials (ragent, rs_id_2, lufrag, lpassword);
nice_agent_set_remote_credentials (lagent, ls_id, rufrag2, rpassword2); nice_agent_set_remote_credentials (lagent, ls_id, rufrag2, rpassword2);
g_assert (nice_agent_gather_candidates (lagent, ls_id) == TRUE); g_assert_true (nice_agent_gather_candidates (lagent, ls_id) == TRUE);
g_assert (nice_agent_gather_candidates (ragent, rs_id_2) == TRUE); g_assert_true (nice_agent_gather_candidates (ragent, rs_id_2) == TRUE);
g_assert (nice_agent_gather_candidates (ragent, rs_id_1) == TRUE); g_assert_true (nice_agent_gather_candidates (ragent, rs_id_1) == TRUE);
if (USE_SECOND_STREAM) { if (USE_SECOND_STREAM) {
set_candidates (ragent, rs_id_2, lagent, ls_id, NICE_COMPONENT_TYPE_RTP); set_candidates (ragent, rs_id_2, lagent, ls_id, NICE_COMPONENT_TYPE_RTP);
...@@ -177,8 +177,8 @@ int main (void) ...@@ -177,8 +177,8 @@ int main (void)
nice_agent_set_remote_credentials (ragent, rs_id_1, lufrag, lpassword); nice_agent_set_remote_credentials (ragent, rs_id_1, lufrag, lpassword);
nice_agent_set_remote_credentials (lagent, ls_id, rufrag1, rpassword1); nice_agent_set_remote_credentials (lagent, ls_id, rufrag1, rpassword1);
g_assert (nice_agent_gather_candidates (lagent, ls_id) == TRUE); g_assert_true (nice_agent_gather_candidates (lagent, ls_id) == TRUE);
g_assert (nice_agent_gather_candidates (ragent, rs_id_1) == TRUE); g_assert_true (nice_agent_gather_candidates (ragent, rs_id_1) == TRUE);
/* step: attach to mainloop (needed to register the fds) */ /* step: attach to mainloop (needed to register the fds) */
nice_agent_attach_recv (ragent, rs_id_1, NICE_COMPONENT_TYPE_RTP, nice_agent_attach_recv (ragent, rs_id_1, NICE_COMPONENT_TYPE_RTP,
......
...@@ -98,7 +98,7 @@ static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id, ...@@ -98,7 +98,7 @@ static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id,
* send before the negotiation is over. * send before the negotiation is over.
*/ */
g_assert_cmpuint (len, ==, 16); g_assert_cmpuint (len, ==, 16);
g_assert (strncmp ("1234567812345678", buf, 16) == 0); g_assert_true (strncmp ("1234567812345678", buf, 16) == 0);
if (component_id == 2) if (component_id == 2)
return; return;
...@@ -227,7 +227,7 @@ static void set_candidates (NiceAgent *from, guint from_stream, ...@@ -227,7 +227,7 @@ static void set_candidates (NiceAgent *from, guint from_stream,
NiceCandidateImpl *cand = item1->data; NiceCandidateImpl *cand = item1->data;
NiceSocket *nicesock = cand->sockptr; NiceSocket *nicesock = cand->sockptr;
g_assert (nicesock); g_assert_true (nicesock);
for (item2 = peer_cands; item2; item2 = item2->next) { for (item2 = peer_cands; item2; item2 = item2->next) {
NiceCandidate *target_cand = item2->data; NiceCandidate *target_cand = item2->data;
...@@ -266,14 +266,14 @@ get_port (NiceAgent *agent, guint stream_id, guint component_id) ...@@ -266,14 +266,14 @@ get_port (NiceAgent *agent, guint stream_id, guint component_id)
GSList *item; GSList *item;
guint16 port = 0; guint16 port = 0;
g_assert (cands != NULL); g_assert_true (cands != NULL);
for (item = cands; item; item = item->next) { for (item = cands; item; item = item->next) {
NiceCandidate *cand = item->data; NiceCandidate *cand = item->data;
port = nice_address_get_port (&cand->addr); port = nice_address_get_port (&cand->addr);
break; break;
} }
g_assert (port != 0); g_assert_true (port != 0);
g_slist_free_full (cands, (GDestroyNotify) nice_candidate_free); g_slist_free_full (cands, (GDestroyNotify) nice_candidate_free);
...@@ -314,16 +314,16 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas ...@@ -314,16 +314,16 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
/* Gather candidates and test nice_agent_set_port_range */ /* Gather candidates and test nice_agent_set_port_range */
nice_agent_set_port_range (lagent, ls_id, 1, 10000, 11000); nice_agent_set_port_range (lagent, ls_id, 1, 10000, 11000);
nice_agent_set_port_range (lagent, ls_id, 2, 11000, 12000); nice_agent_set_port_range (lagent, ls_id, 2, 11000, 12000);
g_assert (nice_agent_gather_candidates (lagent, ls_id) == TRUE); g_assert_true (nice_agent_gather_candidates (lagent, ls_id) == TRUE);
port = get_port (lagent, ls_id, 1); port = get_port (lagent, ls_id, 1);
nice_agent_set_port_range (ragent, rs_id, 1, 12000, 13000); nice_agent_set_port_range (ragent, rs_id, 1, 12000, 13000);
nice_agent_set_port_range (ragent, rs_id, 2, port, port); nice_agent_set_port_range (ragent, rs_id, 2, port, port);
g_assert (nice_agent_gather_candidates (ragent, rs_id) == FALSE); g_assert_true (nice_agent_gather_candidates (ragent, rs_id) == FALSE);
g_assert (nice_agent_get_local_candidates (ragent, rs_id, 1) == NULL); g_assert_true (nice_agent_get_local_candidates (ragent, rs_id, 1) == NULL);
g_assert (nice_agent_get_local_candidates (ragent, rs_id, 2) == NULL); g_assert_true (nice_agent_get_local_candidates (ragent, rs_id, 2) == NULL);
nice_agent_set_port_range (ragent, rs_id, 2, 13000, 14000); nice_agent_set_port_range (ragent, rs_id, 2, 13000, 14000);
g_assert (nice_agent_gather_candidates (ragent, rs_id) == TRUE); g_assert_true (nice_agent_gather_candidates (ragent, rs_id) == TRUE);
{ {
GSList *cands = NULL, *i; GSList *cands = NULL, *i;
...@@ -391,8 +391,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas ...@@ -391,8 +391,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
global_ragent_gathering_done != TRUE) { global_ragent_gathering_done != TRUE) {
g_debug ("test-drop-invalid: Added streams, running mainloop until 'candidate-gathering-done'..."); g_debug ("test-drop-invalid: Added streams, running mainloop until 'candidate-gathering-done'...");
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
g_assert (global_lagent_gathering_done == TRUE); g_assert_true (global_lagent_gathering_done == TRUE);
g_assert (global_ragent_gathering_done == TRUE); g_assert_true (global_ragent_gathering_done == TRUE);
} }
set_credentials (lagent, ls_id, ragent, rs_id); set_credentials (lagent, ls_id, ragent, rs_id);
...@@ -410,8 +410,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas ...@@ -410,8 +410,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
/* note: verify that STUN binding requests were sent */ /* note: verify that STUN binding requests were sent */
g_assert (global_lagent_ibr_received == TRUE); g_assert_true (global_lagent_ibr_received == TRUE);
g_assert (global_ragent_ibr_received == TRUE); g_assert_true (global_ragent_ibr_received == TRUE);
/* note: Send a packet from another address */ /* note: Send a packet from another address */
/* These should also be ignored */ /* These should also be ignored */
...@@ -421,10 +421,10 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas ...@@ -421,10 +421,10 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
NiceSocket *tmpsock; NiceSocket *tmpsock;
GError *error = NULL; GError *error = NULL;
g_assert (nice_agent_get_selected_pair (lagent, ls_id, 1, &local_cand, g_assert_true (nice_agent_get_selected_pair (lagent, ls_id, 1, &local_cand,
&remote_cand)); &remote_cand));
g_assert (local_cand); g_assert_true (local_cand);
g_assert (remote_cand); g_assert_true (remote_cand);
tmpsock = nice_udp_bsd_socket_new (NULL, &error); tmpsock = nice_udp_bsd_socket_new (NULL, &error);
g_assert_no_error (error); g_assert_no_error (error);
...@@ -436,7 +436,7 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas ...@@ -436,7 +436,7 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
/* note: test payload send and receive */ /* note: test payload send and receive */
global_ragent_read = 0; global_ragent_read = 0;
ret = nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678"); ret = nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678");
g_assert (ret != -1); g_assert_true (ret != -1);
g_debug ("Sent %d bytes", ret); g_debug ("Sent %d bytes", ret);
g_assert_cmpint (ret, ==, 16); g_assert_cmpint (ret, ==, 16);
while (global_ragent_read != 16) while (global_ragent_read != 16)
......
...@@ -202,7 +202,7 @@ static void priv_get_local_addr (NiceAgent *agent, guint stream_id, guint compon ...@@ -202,7 +202,7 @@ static void priv_get_local_addr (NiceAgent *agent, guint stream_id, guint compon
for (i = cands; i; i = i->next) { for (i = cands; i; i = i->next) {
NiceCandidate *cand = i->data; NiceCandidate *cand = i->data;
if (cand) { if (cand) {
g_assert (dstaddr); g_assert_true (dstaddr);
*dstaddr = cand->addr; *dstaddr = cand->addr;
break; break;
} }
...@@ -266,8 +266,8 @@ static int run_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress ...@@ -266,8 +266,8 @@ static int run_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress
global_ragent_gathering_done != TRUE) { global_ragent_gathering_done != TRUE) {
g_debug ("test-fallback: Added streams, running mainloop until 'candidate-gathering-done'..."); g_debug ("test-fallback: Added streams, running mainloop until 'candidate-gathering-done'...");
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
g_assert (global_lagent_gathering_done == TRUE); g_assert_true (global_lagent_gathering_done == TRUE);
g_assert (global_ragent_gathering_done == TRUE); g_assert_true (global_ragent_gathering_done == TRUE);
} }
/* step: find out the local candidates of each agent */ /* step: find out the local candidates of each agent */
...@@ -303,10 +303,10 @@ static int run_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress ...@@ -303,10 +303,10 @@ static int run_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress
nice_agent_set_remote_candidates (ragent, rs_id, NICE_COMPONENT_TYPE_RTCP, cands); nice_agent_set_remote_candidates (ragent, rs_id, NICE_COMPONENT_TYPE_RTCP, cands);
/* step: fall back to non-ICE mode on both sides */ /* step: fall back to non-ICE mode on both sides */
g_assert (nice_agent_set_selected_pair (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, "1", "1") == TRUE); g_assert_true (nice_agent_set_selected_pair (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, "1", "1") == TRUE);
g_assert (nice_agent_set_selected_pair (lagent, ls_id, NICE_COMPONENT_TYPE_RTCP, "1", "1") == TRUE); g_assert_true (nice_agent_set_selected_pair (lagent, ls_id, NICE_COMPONENT_TYPE_RTCP, "1", "1") == TRUE);
g_assert (nice_agent_set_selected_pair (ragent, rs_id, NICE_COMPONENT_TYPE_RTP, "1", "1") == TRUE); g_assert_true (nice_agent_set_selected_pair (ragent, rs_id, NICE_COMPONENT_TYPE_RTP, "1", "1") == TRUE);
g_assert (nice_agent_set_selected_pair (ragent, rs_id, NICE_COMPONENT_TYPE_RTCP, "1", "1") == TRUE); g_assert_true (nice_agent_set_selected_pair (ragent, rs_id, NICE_COMPONENT_TYPE_RTCP, "1", "1") == TRUE);
g_debug ("test-fallback: Requested for fallback, running mainloop until component state change is completed..."); g_debug ("test-fallback: Requested for fallback, running mainloop until component state change is completed...");
...@@ -402,8 +402,8 @@ static int run_safe_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAdd ...@@ -402,8 +402,8 @@ static int run_safe_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAdd
global_ragent_gathering_done != TRUE) { global_ragent_gathering_done != TRUE) {
g_debug ("test-fallback: Added streams, running mainloop until 'candidate-gathering-done'..."); g_debug ("test-fallback: Added streams, running mainloop until 'candidate-gathering-done'...");
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
g_assert (global_lagent_gathering_done == TRUE); g_assert_true (global_lagent_gathering_done == TRUE);
g_assert (global_ragent_gathering_done == TRUE); g_assert_true (global_ragent_gathering_done == TRUE);
} }
/* step: find out the local candidates of each agent */ /* step: find out the local candidates of each agent */
...@@ -428,17 +428,17 @@ static int run_safe_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAdd ...@@ -428,17 +428,17 @@ static int run_safe_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAdd
cdes->component_id = NICE_COMPONENT_TYPE_RTP; cdes->component_id = NICE_COMPONENT_TYPE_RTP;
cdes->addr = raddr; cdes->addr = raddr;
g_assert (nice_agent_set_selected_remote_candidate (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, cdes)); g_assert_true (nice_agent_set_selected_remote_candidate (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, cdes));
cdes->addr = laddr; cdes->addr = laddr;
g_assert (nice_agent_set_selected_remote_candidate (ragent, rs_id, NICE_COMPONENT_TYPE_RTP, cdes)); g_assert_true (nice_agent_set_selected_remote_candidate (ragent, rs_id, NICE_COMPONENT_TYPE_RTP, cdes));
cdes->component_id = NICE_COMPONENT_TYPE_RTCP; cdes->component_id = NICE_COMPONENT_TYPE_RTCP;
cdes->addr = raddr_rtcp; cdes->addr = raddr_rtcp;
g_assert (nice_agent_set_selected_remote_candidate (lagent, ls_id, NICE_COMPONENT_TYPE_RTCP, cdes)); g_assert_true (nice_agent_set_selected_remote_candidate (lagent, ls_id, NICE_COMPONENT_TYPE_RTCP, cdes));
cdes->addr = laddr_rtcp; cdes->addr = laddr_rtcp;
g_assert (nice_agent_set_selected_remote_candidate (ragent, rs_id, NICE_COMPONENT_TYPE_RTCP, cdes)); g_assert_true (nice_agent_set_selected_remote_candidate (ragent, rs_id, NICE_COMPONENT_TYPE_RTCP, cdes));
g_debug ("test-fallback: Requested for fallback, running mainloop until component state change is completed..."); g_debug ("test-fallback: Requested for fallback, running mainloop until component state change is completed...");
......
...@@ -352,14 +352,14 @@ get_port (NiceAgent *agent, guint stream_id, guint component_id) ...@@ -352,14 +352,14 @@ get_port (NiceAgent *agent, guint stream_id, guint component_id)
GSList *item; GSList *item;
guint16 port = 0; guint16 port = 0;
g_assert (cands != NULL); g_assert_true (cands != NULL);
for (item = cands; item; item = item->next) { for (item = cands; item; item = item->next) {
NiceCandidate *cand = item->data; NiceCandidate *cand = item->data;
port = nice_address_get_port (&cand->addr); port = nice_address_get_port (&cand->addr);
break; break;
} }
g_assert (port != 0); g_assert_true (port != 0);
g_slist_free_full (cands, (GDestroyNotify) nice_candidate_free); g_slist_free_full (cands, (GDestroyNotify) nice_candidate_free);
...@@ -419,12 +419,12 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas ...@@ -419,12 +419,12 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
nice_agent_set_port_range (ragent, rs_id, 2, port, port); nice_agent_set_port_range (ragent, rs_id, 2, port, port);
g_assert (nice_agent_gather_candidates (ragent, rs_id) == FALSE); g_assert_true (nice_agent_gather_candidates (ragent, rs_id) == FALSE);
g_assert (nice_agent_get_local_candidates (ragent, rs_id, 1) == NULL); g_assert_true (nice_agent_get_local_candidates (ragent, rs_id, 1) == NULL);
g_assert (nice_agent_get_local_candidates (ragent, rs_id, 2) == NULL); g_assert_true (nice_agent_get_local_candidates (ragent, rs_id, 2) == NULL);
nice_agent_set_port_range (ragent, rs_id, 2, 0, 0); nice_agent_set_port_range (ragent, rs_id, 2, 0, 0);
g_assert (nice_agent_gather_candidates (lagent, ls_id) == TRUE); g_assert_true (nice_agent_gather_candidates (lagent, ls_id) == TRUE);
g_assert (nice_agent_gather_candidates (ragent, rs_id) == TRUE); g_assert_true (nice_agent_gather_candidates (ragent, rs_id) == TRUE);
#if USE_LOOPBACK #if USE_LOOPBACK
{ {
...@@ -486,8 +486,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas ...@@ -486,8 +486,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
global_ragent_gathering_done != TRUE) { global_ragent_gathering_done != TRUE) {
g_debug ("test-fullmode: Added streams, running mainloop until 'candidate-gathering-done'..."); g_debug ("test-fullmode: Added streams, running mainloop until 'candidate-gathering-done'...");
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
g_assert (global_lagent_gathering_done == TRUE); g_assert_true (global_lagent_gathering_done == TRUE);
g_assert (global_ragent_gathering_done == TRUE); g_assert_true (global_ragent_gathering_done == TRUE);
} }
set_credentials (lagent, ls_id, ragent, rs_id); set_credentials (lagent, ls_id, ragent, rs_id);
...@@ -505,8 +505,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas ...@@ -505,8 +505,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
/* note: verify that STUN binding requests were sent */ /* note: verify that STUN binding requests were sent */
g_assert (global_lagent_ibr_received == TRUE); g_assert_true (global_lagent_ibr_received == TRUE);
g_assert (global_ragent_ibr_received == TRUE); g_assert_true (global_ragent_ibr_received == TRUE);
/* note: test payload send and receive */ /* note: test payload send and receive */
global_ragent_read = 0; global_ragent_read = 0;
...@@ -609,8 +609,8 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N ...@@ -609,8 +609,8 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N
global_ragent_gathering_done != TRUE) { global_ragent_gathering_done != TRUE) {
g_debug ("test-fullmode: Added streams, running mainloop until 'candidate-gathering-done'..."); g_debug ("test-fullmode: Added streams, running mainloop until 'candidate-gathering-done'...");
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
g_assert (global_lagent_gathering_done == TRUE); g_assert_true (global_lagent_gathering_done == TRUE);
g_assert (global_ragent_gathering_done == TRUE); g_assert_true (global_ragent_gathering_done == TRUE);
} }
set_credentials (lagent, ls_id, ragent, rs_id); set_credentials (lagent, ls_id, ragent, rs_id);
...@@ -628,7 +628,7 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N ...@@ -628,7 +628,7 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N
global_exit_when_ibr_received = 0; global_exit_when_ibr_received = 0;
/* note: verify that STUN binding requests were sent */ /* note: verify that STUN binding requests were sent */
g_assert (global_lagent_ibr_received == TRUE); g_assert_true (global_lagent_ibr_received == TRUE);
g_debug ("test-fullmode: Delayed answer received, continuing processing.."); g_debug ("test-fullmode: Delayed answer received, continuing processing..");
...@@ -639,7 +639,7 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N ...@@ -639,7 +639,7 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N
g_debug ("test-fullmode: Running mainloop until connectivity checks succeeed."); g_debug ("test-fullmode: Running mainloop until connectivity checks succeeed.");
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
g_assert (global_ragent_ibr_received == TRUE); g_assert_true (global_ragent_ibr_received == TRUE);
g_assert_cmpuint (global_components_failed, ==, 0); g_assert_cmpuint (global_components_failed, ==, 0);
/* note: test payload send and receive */ /* note: test payload send and receive */
...@@ -730,8 +730,8 @@ static int run_full_test_wrong_password (NiceAgent *lagent, NiceAgent *ragent, N ...@@ -730,8 +730,8 @@ static int run_full_test_wrong_password (NiceAgent *lagent, NiceAgent *ragent, N
global_ragent_gathering_done != TRUE) { global_ragent_gathering_done != TRUE) {
g_debug ("test-fullmode: Added streams, running mainloop until 'candidate-gathering-done'..."); g_debug ("test-fullmode: Added streams, running mainloop until 'candidate-gathering-done'...");
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
g_assert (global_lagent_gathering_done == TRUE); g_assert_true (global_lagent_gathering_done == TRUE);
g_assert (global_ragent_gathering_done == TRUE); g_assert_true (global_ragent_gathering_done == TRUE);
} }
g_debug ("test-fullmode: Got local candidates..."); g_debug ("test-fullmode: Got local candidates...");
...@@ -817,8 +817,8 @@ static int run_full_test_control_conflict (NiceAgent *lagent, NiceAgent *ragent, ...@@ -817,8 +817,8 @@ static int run_full_test_control_conflict (NiceAgent *lagent, NiceAgent *ragent,
global_ragent_gathering_done != TRUE) { global_ragent_gathering_done != TRUE) {
g_debug ("test-fullmode: Added streams, running mainloop until 'candidate-gathering-done'..."); g_debug ("test-fullmode: Added streams, running mainloop until 'candidate-gathering-done'...");
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
g_assert (global_lagent_gathering_done == TRUE); g_assert_true (global_lagent_gathering_done == TRUE);
g_assert (global_ragent_gathering_done == TRUE); g_assert_true (global_ragent_gathering_done == TRUE);
} }
g_debug ("test-fullmode: Got local candidates..."); g_debug ("test-fullmode: Got local candidates...");
...@@ -965,17 +965,17 @@ int main (void) ...@@ -965,17 +965,17 @@ int main (void)
guint port = 0; guint port = 0;
gboolean mode = FALSE; gboolean mode = FALSE;
g_object_get (G_OBJECT (lagent), "stun-server", &string, NULL); g_object_get (G_OBJECT (lagent), "stun-server", &string, NULL);
g_assert (stun_server == NULL || strcmp (string, stun_server) == 0); g_assert_true (stun_server == NULL || strcmp (string, stun_server) == 0);
g_free (string); g_free (string);
g_object_get (G_OBJECT (lagent), "stun-server-port", &port, NULL); g_object_get (G_OBJECT (lagent), "stun-server-port", &port, NULL);
g_assert (stun_server_port == NULL || port == (guint)atoi (stun_server_port)); g_assert_true (stun_server_port == NULL || port == (guint)atoi (stun_server_port));
g_object_get (G_OBJECT (lagent), "proxy-ip", &string, NULL); g_object_get (G_OBJECT (lagent), "proxy-ip", &string, NULL);
g_assert_cmpstr (string, ==, PROXY_IP); g_assert_cmpstr (string, ==, PROXY_IP);
g_free (string); g_free (string);
g_object_get (G_OBJECT (lagent), "proxy-port", &port, NULL); g_object_get (G_OBJECT (lagent), "proxy-port", &port, NULL);
g_assert_cmpuint (port, ==, PROXY_PORT); g_assert_cmpuint (port, ==, PROXY_PORT);
g_object_get (G_OBJECT (lagent), "controlling-mode", &mode, NULL); g_object_get (G_OBJECT (lagent), "controlling-mode", &mode, NULL);
g_assert (mode == TRUE); g_assert_true (mode == TRUE);
g_object_set (G_OBJECT (lagent), "max-connectivity-checks", 300, NULL); g_object_set (G_OBJECT (lagent), "max-connectivity-checks", 300, NULL);
g_object_get (G_OBJECT (lagent), "max-connectivity-checks", &max_checks, NULL); g_object_get (G_OBJECT (lagent), "max-connectivity-checks", &max_checks, NULL);
g_assert_cmpuint (max_checks, ==, 300); g_assert_cmpuint (max_checks, ==, 300);
...@@ -1067,9 +1067,9 @@ int main (void) ...@@ -1067,9 +1067,9 @@ int main (void)
priv_print_global_status (); priv_print_global_status ();
g_assert_cmpint (result, ==, 0); g_assert_cmpint (result, ==, 0);
/* should FAIL as agent L can't send any checks: */ /* should FAIL as agent L can't send any checks: */
g_assert (global_lagent_state[0] == NICE_COMPONENT_STATE_FAILED || g_assert_true (global_lagent_state[0] == NICE_COMPONENT_STATE_FAILED ||
global_lagent_state[1] == NICE_COMPONENT_STATE_FAILED); global_lagent_state[1] == NICE_COMPONENT_STATE_FAILED);
g_assert (global_lagent_state[0] == NICE_COMPONENT_STATE_FAILED || g_assert_true (global_lagent_state[0] == NICE_COMPONENT_STATE_FAILED ||
global_lagent_state[1] == NICE_COMPONENT_STATE_FAILED); global_lagent_state[1] == NICE_COMPONENT_STATE_FAILED);
#endif #endif
...@@ -1079,13 +1079,13 @@ int main (void) ...@@ -1079,13 +1079,13 @@ int main (void)
priv_print_global_status (); priv_print_global_status ();
/* should SUCCEED as agent L can send the checks: */ /* should SUCCEED as agent L can send the checks: */
g_assert_cmpint (result, ==, 0); g_assert_cmpint (result, ==, 0);
g_assert (global_lagent_state[0] == NICE_COMPONENT_STATE_CONNECTED || g_assert_true (global_lagent_state[0] == NICE_COMPONENT_STATE_CONNECTED ||
global_lagent_state[0] == NICE_COMPONENT_STATE_READY); global_lagent_state[0] == NICE_COMPONENT_STATE_READY);
g_assert (global_lagent_state[1] == NICE_COMPONENT_STATE_CONNECTED || g_assert_true (global_lagent_state[1] == NICE_COMPONENT_STATE_CONNECTED ||
global_lagent_state[1] == NICE_COMPONENT_STATE_READY); global_lagent_state[1] == NICE_COMPONENT_STATE_READY);
g_assert (global_ragent_state[0] == NICE_COMPONENT_STATE_CONNECTED || g_assert_true (global_ragent_state[0] == NICE_COMPONENT_STATE_CONNECTED ||
global_ragent_state[0] == NICE_COMPONENT_STATE_READY); global_ragent_state[0] == NICE_COMPONENT_STATE_READY);
g_assert(global_ragent_state[1] == NICE_COMPONENT_STATE_CONNECTED || g_assert_true (global_ragent_state[1] == NICE_COMPONENT_STATE_CONNECTED ||
global_ragent_state[1] == NICE_COMPONENT_STATE_READY); global_ragent_state[1] == NICE_COMPONENT_STATE_READY);
g_object_set (G_OBJECT (lagent), "max-connectivity-checks", 100, NULL); g_object_set (G_OBJECT (lagent), "max-connectivity-checks", 100, NULL);
......
...@@ -297,8 +297,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas ...@@ -297,8 +297,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
g_assert_cmpuint (rs_id, >, 0); g_assert_cmpuint (rs_id, >, 0);
/* Gather candidates */ /* Gather candidates */
g_assert (nice_agent_gather_candidates (lagent, ls_id) == TRUE); g_assert_true (nice_agent_gather_candidates (lagent, ls_id) == TRUE);
g_assert (nice_agent_gather_candidates (ragent, rs_id) == TRUE); g_assert_true (nice_agent_gather_candidates (ragent, rs_id) == TRUE);
{ {
GSList *cands = NULL, *i; GSList *cands = NULL, *i;
...@@ -308,11 +308,11 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas ...@@ -308,11 +308,11 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
g_assert_cmpuint (g_slist_length (cands), ==, 2); g_assert_cmpuint (g_slist_length (cands), ==, 2);
cand = cands->data; cand = cands->data;
g_assert_cmpint (cand->type, ==, NICE_CANDIDATE_TYPE_HOST); g_assert_cmpint (cand->type, ==, NICE_CANDIDATE_TYPE_HOST);
g_assert (cand->transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE || g_assert_true (cand->transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE ||
cand->transport == NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE); cand->transport == NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE);
cand = cands->next->data; cand = cands->next->data;
g_assert_cmpint (cand->type, ==, NICE_CANDIDATE_TYPE_HOST); g_assert_cmpint (cand->type, ==, NICE_CANDIDATE_TYPE_HOST);
g_assert (cand->transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE || g_assert_true (cand->transport == NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE ||
cand->transport == NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE); cand->transport == NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE);
for (i = cands; i; i = i->next) for (i = cands; i; i = i->next)
nice_candidate_free ((NiceCandidate *) i->data); nice_candidate_free ((NiceCandidate *) i->data);
...@@ -339,8 +339,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas ...@@ -339,8 +339,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
global_ragent_gathering_done != TRUE) { global_ragent_gathering_done != TRUE) {
g_debug ("test-icetcp: Added streams, running mainloop until 'candidate-gathering-done'..."); g_debug ("test-icetcp: Added streams, running mainloop until 'candidate-gathering-done'...");
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
g_assert (global_lagent_gathering_done == TRUE); g_assert_true (global_lagent_gathering_done == TRUE);
g_assert (global_ragent_gathering_done == TRUE); g_assert_true (global_ragent_gathering_done == TRUE);
} }
set_credentials (lagent, ls_id, ragent, rs_id); set_credentials (lagent, ls_id, ragent, rs_id);
...@@ -358,8 +358,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas ...@@ -358,8 +358,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
/* note: verify that STUN binding requests were sent */ /* note: verify that STUN binding requests were sent */
g_assert (global_lagent_ibr_received == TRUE); g_assert_true (global_lagent_ibr_received == TRUE);
g_assert (global_ragent_ibr_received == TRUE); g_assert_true (global_ragent_ibr_received == TRUE);
/* note: test payload send and receive */ /* note: test payload send and receive */
global_ragent_read = 0; global_ragent_read = 0;
......
...@@ -50,24 +50,24 @@ test_ipv4 (void) ...@@ -50,24 +50,24 @@ test_ipv4 (void)
/* test private addresses */ /* test private addresses */
nice_address_set_from_string (&addr, "10.1.2.3"); nice_address_set_from_string (&addr, "10.1.2.3");
nice_address_copy_to_sockaddr (&addr, &sin.addr); nice_address_copy_to_sockaddr (&addr, &sin.addr);
g_assert (nice_interfaces_is_private_ip (&sin.addr)); g_assert_true (nice_interfaces_is_private_ip (&sin.addr));
nice_address_set_from_string (&addr, "172.22.22.22"); nice_address_set_from_string (&addr, "172.22.22.22");
nice_address_copy_to_sockaddr (&addr, &sin.addr); nice_address_copy_to_sockaddr (&addr, &sin.addr);
g_assert (nice_interfaces_is_private_ip (&sin.addr)); g_assert_true (nice_interfaces_is_private_ip (&sin.addr));
nice_address_set_from_string (&addr, "192.168.122.1"); nice_address_set_from_string (&addr, "192.168.122.1");
nice_address_copy_to_sockaddr (&addr, &sin.addr); nice_address_copy_to_sockaddr (&addr, &sin.addr);
g_assert (nice_interfaces_is_private_ip (&sin.addr)); g_assert_true (nice_interfaces_is_private_ip (&sin.addr));
nice_address_set_from_string (&addr, "169.254.1.2"); nice_address_set_from_string (&addr, "169.254.1.2");
nice_address_copy_to_sockaddr (&addr, &sin.addr); nice_address_copy_to_sockaddr (&addr, &sin.addr);
g_assert (nice_interfaces_is_private_ip (&sin.addr)); g_assert_true (nice_interfaces_is_private_ip (&sin.addr));
/* test public addresses */ /* test public addresses */
nice_address_set_from_string (&addr, "1.2.3.4"); nice_address_set_from_string (&addr, "1.2.3.4");
nice_address_copy_to_sockaddr (&addr, &sin.addr); nice_address_copy_to_sockaddr (&addr, &sin.addr);
g_assert (nice_interfaces_is_private_ip (&sin.addr) == FALSE); g_assert_true (nice_interfaces_is_private_ip (&sin.addr) == FALSE);
} }
...@@ -85,13 +85,13 @@ test_ipv6 (void) ...@@ -85,13 +85,13 @@ test_ipv6 (void)
nice_address_set_from_string (&addr, nice_address_set_from_string (&addr,
"fe8f:2233:4455:6677:8899:aabb:ccdd:eeff"); "fe8f:2233:4455:6677:8899:aabb:ccdd:eeff");
nice_address_copy_to_sockaddr (&addr, &sin.addr); nice_address_copy_to_sockaddr (&addr, &sin.addr);
g_assert (nice_interfaces_is_private_ip (&sin.addr)); g_assert_true (nice_interfaces_is_private_ip (&sin.addr));
/* test public addresses */ /* test public addresses */
nice_address_set_from_string (&addr, nice_address_set_from_string (&addr,
"11:2233:4455:6677:8899:aabb:ccdd:eeff"); "11:2233:4455:6677:8899:aabb:ccdd:eeff");
nice_address_copy_to_sockaddr (&addr, &sin.addr); nice_address_copy_to_sockaddr (&addr, &sin.addr);
g_assert (nice_interfaces_is_private_ip (&sin.addr) == FALSE); g_assert_true (nice_interfaces_is_private_ip (&sin.addr) == FALSE);
} }
#endif /* G_OS_UNIX */ #endif /* G_OS_UNIX */
......
...@@ -61,7 +61,7 @@ gboolean started; ...@@ -61,7 +61,7 @@ gboolean started;
g_main_context_iteration (context, FALSE); \ g_main_context_iteration (context, FALSE); \
} \ } \
\ \
g_assert (!(var)); \ g_assert_true (!(var)); \
} }
static gboolean timer_cb (gpointer pointer) static gboolean timer_cb (gpointer pointer)
...@@ -177,7 +177,7 @@ candidate_gathering_done_cb (NiceAgent *agent, guint stream_id, ...@@ -177,7 +177,7 @@ candidate_gathering_done_cb (NiceAgent *agent, guint stream_id,
g_free (password); g_free (password);
cands = nice_agent_get_local_candidates (agent, id, 1); cands = nice_agent_get_local_candidates (agent, id, 1);
g_assert (cands != NULL); g_assert_true (cands != NULL);
nice_agent_set_remote_candidates (other, other_id, 1, cands); nice_agent_set_remote_candidates (other, other_id, 1, cands);
...@@ -192,7 +192,7 @@ reliable_transport_writable_cb (NiceAgent *agent, guint stream_id, ...@@ -192,7 +192,7 @@ reliable_transport_writable_cb (NiceAgent *agent, guint stream_id,
{ {
TestIOStreamThreadData *data = user_data; TestIOStreamThreadData *data = user_data;
g_assert (data->reliable); g_assert_true (data->reliable);
/* Signal writeability. */ /* Signal writeability. */
g_mutex_lock (&data->write_mutex); g_mutex_lock (&data->write_mutex);
...@@ -205,7 +205,7 @@ reliable_transport_writable_cb (NiceAgent *agent, guint stream_id, ...@@ -205,7 +205,7 @@ reliable_transport_writable_cb (NiceAgent *agent, guint stream_id,
GOutputStream *output_stream; GOutputStream *output_stream;
io_stream = g_object_get_data (G_OBJECT (agent), "io-stream"); io_stream = g_object_get_data (G_OBJECT (agent), "io-stream");
g_assert (io_stream != NULL); g_assert_true (io_stream != NULL);
output_stream = g_io_stream_get_output_stream (io_stream); output_stream = g_io_stream_get_output_stream (io_stream);
data->callbacks->reliable_transport_writable (output_stream, agent, data->callbacks->reliable_transport_writable (output_stream, agent,
...@@ -265,7 +265,7 @@ create_agent (gboolean controlling_mode, TestIOStreamThreadData *data, ...@@ -265,7 +265,7 @@ create_agent (gboolean controlling_mode, TestIOStreamThreadData *data,
NULL); NULL);
/* Specify which local interface to use. */ /* Specify which local interface to use. */
g_assert (nice_address_set_from_string (&base_addr, "127.0.0.1")); g_assert_true (nice_address_set_from_string (&base_addr, "127.0.0.1"));
nice_agent_add_local_address (agent, &base_addr); nice_agent_add_local_address (agent, &base_addr);
/* Hook up signals. */ /* Hook up signals. */
...@@ -337,7 +337,7 @@ spawn_thread (const gchar *thread_name, GThreadFunc thread_func, ...@@ -337,7 +337,7 @@ spawn_thread (const gchar *thread_name, GThreadFunc thread_func,
GThread *thread; GThread *thread;
thread = g_thread_new (thread_name, thread_func, user_data); thread = g_thread_new (thread_name, thread_func, user_data);
g_assert (thread); g_assert_true (thread);
return thread; return thread;
} }
......
This diff is collapsed.
...@@ -77,7 +77,7 @@ static void cb_component_state_changed (NiceAgent *agent, guint stream_id, guint ...@@ -77,7 +77,7 @@ static void cb_component_state_changed (NiceAgent *agent, guint stream_id, guint
global_components_ready++; global_components_ready++;
else if (state == NICE_COMPONENT_STATE_CONNECTED && ready_to_connected) else if (state == NICE_COMPONENT_STATE_CONNECTED && ready_to_connected)
global_components_ready--; global_components_ready--;
g_assert (state != NICE_COMPONENT_STATE_FAILED); g_assert_true (state != NICE_COMPONENT_STATE_FAILED);
g_debug ("test-nomination: checks READY %u.", global_components_ready); g_debug ("test-nomination: checks READY %u.", global_components_ready);
} }
...@@ -186,8 +186,8 @@ run_test(NiceNominationMode l_nomination_mode, ...@@ -186,8 +186,8 @@ run_test(NiceNominationMode l_nomination_mode,
g_assert_cmpuint (rs_id, >, 0); g_assert_cmpuint (rs_id, >, 0);
/* Gather candidates and test nice_agent_set_port_range */ /* Gather candidates and test nice_agent_set_port_range */
g_assert (nice_agent_gather_candidates (lagent, ls_id) == TRUE); g_assert_true (nice_agent_gather_candidates (lagent, ls_id) == TRUE);
g_assert (nice_agent_gather_candidates (ragent, rs_id) == TRUE); g_assert_true (nice_agent_gather_candidates (ragent, rs_id) == TRUE);
nice_agent_attach_recv (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, nice_agent_attach_recv (lagent, ls_id, NICE_COMPONENT_TYPE_RTP,
g_main_context_default (), cb_nice_recv, GUINT_TO_POINTER (1)); g_main_context_default (), cb_nice_recv, GUINT_TO_POINTER (1));
...@@ -197,10 +197,10 @@ run_test(NiceNominationMode l_nomination_mode, ...@@ -197,10 +197,10 @@ run_test(NiceNominationMode l_nomination_mode,
g_debug ("test-nomination: Added streams, running context until 'candidate-gathering-done'..."); g_debug ("test-nomination: Added streams, running context until 'candidate-gathering-done'...");
while (!global_lagent_gathering_done) while (!global_lagent_gathering_done)
g_main_context_iteration (NULL, TRUE); g_main_context_iteration (NULL, TRUE);
g_assert (global_lagent_gathering_done == TRUE); g_assert_true (global_lagent_gathering_done == TRUE);
while (!global_ragent_gathering_done) while (!global_ragent_gathering_done)
g_main_context_iteration (NULL, TRUE); g_main_context_iteration (NULL, TRUE);
g_assert (global_ragent_gathering_done == TRUE); g_assert_true (global_ragent_gathering_done == TRUE);
set_credentials (lagent, ls_id, ragent, rs_id); set_credentials (lagent, ls_id, ragent, rs_id);
......
...@@ -245,7 +245,7 @@ expect_segment (PseudoTcpSocket *socket, GQueue/*<owned GBytes>*/ *queue, ...@@ -245,7 +245,7 @@ expect_segment (PseudoTcpSocket *socket, GQueue/*<owned GBytes>*/ *queue,
/* Grab the segment. */ /* Grab the segment. */
bytes = g_queue_peek_head (queue); bytes = g_queue_peek_head (queue);
g_assert (bytes != NULL); g_assert_true (bytes != NULL);
b.u8 = g_bytes_get_data (bytes, &size); b.u8 = g_bytes_get_data (bytes, &size);
g_assert_cmpuint (size, >=, 24); /* minimum packet size */ g_assert_cmpuint (size, >=, 24); /* minimum packet size */
...@@ -286,7 +286,7 @@ forward_segment (GQueue/*<owned GBytes>*/ *from, PseudoTcpSocket *to) ...@@ -286,7 +286,7 @@ forward_segment (GQueue/*<owned GBytes>*/ *from, PseudoTcpSocket *to)
gboolean retval; gboolean retval;
segment = g_queue_pop_head (from); segment = g_queue_pop_head (from);
g_assert (segment != NULL); g_assert_true (segment != NULL);
b = g_bytes_get_data (segment, &size); b = g_bytes_get_data (segment, &size);
retval = pseudo_tcp_socket_notify_packet (to, (const gchar *) b, size); retval = pseudo_tcp_socket_notify_packet (to, (const gchar *) b, size);
g_bytes_unref (segment); g_bytes_unref (segment);
...@@ -297,13 +297,13 @@ forward_segment (GQueue/*<owned GBytes>*/ *from, PseudoTcpSocket *to) ...@@ -297,13 +297,13 @@ forward_segment (GQueue/*<owned GBytes>*/ *from, PseudoTcpSocket *to)
static void static void
forward_segment_ltr (Data *data) forward_segment_ltr (Data *data)
{ {
g_assert (forward_segment (data->left_sent, data->right)); g_assert_true (forward_segment (data->left_sent, data->right));
} }
static void static void
forward_segment_rtl (Data *data) forward_segment_rtl (Data *data)
{ {
g_assert (forward_segment (data->right_sent, data->left)); g_assert_true (forward_segment (data->right_sent, data->left));
} }
static void static void
...@@ -312,7 +312,7 @@ duplicate_segment (GQueue/*<owned GBytes>*/ *queue) ...@@ -312,7 +312,7 @@ duplicate_segment (GQueue/*<owned GBytes>*/ *queue)
GBytes *segment; /* unowned */ GBytes *segment; /* unowned */
segment = g_queue_peek_head (queue); segment = g_queue_peek_head (queue);
g_assert (segment != NULL); g_assert_true (segment != NULL);
g_queue_push_head (queue, g_bytes_ref (segment)); g_queue_push_head (queue, g_bytes_ref (segment));
} }
...@@ -323,7 +323,7 @@ drop_segment (PseudoTcpSocket *socket, GQueue/*<owned GBytes>*/ *queue) ...@@ -323,7 +323,7 @@ drop_segment (PseudoTcpSocket *socket, GQueue/*<owned GBytes>*/ *queue)
gchar *str; gchar *str;
segment = g_queue_pop_head (queue); segment = g_queue_pop_head (queue);
g_assert (segment != NULL); g_assert_true (segment != NULL);
str = segment_bytes_to_string (g_bytes_get_data (segment, NULL)); str = segment_bytes_to_string (g_bytes_get_data (segment, NULL));
g_debug ("%p drop: %s", socket, str); g_debug ("%p drop: %s", socket, str);
...@@ -340,9 +340,9 @@ reorder_segments (PseudoTcpSocket *socket, GQueue/*<owned GBytes>*/ *queue) ...@@ -340,9 +340,9 @@ reorder_segments (PseudoTcpSocket *socket, GQueue/*<owned GBytes>*/ *queue)
gchar *str; gchar *str;
segment1 = g_queue_pop_head (queue); segment1 = g_queue_pop_head (queue);
g_assert (segment1 != NULL); g_assert_true (segment1 != NULL);
segment2 = g_queue_pop_head (queue); segment2 = g_queue_pop_head (queue);
g_assert (segment2 != NULL); g_assert_true (segment2 != NULL);
str = segment_bytes_to_string (g_bytes_get_data (segment1, NULL)); str = segment_bytes_to_string (g_bytes_get_data (segment1, NULL));
g_debug ("%p reorder: %s", socket, str); g_debug ("%p reorder: %s", socket, str);
...@@ -969,9 +969,9 @@ pseudotcp_close_duplicate_ack (void) ...@@ -969,9 +969,9 @@ pseudotcp_close_duplicate_ack (void)
expect_ack (data.left, data.left_sent, 8, 8); expect_ack (data.left, data.left_sent, 8, 8);
duplicate_segment (data.left_sent); duplicate_segment (data.left_sent);
forward_segment_ltr (&data); forward_segment_ltr (&data);
g_assert (!forward_segment (data.left_sent, data.right)); g_assert_true (!forward_segment (data.left_sent, data.right));
expect_rst (data.right, data.right_sent, 8, 8); expect_rst (data.right, data.right_sent, 8, 8);
g_assert (!forward_segment (data.right_sent, data.left)); g_assert_true (!forward_segment (data.right_sent, data.left));
expect_sockets_closed (&data); expect_sockets_closed (&data);
...@@ -997,7 +997,7 @@ pseudotcp_close_rst (void) ...@@ -997,7 +997,7 @@ pseudotcp_close_rst (void)
g_assert_cmpint (pseudo_tcp_socket_recv (data.left, (char *) buf, sizeof (buf)), ==, 0); g_assert_cmpint (pseudo_tcp_socket_recv (data.left, (char *) buf, sizeof (buf)), ==, 0);
expect_rst (data.left, data.left_sent, 7, 7); expect_rst (data.left, data.left_sent, 7, 7);
g_assert (!forward_segment (data.left_sent, data.right)); g_assert_true (!forward_segment (data.left_sent, data.right));
/* Check the RHS is closed. */ /* Check the RHS is closed. */
g_assert_cmpint (pseudo_tcp_socket_send (data.right, "foo", 3), ==, -1); g_assert_cmpint (pseudo_tcp_socket_send (data.right, "foo", 3), ==, -1);
...@@ -1031,7 +1031,7 @@ pseudotcp_close_pending_received (void) ...@@ -1031,7 +1031,7 @@ pseudotcp_close_pending_received (void)
close_socket (data.left); close_socket (data.left);
expect_rst (data.left, data.left_sent, 7, 10); expect_rst (data.left, data.left_sent, 7, 10);
g_assert (!forward_segment (data.left_sent, data.right)); g_assert_true (!forward_segment (data.left_sent, data.right));
/* Check the RHS is closed. */ /* Check the RHS is closed. */
g_assert_cmpint (pseudo_tcp_socket_send (data.right, "foo", 3), ==, -1); g_assert_cmpint (pseudo_tcp_socket_send (data.right, "foo", 3), ==, -1);
...@@ -1067,10 +1067,10 @@ pseudotcp_close_rst_afterwards (void) ...@@ -1067,10 +1067,10 @@ pseudotcp_close_rst_afterwards (void)
/* Send some data from RHS to LHS, which should result in an RST. */ /* Send some data from RHS to LHS, which should result in an RST. */
g_assert_cmpint (pseudo_tcp_socket_send (data.right, "foo", 3), ==, 3); g_assert_cmpint (pseudo_tcp_socket_send (data.right, "foo", 3), ==, 3);
expect_data (data.right, data.right_sent, 7, 7, 3); expect_data (data.right, data.right_sent, 7, 7, 3);
g_assert (!forward_segment (data.right_sent, data.left)); g_assert_true (!forward_segment (data.right_sent, data.left));
expect_rst (data.left, data.left_sent, 7, 7); expect_rst (data.left, data.left_sent, 7, 7);
g_assert (!forward_segment (data.left_sent, data.right)); g_assert_true (!forward_segment (data.left_sent, data.right));
/* Check the RHS is closed. */ /* Check the RHS is closed. */
g_assert_cmpint (pseudo_tcp_socket_send (data.right, "foo", 3), ==, -1); g_assert_cmpint (pseudo_tcp_socket_send (data.right, "foo", 3), ==, -1);
...@@ -1107,7 +1107,7 @@ pseudotcp_compatibility (void) ...@@ -1107,7 +1107,7 @@ pseudotcp_compatibility (void)
/* Close it. Sending shouldn’t fail. */ /* Close it. Sending shouldn’t fail. */
pseudo_tcp_socket_close (data.left, FALSE); pseudo_tcp_socket_close (data.left, FALSE);
g_assert (!pseudo_tcp_socket_is_closed (data.left)); g_assert_true (!pseudo_tcp_socket_is_closed (data.left));
g_assert_cmpint (pseudo_tcp_socket_send (data.left, "foo", 3), ==, 3); g_assert_cmpint (pseudo_tcp_socket_send (data.left, "foo", 3), ==, 3);
g_assert_cmpint (pseudo_tcp_socket_recv (data.left, (char *) buf, sizeof (buf)), ==, -1); g_assert_cmpint (pseudo_tcp_socket_recv (data.left, (char *) buf, sizeof (buf)), ==, -1);
...@@ -1125,7 +1125,7 @@ pseudotcp_compatibility (void) ...@@ -1125,7 +1125,7 @@ pseudotcp_compatibility (void)
* outstanding data. */ * outstanding data. */
increment_time_both (&data, 50); increment_time_both (&data, 50);
g_assert (!pseudo_tcp_socket_get_next_clock (data.left, &timeout)); g_assert_true (!pseudo_tcp_socket_get_next_clock (data.left, &timeout));
/* Check the RHS can be closed after receiving the data just sent. */ /* Check the RHS can be closed after receiving the data just sent. */
g_assert_cmpint (pseudo_tcp_socket_recv (data.right, (char *) buf, sizeof (buf)), ==, 3); g_assert_cmpint (pseudo_tcp_socket_recv (data.right, (char *) buf, sizeof (buf)), ==, 3);
...@@ -1134,7 +1134,7 @@ pseudotcp_compatibility (void) ...@@ -1134,7 +1134,7 @@ pseudotcp_compatibility (void)
pseudo_tcp_socket_close (data.right, FALSE); pseudo_tcp_socket_close (data.right, FALSE);
g_assert (!pseudo_tcp_socket_get_next_clock (data.right, &timeout)); g_assert_true (!pseudo_tcp_socket_get_next_clock (data.right, &timeout));
expect_sockets_closed (&data); expect_sockets_closed (&data);
......
...@@ -119,7 +119,7 @@ write_to_sock (PseudoTcpSocket *sock) ...@@ -119,7 +119,7 @@ write_to_sock (PseudoTcpSocket *sock)
len = fread (buf, 1, sizeof(buf), in); len = fread (buf, 1, sizeof(buf), in);
if (len == 0) { if (len == 0) {
g_debug ("Done reading data from file"); g_debug ("Done reading data from file");
g_assert (feof (in)); g_assert_true (feof (in));
reading_done = TRUE; reading_done = TRUE;
pseudo_tcp_socket_close (sock, FALSE); pseudo_tcp_socket_close (sock, FALSE);
break; break;
...@@ -131,7 +131,7 @@ write_to_sock (PseudoTcpSocket *sock) ...@@ -131,7 +131,7 @@ write_to_sock (PseudoTcpSocket *sock)
if (wlen < (gint) len) { if (wlen < (gint) len) {
g_debug ("seeking %" G_GSIZE_FORMAT " from %lu", wlen - len, ftell (in)); g_debug ("seeking %" G_GSIZE_FORMAT " from %lu", wlen - len, ftell (in));
fseek (in, wlen - len, SEEK_CUR); fseek (in, wlen - len, SEEK_CUR);
g_assert (!feof (in)); g_assert_true (!feof (in));
g_debug ("Socket queue full after %d bytes written", total); g_debug ("Socket queue full after %d bytes written", total);
break; break;
} }
...@@ -176,7 +176,7 @@ readable (PseudoTcpSocket *sock, gpointer data) ...@@ -176,7 +176,7 @@ readable (PseudoTcpSocket *sock, gpointer data)
g_assert_cmpint (total_wrote, <=, total_read); g_assert_cmpint (total_wrote, <=, total_read);
g_debug ("Written %d bytes, need %d bytes", total_wrote, total_read); g_debug ("Written %d bytes, need %d bytes", total_wrote, total_read);
if (total_wrote == total_read && feof (in)) { if (total_wrote == total_read && feof (in)) {
g_assert (reading_done); g_assert_true (reading_done);
pseudo_tcp_socket_close (sock, FALSE); pseudo_tcp_socket_close (sock, FALSE);
} }
} }
......
...@@ -71,7 +71,7 @@ static void write_to_sock (PseudoTcpSocket *sock) ...@@ -71,7 +71,7 @@ static void write_to_sock (PseudoTcpSocket *sock)
len = fread (buf, 1, sizeof(buf), in); len = fread (buf, 1, sizeof(buf), in);
if (len == 0) { if (len == 0) {
g_debug ("Done reading data from file"); g_debug ("Done reading data from file");
g_assert (feof (in)); g_assert_true (feof (in));
reading_done = TRUE; reading_done = TRUE;
pseudo_tcp_socket_close (sock, FALSE); pseudo_tcp_socket_close (sock, FALSE);
break; break;
...@@ -84,7 +84,7 @@ static void write_to_sock (PseudoTcpSocket *sock) ...@@ -84,7 +84,7 @@ static void write_to_sock (PseudoTcpSocket *sock)
g_debug ("seeking %" G_GSIZE_FORMAT " from %lu", wlen - len, g_debug ("seeking %" G_GSIZE_FORMAT " from %lu", wlen - len,
ftell (in)); ftell (in));
fseek (in, wlen - len, SEEK_CUR); fseek (in, wlen - len, SEEK_CUR);
g_assert (!feof (in)); g_assert_true (!feof (in));
g_debug ("Socket queue full after %d bytes written", total); g_debug ("Socket queue full after %d bytes written", total);
break; break;
} }
...@@ -127,7 +127,7 @@ static void readable (PseudoTcpSocket *sock, gpointer data) ...@@ -127,7 +127,7 @@ static void readable (PseudoTcpSocket *sock, gpointer data)
g_assert_cmpint (total_wrote, <=, total_read); g_assert_cmpint (total_wrote, <=, total_read);
g_debug ("Written %d bytes, need %d bytes", total_wrote, total_read); g_debug ("Written %d bytes, need %d bytes", total_wrote, total_read);
if (total_wrote == total_read && feof (in)) { if (total_wrote == total_read && feof (in)) {
g_assert (reading_done); g_assert_true (reading_done);
pseudo_tcp_socket_close (sock, FALSE); pseudo_tcp_socket_close (sock, FALSE);
} }
} }
......
...@@ -187,7 +187,7 @@ static void priv_get_local_addr (NiceAgent *agent, guint stream_id, guint compon ...@@ -187,7 +187,7 @@ static void priv_get_local_addr (NiceAgent *agent, guint stream_id, guint compon
for (i = cands; i; i = i->next) { for (i = cands; i; i = i->next) {
NiceCandidate *cand = i->data; NiceCandidate *cand = i->data;
if (cand) { if (cand) {
g_assert (dstaddr); g_assert_true (dstaddr);
*dstaddr = cand->addr; *dstaddr = cand->addr;
} }
} }
...@@ -252,8 +252,8 @@ static int run_restart_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress * ...@@ -252,8 +252,8 @@ static int run_restart_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *
global_ragent_gathering_done != TRUE) { global_ragent_gathering_done != TRUE) {
g_debug ("test-restart: Added streams, running mainloop until 'candidate-gathering-done'..."); g_debug ("test-restart: Added streams, running mainloop until 'candidate-gathering-done'...");
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
g_assert (global_lagent_gathering_done == TRUE); g_assert_true (global_lagent_gathering_done == TRUE);
g_assert (global_ragent_gathering_done == TRUE); g_assert_true (global_ragent_gathering_done == TRUE);
} }
/* step: find out the local candidates of each agent */ /* step: find out the local candidates of each agent */
...@@ -303,7 +303,7 @@ static int run_restart_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress * ...@@ -303,7 +303,7 @@ static int run_restart_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *
* here that the role cannot be externally modified after conncheck * here that the role cannot be externally modified after conncheck
* has started. */ * has started. */
g_object_set (G_OBJECT (ragent), "controlling-mode", TRUE, NULL); g_object_set (G_OBJECT (ragent), "controlling-mode", TRUE, NULL);
g_assert (ragent->controlling_mode == FALSE); g_assert_true (ragent->controlling_mode == FALSE);
g_debug ("test-restart: Set properties, next running mainloop until connectivity checks succeed..."); g_debug ("test-restart: Set properties, next running mainloop until connectivity checks succeed...");
...@@ -312,8 +312,8 @@ static int run_restart_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress * ...@@ -312,8 +312,8 @@ static int run_restart_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
/* note: verify that STUN binding requests were sent */ /* note: verify that STUN binding requests were sent */
g_assert (global_lagent_ibr_received == TRUE); g_assert_true (global_lagent_ibr_received == TRUE);
g_assert (global_ragent_ibr_received == TRUE); g_assert_true (global_ragent_ibr_received == TRUE);
/* note: verify that correct number of local candidates were reported */ /* note: verify that correct number of local candidates were reported */
g_assert_cmpint (global_lagent_cands, ==, 2); g_assert_cmpint (global_lagent_cands, ==, 2);
g_assert_cmpint (global_ragent_cands, ==, 2); g_assert_cmpint (global_ragent_cands, ==, 2);
...@@ -333,8 +333,8 @@ static int run_restart_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress * ...@@ -333,8 +333,8 @@ static int run_restart_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *
g_assert_cmpint (nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678"), ==, 16); g_assert_cmpint (nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678"), ==, 16);
/* Both agent have a distinct role at the end of the conncheck */ /* Both agent have a distinct role at the end of the conncheck */
g_assert (lagent->controlling_mode == TRUE); g_assert_true (lagent->controlling_mode == TRUE);
g_assert (ragent->controlling_mode == FALSE); g_assert_true (ragent->controlling_mode == FALSE);
/* step: restart agents, exchange updated credentials */ /* step: restart agents, exchange updated credentials */
nice_agent_restart (ragent); nice_agent_restart (ragent);
nice_agent_restart (lagent); nice_agent_restart (lagent);
...@@ -377,10 +377,10 @@ static int run_restart_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress * ...@@ -377,10 +377,10 @@ static int run_restart_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *
/* note: verify that payload was succesfully received */ /* note: verify that payload was succesfully received */
g_assert_cmpint (global_ragent_read, ==, 32); g_assert_cmpint (global_ragent_read, ==, 32);
/* note: verify binding requests were resent after restart */ /* note: verify binding requests were resent after restart */
g_assert (global_lagent_ibr_received == TRUE); g_assert_true (global_lagent_ibr_received == TRUE);
g_assert (global_ragent_ibr_received == TRUE); g_assert_true (global_ragent_ibr_received == TRUE);
/* note: verify that a role switch occured for one of the agents */ /* note: verify that a role switch occured for one of the agents */
g_assert (ragent->controlling_mode != lagent->controlling_mode); g_assert_true (ragent->controlling_mode != lagent->controlling_mode);
g_debug ("test-restart: Ran mainloop, removing streams..."); g_debug ("test-restart: Ran mainloop, removing streams...");
......
...@@ -501,7 +501,7 @@ validate_received_messages (TestIOStreamThreadData *data, gsize buffer_offset, ...@@ -501,7 +501,7 @@ validate_received_messages (TestIOStreamThreadData *data, gsize buffer_offset,
if (stream_api_is_blocking (test_data->stream_api) && data->reliable) if (stream_api_is_blocking (test_data->stream_api) && data->reliable)
g_assert_cmpuint (message->length, ==, total_buf_len); g_assert_cmpuint (message->length, ==, total_buf_len);
g_assert (message->from == NULL); g_assert_true (message->from == NULL);
} }
/* Free all messages. */ /* Free all messages. */
......
...@@ -56,14 +56,14 @@ int main (int argc, char **argv) ...@@ -56,14 +56,14 @@ int main (int argc, char **argv)
nice_agent_set_port_range (agent, stream1, 2, 8888, 8888); nice_agent_set_port_range (agent, stream1, 2, 8888, 8888);
/* First test with ICE-TCP enabled, this should fail on creating the port */ /* First test with ICE-TCP enabled, this should fail on creating the port */
g_assert (nice_agent_gather_candidates (agent, stream1) == FALSE); g_assert_true (nice_agent_gather_candidates (agent, stream1) == FALSE);
/* First test with ICE-TCP disabled, this should fail on our explicit test */ /* First test with ICE-TCP disabled, this should fail on our explicit test */
g_object_set (agent, "ice-tcp", FALSE, NULL); g_object_set (agent, "ice-tcp", FALSE, NULL);
g_assert (nice_agent_gather_candidates (agent, stream1) == FALSE); g_assert_true (nice_agent_gather_candidates (agent, stream1) == FALSE);
nice_agent_set_port_range (agent, stream1, 2, 9999, 9999); nice_agent_set_port_range (agent, stream1, 2, 9999, 9999);
g_assert (nice_agent_gather_candidates (agent, stream1)); g_assert_true (nice_agent_gather_candidates (agent, stream1));
g_object_unref (agent); g_object_unref (agent);
......
...@@ -45,37 +45,37 @@ static NiceSocket *udp_turn_over_tcp; ...@@ -45,37 +45,37 @@ static NiceSocket *udp_turn_over_tcp;
static void static void
socket_base_udp_bsd (void) socket_base_udp_bsd (void)
{ {
g_assert (nice_socket_is_based_on (udp_bsd, udp_bsd)); g_assert_true (nice_socket_is_based_on (udp_bsd, udp_bsd));
g_assert (!nice_socket_is_based_on (udp_bsd, tcp_active)); g_assert_true (!nice_socket_is_based_on (udp_bsd, tcp_active));
g_assert (!nice_socket_is_based_on (udp_bsd, pseudossl)); g_assert_true (!nice_socket_is_based_on (udp_bsd, pseudossl));
g_assert (!nice_socket_is_based_on (udp_bsd, udp_turn_over_tcp)); g_assert_true (!nice_socket_is_based_on (udp_bsd, udp_turn_over_tcp));
} }
static void static void
socket_base_tcp_active (void) socket_base_tcp_active (void)
{ {
g_assert (!nice_socket_is_based_on (tcp_active, udp_bsd)); g_assert_true (!nice_socket_is_based_on (tcp_active, udp_bsd));
g_assert (nice_socket_is_based_on (tcp_active, tcp_active)); g_assert_true (nice_socket_is_based_on (tcp_active, tcp_active));
g_assert (!nice_socket_is_based_on (tcp_active, pseudossl)); g_assert_true (!nice_socket_is_based_on (tcp_active, pseudossl));
g_assert (!nice_socket_is_based_on (tcp_active, udp_turn_over_tcp)); g_assert_true (!nice_socket_is_based_on (tcp_active, udp_turn_over_tcp));
} }
static void static void
socket_base_pseudossl (void) socket_base_pseudossl (void)
{ {
g_assert (!nice_socket_is_based_on (pseudossl, udp_bsd)); g_assert_true (!nice_socket_is_based_on (pseudossl, udp_bsd));
g_assert (nice_socket_is_based_on (pseudossl, tcp_active)); g_assert_true (nice_socket_is_based_on (pseudossl, tcp_active));
g_assert (nice_socket_is_based_on (pseudossl, pseudossl)); g_assert_true (nice_socket_is_based_on (pseudossl, pseudossl));
g_assert (!nice_socket_is_based_on (pseudossl, udp_turn_over_tcp)); g_assert_true (!nice_socket_is_based_on (pseudossl, udp_turn_over_tcp));
} }
static void static void
socket_base_udp_turn_over_tcp (void) socket_base_udp_turn_over_tcp (void)
{ {
g_assert (!nice_socket_is_based_on (udp_turn_over_tcp, udp_bsd)); g_assert_true (!nice_socket_is_based_on (udp_turn_over_tcp, udp_bsd));
g_assert (nice_socket_is_based_on (udp_turn_over_tcp, tcp_active)); g_assert_true (nice_socket_is_based_on (udp_turn_over_tcp, tcp_active));
g_assert (nice_socket_is_based_on (udp_turn_over_tcp, pseudossl)); g_assert_true (nice_socket_is_based_on (udp_turn_over_tcp, pseudossl));
g_assert (nice_socket_is_based_on (udp_turn_over_tcp, udp_turn_over_tcp)); g_assert_true (nice_socket_is_based_on (udp_turn_over_tcp, udp_turn_over_tcp));
} }
int int
......
...@@ -52,7 +52,7 @@ static gboolean ...@@ -52,7 +52,7 @@ static gboolean
on_server_connection_available (gpointer user_data) on_server_connection_available (gpointer user_data)
{ {
server = nice_tcp_passive_socket_accept (passive_sock); server = nice_tcp_passive_socket_accept (passive_sock);
g_assert (server); g_assert_true (server);
g_main_loop_quit (mainloop); g_main_loop_quit (mainloop);
...@@ -63,7 +63,7 @@ static gboolean ...@@ -63,7 +63,7 @@ static gboolean
on_server_input_available (gpointer user_data) on_server_input_available (gpointer user_data)
{ {
g_assert_cmpint (5, ==, nice_socket_recv (server, &tmp, 5, buf)); g_assert_cmpint (5, ==, nice_socket_recv (server, &tmp, 5, buf));
g_assert (nice_address_equal (&tmp, &client->addr)); g_assert_true (nice_address_equal (&tmp, &client->addr));
g_main_loop_quit (mainloop); g_main_loop_quit (mainloop);
...@@ -74,7 +74,7 @@ static gboolean ...@@ -74,7 +74,7 @@ static gboolean
on_client_input_available (gpointer user_data) on_client_input_available (gpointer user_data)
{ {
g_assert_cmpint (5, ==, nice_socket_recv (client, &tmp, 5, buf)); g_assert_cmpint (5, ==, nice_socket_recv (client, &tmp, 5, buf));
g_assert (nice_address_equal (&tmp, &server->addr)); g_assert_true (nice_address_equal (&tmp, &server->addr));
g_main_loop_quit (mainloop); g_main_loop_quit (mainloop);
...@@ -93,10 +93,10 @@ main (void) ...@@ -93,10 +93,10 @@ main (void)
mainloop = g_main_loop_new (NULL, FALSE); mainloop = g_main_loop_new (NULL, FALSE);
nice_address_init (&active_bind_addr); nice_address_init (&active_bind_addr);
g_assert (nice_address_set_from_string (&active_bind_addr, "::1")); g_assert_true (nice_address_set_from_string (&active_bind_addr, "::1"));
nice_address_init (&passive_bind_addr); nice_address_init (&passive_bind_addr);
g_assert (nice_address_set_from_string (&passive_bind_addr, "127.0.0.1")); g_assert_true (nice_address_set_from_string (&passive_bind_addr, "127.0.0.1"));
nice_address_set_port (&passive_bind_addr, 0); nice_address_set_port (&passive_bind_addr, 0);
nice_address_init (&tmp); nice_address_init (&tmp);
...@@ -104,7 +104,7 @@ main (void) ...@@ -104,7 +104,7 @@ main (void)
passive_sock = nice_tcp_passive_socket_new (g_main_loop_get_context (mainloop), passive_sock = nice_tcp_passive_socket_new (g_main_loop_get_context (mainloop),
&passive_bind_addr, &error); &passive_bind_addr, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (passive_sock); g_assert_true (passive_sock);
srv_listen_source = g_socket_create_source (passive_sock->fileno, srv_listen_source = g_socket_create_source (passive_sock->fileno,
G_IO_IN, NULL); G_IO_IN, NULL);
...@@ -114,15 +114,15 @@ main (void) ...@@ -114,15 +114,15 @@ main (void)
active_sock = nice_tcp_active_socket_new (g_main_loop_get_context (mainloop), active_sock = nice_tcp_active_socket_new (g_main_loop_get_context (mainloop),
&active_bind_addr); &active_bind_addr);
g_assert (active_sock); g_assert_true (active_sock);
client = nice_tcp_active_socket_connect (active_sock, &passive_sock->addr); client = nice_tcp_active_socket_connect (active_sock, &passive_sock->addr);
g_assert (client); g_assert_true (client);
nice_socket_free (active_sock); nice_socket_free (active_sock);
active_sock = NULL; active_sock = NULL;
g_main_loop_run (mainloop); /* -> on_server_connection_available */ g_main_loop_run (mainloop); /* -> on_server_connection_available */
g_assert (server); g_assert_true (server);
srv_input_source = g_socket_create_source (server->fileno, G_IO_IN, NULL); srv_input_source = g_socket_create_source (server->fileno, G_IO_IN, NULL);
g_source_set_callback (srv_input_source, g_source_set_callback (srv_input_source,
...@@ -134,20 +134,20 @@ main (void) ...@@ -134,20 +134,20 @@ main (void)
on_client_input_available, NULL, NULL); on_client_input_available, NULL, NULL);
g_source_attach (cli_input_source, g_main_loop_get_context (mainloop)); g_source_attach (cli_input_source, g_main_loop_get_context (mainloop));
g_assert (nice_address_get_port (&client->addr) != 0); g_assert_true (nice_address_get_port (&client->addr) != 0);
g_assert (nice_address_set_from_string (&tmp, "127.0.0.1")); g_assert_true (nice_address_set_from_string (&tmp, "127.0.0.1"));
nice_address_set_port (&tmp, nice_address_get_port (&server->addr)); nice_address_set_port (&tmp, nice_address_get_port (&server->addr));
g_assert (nice_address_get_port (&tmp) != 0); g_assert_true (nice_address_get_port (&tmp) != 0);
g_assert_cmpint (5, ==, nice_socket_send (client, &tmp, 5, "hello")); g_assert_cmpint (5, ==, nice_socket_send (client, &tmp, 5, "hello"));
g_main_loop_run (mainloop); /* -> on_server_input_available */ g_main_loop_run (mainloop); /* -> on_server_input_available */
g_assert (0 == strncmp (buf, "hello", 5)); g_assert_true (0 == strncmp (buf, "hello", 5));
g_assert_cmpint (5, ==, nice_socket_send (server, &tmp, 5, "uryyb")); g_assert_cmpint (5, ==, nice_socket_send (server, &tmp, 5, "uryyb"));
g_main_loop_run (mainloop); /* -> on_client_input_available */ g_main_loop_run (mainloop); /* -> on_client_input_available */
g_assert (0 == strncmp (buf, "uryyb", 5)); g_assert_true (0 == strncmp (buf, "uryyb", 5));
nice_socket_free (client); nice_socket_free (client);
nice_socket_free (server); nice_socket_free (server);
......
...@@ -66,7 +66,7 @@ gint global_ragent_buffers = 0; ...@@ -66,7 +66,7 @@ gint global_ragent_buffers = 0;
g_main_context_iteration (context, FALSE); \ g_main_context_iteration (context, FALSE); \
} \ } \
\ \
g_assert (!(var)); \ g_assert_true (!(var)); \
} }
static gpointer static gpointer
...@@ -119,7 +119,7 @@ static void cb_candidate_gathering_done(NiceAgent *agent, guint stream_id, gpoin ...@@ -119,7 +119,7 @@ static void cb_candidate_gathering_done(NiceAgent *agent, guint stream_id, gpoin
g_free (password); g_free (password);
cands = nice_agent_get_local_candidates(agent, id, 1); cands = nice_agent_get_local_candidates(agent, id, 1);
g_assert (cands != NULL); g_assert_true (cands != NULL);
nice_agent_set_remote_candidates (other, other_id, 1, cands); nice_agent_set_remote_candidates (other, other_id, 1, cands);
...@@ -263,12 +263,12 @@ int main (void) ...@@ -263,12 +263,12 @@ int main (void)
guint port = 0; guint port = 0;
gboolean mode = FALSE; gboolean mode = FALSE;
g_object_get (G_OBJECT (lagent), "stun-server", &string, NULL); g_object_get (G_OBJECT (lagent), "stun-server", &string, NULL);
g_assert (stun_server == NULL || strcmp (string, stun_server) == 0); g_assert_true (stun_server == NULL || strcmp (string, stun_server) == 0);
g_free (string); g_free (string);
g_object_get (G_OBJECT (lagent), "stun-server-port", &port, NULL); g_object_get (G_OBJECT (lagent), "stun-server-port", &port, NULL);
g_assert (stun_server_port == NULL || port == (guint)atoi (stun_server_port)); g_assert_true (stun_server_port == NULL || port == (guint)atoi (stun_server_port));
g_object_get (G_OBJECT (lagent), "controlling-mode", &mode, NULL); g_object_get (G_OBJECT (lagent), "controlling-mode", &mode, NULL);
g_assert (mode == TRUE); g_assert_true (mode == TRUE);
g_object_set (G_OBJECT (lagent), "max-connectivity-checks", 300, NULL); g_object_set (G_OBJECT (lagent), "max-connectivity-checks", 300, NULL);
g_object_get (G_OBJECT (lagent), "max-connectivity-checks", &max_checks, NULL); g_object_get (G_OBJECT (lagent), "max-connectivity-checks", &max_checks, NULL);
g_assert_cmpuint (max_checks, ==, 300); g_assert_cmpuint (max_checks, ==, 300);
...@@ -280,8 +280,8 @@ int main (void) ...@@ -280,8 +280,8 @@ int main (void)
lthread = g_thread_new ("lthread libnice", mainloop_thread, lmainloop); lthread = g_thread_new ("lthread libnice", mainloop_thread, lmainloop);
rthread = g_thread_new ("rthread libnice", mainloop_thread, rmainloop); rthread = g_thread_new ("rthread libnice", mainloop_thread, rmainloop);
g_assert (lthread); g_assert_true (lthread);
g_assert (rthread); g_assert_true (rthread);
ls_id = nice_agent_add_stream (lagent, 2); ls_id = nice_agent_add_stream (lagent, 2);
rs_id = nice_agent_add_stream (ragent, 2); rs_id = nice_agent_add_stream (ragent, 2);
...@@ -302,8 +302,8 @@ int main (void) ...@@ -302,8 +302,8 @@ int main (void)
ldthread = g_thread_new ("ldthread libnice", mainloop_thread, ldmainloop); ldthread = g_thread_new ("ldthread libnice", mainloop_thread, ldmainloop);
rdthread = g_thread_new ("rdthread libnice", mainloop_thread, rdmainloop); rdthread = g_thread_new ("rdthread libnice", mainloop_thread, rdmainloop);
g_assert (ldthread); g_assert_true (ldthread);
g_assert (rdthread); g_assert_true (rdthread);
g_debug ("ragent_buffers: %d lagent_buffers: %d", global_lagent_buffers, g_debug ("ragent_buffers: %d lagent_buffers: %d", global_lagent_buffers,
global_ragent_buffers); global_ragent_buffers);
......
...@@ -311,8 +311,8 @@ int main (void) ...@@ -311,8 +311,8 @@ int main (void)
global_ragent_gathering_done != TRUE) { global_ragent_gathering_done != TRUE) {
g_debug ("test-trickle: Added streams, running mainloop until 'candidate-gathering-done'..."); g_debug ("test-trickle: Added streams, running mainloop until 'candidate-gathering-done'...");
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
g_assert (global_lagent_gathering_done == TRUE); g_assert_true (global_lagent_gathering_done == TRUE);
g_assert (global_ragent_gathering_done == TRUE); g_assert_true (global_ragent_gathering_done == TRUE);
} }
{ {
...@@ -349,7 +349,7 @@ int main (void) ...@@ -349,7 +349,7 @@ int main (void)
g_main_loop_run (global_mainloop); g_main_loop_run (global_mainloop);
/* note: verify that STUN binding requests were sent */ /* note: verify that STUN binding requests were sent */
g_assert (global_lagent_ibr_received == TRUE); g_assert_true (global_lagent_ibr_received == TRUE);
g_assert_cmpint (global_ragent_ibr_received, ==, TRUE); g_assert_cmpint (global_ragent_ibr_received, ==, TRUE);
g_assert_cmpint (global_lagent_state, ==, NICE_COMPONENT_STATE_READY); g_assert_cmpint (global_lagent_state, ==, NICE_COMPONENT_STATE_READY);
......
...@@ -85,7 +85,7 @@ static void cb_component_state_changed (NiceAgent *agent, guint stream_id, guint ...@@ -85,7 +85,7 @@ static void cb_component_state_changed (NiceAgent *agent, guint stream_id, guint
global_components_ready++; global_components_ready++;
else if (state == NICE_COMPONENT_STATE_CONNECTED && ready_to_connected) else if (state == NICE_COMPONENT_STATE_CONNECTED && ready_to_connected)
global_components_ready--; global_components_ready--;
g_assert (state != NICE_COMPONENT_STATE_FAILED); g_assert_true (state != NICE_COMPONENT_STATE_FAILED);
g_debug ("test-turn: checks READY %u.", global_components_ready); g_debug ("test-turn: checks READY %u.", global_components_ready);
} }
...@@ -222,13 +222,13 @@ run_test(guint turn_port, gboolean is_ipv6, ...@@ -222,13 +222,13 @@ run_test(guint turn_port, gboolean is_ipv6,
nice_agent_set_relay_info(ragent, rs_id, 1, nice_agent_set_relay_info(ragent, rs_id, 1,
localhost, turn_port, TURN_USER, TURN_PASS, turn_type); localhost, turn_port, TURN_USER, TURN_PASS, turn_type);
g_assert (global_lagent_gathering_done == FALSE); g_assert_true (global_lagent_gathering_done == FALSE);
g_assert (global_ragent_gathering_done == FALSE); g_assert_true (global_ragent_gathering_done == FALSE);
g_debug ("test-turn: Added streams, running context until 'candidate-gathering-done'..."); g_debug ("test-turn: Added streams, running context until 'candidate-gathering-done'...");
/* Gather candidates and test nice_agent_set_port_range */ /* Gather candidates and test nice_agent_set_port_range */
g_assert (nice_agent_gather_candidates (lagent, ls_id) == TRUE); g_assert_true (nice_agent_gather_candidates (lagent, ls_id) == TRUE);
g_assert (nice_agent_gather_candidates (ragent, rs_id) == TRUE); g_assert_true (nice_agent_gather_candidates (ragent, rs_id) == TRUE);
nice_agent_attach_recv (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, nice_agent_attach_recv (lagent, ls_id, NICE_COMPONENT_TYPE_RTP,
g_main_context_default (), cb_nice_recv, GUINT_TO_POINTER (1)); g_main_context_default (), cb_nice_recv, GUINT_TO_POINTER (1));
...@@ -237,10 +237,10 @@ run_test(guint turn_port, gboolean is_ipv6, ...@@ -237,10 +237,10 @@ run_test(guint turn_port, gboolean is_ipv6,
while (!global_lagent_gathering_done) while (!global_lagent_gathering_done)
g_main_context_iteration (NULL, TRUE); g_main_context_iteration (NULL, TRUE);
g_assert (global_lagent_gathering_done == TRUE); g_assert_true (global_lagent_gathering_done == TRUE);
while (!global_ragent_gathering_done) while (!global_ragent_gathering_done)
g_main_context_iteration (NULL, TRUE); g_main_context_iteration (NULL, TRUE);
g_assert (global_ragent_gathering_done == TRUE); g_assert_true (global_ragent_gathering_done == TRUE);
set_credentials (lagent, ls_id, ragent, rs_id); set_credentials (lagent, ls_id, ragent, rs_id);
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
g_main_context_iteration (context, FALSE); \ g_main_context_iteration (context, FALSE); \
} \ } \
\ \
g_assert (!(var)); \ g_assert_true (!(var)); \
} }
gint gint
...@@ -76,21 +76,21 @@ main (void) ...@@ -76,21 +76,21 @@ main (void)
nice_address_init (&addr_local); nice_address_init (&addr_local);
nice_address_init (&addr_remote); nice_address_init (&addr_remote);
g_assert (nice_address_set_from_string (&addr_local, "127.0.0.1")); g_assert_true (nice_address_set_from_string (&addr_local, "127.0.0.1"));
g_assert (nice_address_set_from_string (&addr_remote, "127.0.0.1")); g_assert_true (nice_address_set_from_string (&addr_remote, "127.0.0.1"));
nice_address_set_port (&addr_remote, 2345); nice_address_set_port (&addr_remote, 2345);
agent = nice_agent_new ( NULL, NICE_COMPATIBILITY_RFC5245); agent = nice_agent_new ( NULL, NICE_COMPATIBILITY_RFC5245);
g_object_set (G_OBJECT (agent), "ice-tcp", FALSE, NULL); g_object_set (G_OBJECT (agent), "ice-tcp", FALSE, NULL);
g_assert (agent->local_addresses == NULL); g_assert_true (agent->local_addresses == NULL);
/* add one local address */ /* add one local address */
nice_agent_add_local_address (agent, &addr_local); nice_agent_add_local_address (agent, &addr_local);
g_assert (agent->local_addresses != NULL); g_assert_true (agent->local_addresses != NULL);
g_assert_cmpuint (g_slist_length (agent->local_addresses), ==, 1); g_assert_cmpuint (g_slist_length (agent->local_addresses), ==, 1);
g_assert (nice_address_equal (agent->local_addresses->data, &addr_local)); g_assert_true (nice_address_equal (agent->local_addresses->data, &addr_local));
/* add a stream */ /* add a stream */
stream_id = nice_agent_add_stream (agent, 1); stream_id = nice_agent_add_stream (agent, 1);
...@@ -103,8 +103,8 @@ main (void) ...@@ -103,8 +103,8 @@ main (void)
/* socket manager uses random port number */ /* socket manager uses random port number */
nice_address_set_port (&addr_local, 1); nice_address_set_port (&addr_local, 1);
nice_address_set_port (&(candidate->addr), 1); nice_address_set_port (&(candidate->addr), 1);
g_assert (nice_address_equal (&(candidate->addr), &addr_local)); g_assert_true (nice_address_equal (&(candidate->addr), &addr_local));
g_assert (strncmp (candidate->foundation, "1", 1) == 0); g_assert_true (strncmp (candidate->foundation, "1", 1) == 0);
for (i = candidates; i; i = i->next) for (i = candidates; i; i = i->next)
nice_candidate_free ((NiceCandidate *) i->data); nice_candidate_free ((NiceCandidate *) i->data);
g_slist_free (candidates); g_slist_free (candidates);
......
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