Commit 1da0537b authored by Olivier Crête's avatar Olivier Crête 👻
Browse files

Use g_assert_cmp.int() to get better debug logs on crash

parent d6317167
Pipeline #142530 failed with stages
in 8 minutes and 56 seconds
......@@ -4178,7 +4178,7 @@ agent_recv_message_unlocked (
retval = sockret;
}
g_assert (retval != RECV_OOB);
g_assert_cmpint (retval, !=, RECV_OOB);
if (message->length == 0) {
retval = RECV_OOB;
nice_debug_verbose ("%s: Agent %p: message handled out-of-band", G_STRFUNC,
......@@ -4608,7 +4608,7 @@ pending_io_messages_recv_messages (NiceComponent *component, gboolean reliable,
IOCallbackData *data;
NiceInputMessage *message = &messages[iter->message];
g_assert (component->io_callback_id == 0);
g_assert_cmpuint (component->io_callback_id, ==, 0);
data = g_queue_peek_head (&component->pending_io_messages);
if (data == NULL)
......@@ -5161,7 +5161,7 @@ nice_agent_send_messages_nonblocking_internal (
g_set_error (&child_error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Error writing data to socket.");
} else if (n_sent > 0 && allow_partial) {
g_assert (n_messages == 1);
g_assert_cmpuint (n_messages, ==, 1);
n_sent = output_message_get_size (messages);
}
}
......@@ -5182,7 +5182,7 @@ nice_agent_send_messages_nonblocking_internal (
done:
g_assert ((child_error != NULL) == (n_sent == -1));
g_assert (n_sent != 0);
g_assert_cmpint (n_sent, !=, 0);
g_assert (n_sent < 0 ||
(!allow_partial && (guint) n_sent <= n_messages) ||
(allow_partial && n_messages == 1 &&
......@@ -5615,8 +5615,8 @@ component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data)
RecvStatus retval;
/* Don’t want to trample over partially-valid buffers. */
g_assert (component->recv_messages_iter.buffer == 0);
g_assert (component->recv_messages_iter.offset == 0);
g_assert_cmpuint (component->recv_messages_iter.buffer, ==, 0);
g_assert_cmpint (component->recv_messages_iter.offset, ==, 0);
while (!nice_input_message_iter_is_at_end (&component->recv_messages_iter,
component->recv_messages, component->n_recv_messages)) {
......
......@@ -147,9 +147,9 @@ nice_candidate_ice_local_preference_full (guint direction_preference,
* 9-12: <unused>
* 13-15: direction_preference
*/
g_assert (other_preference < NICE_CANDIDATE_MAX_LOCAL_ADDRESSES);
g_assert (turn_preference < NICE_CANDIDATE_MAX_TURN_SERVERS);
g_assert (direction_preference < 8);
g_assert_cmpuint (other_preference, <, NICE_CANDIDATE_MAX_LOCAL_ADDRESSES);
g_assert_cmpuint (turn_preference, <, NICE_CANDIDATE_MAX_TURN_SERVERS);
g_assert_cmpuint (direction_preference, <, 8);
return (direction_preference << 13) +
(turn_preference << 6) +
......@@ -253,10 +253,10 @@ nice_candidate_ms_ice_local_preference_full (guint transport_preference,
* 9-11: direction_preference
* 12-15: transport_preference
*/
g_assert (other_preference < NICE_CANDIDATE_MAX_LOCAL_ADDRESSES);
g_assert (turn_preference < NICE_CANDIDATE_MAX_TURN_SERVERS);
g_assert (direction_preference < 8);
g_assert (transport_preference < 16);
g_assert_cmpuint (other_preference, <, NICE_CANDIDATE_MAX_LOCAL_ADDRESSES);
g_assert_cmpuint (turn_preference, <, NICE_CANDIDATE_MAX_TURN_SERVERS);
g_assert_cmpuint (direction_preference, <, 8);
g_assert_cmpuint (transport_preference, <, 16);
return (transport_preference << 12) +
(direction_preference << 9) +
......
......@@ -944,8 +944,8 @@ nice_component_emit_io_callback (NiceAgent *agent, NiceComponent *component,
return;
g_assert (NICE_IS_AGENT (agent));
g_assert (stream_id > 0);
g_assert (component_id > 0);
g_assert_cmpuint (stream_id, >, 0);
g_assert_cmpuint (component_id, >, 0);
g_assert (io_callback != NULL);
/* Only allocate a closure if the callback is being deferred to an idle
......
......@@ -600,9 +600,9 @@ static void priv_conn_check_unfreeze_related (NiceAgent *agent, NiceStream *stre
GSList *i, *j;
g_assert (ok_check);
g_assert (ok_check->state == NICE_CHECK_SUCCEEDED);
g_assert_cmpint (ok_check->state, ==, NICE_CHECK_SUCCEEDED);
g_assert (stream);
g_assert (stream->id == ok_check->stream_id);
g_assert_cmpuint (stream->id, ==, ok_check->stream_id);
priv_print_conn_check_lists (agent, G_STRFUNC, NULL);
......@@ -1073,10 +1073,10 @@ priv_conn_check_tick_stream_nominate (NiceStream *stream, NiceAgent *agent)
* to test its parent pair instead.
*/
if (p->succeeded_pair != NULL) {
g_assert (p->state == NICE_CHECK_DISCOVERED);
g_assert_cmpint (p->state, ==, NICE_CHECK_DISCOVERED);
p = p->succeeded_pair;
}
g_assert (p->state == NICE_CHECK_SUCCEEDED);
g_assert_cmpint (p->state, ==, NICE_CHECK_SUCCEEDED);
if (this_component_pair == NULL)
/* highest priority pair */
......@@ -2262,7 +2262,7 @@ static void priv_update_check_list_failed_components (NiceAgent *agent, NiceStre
for (i = stream->conncheck_list; i; i = i->next) {
CandidateCheckPair *p = i->data;
g_assert (p->stream_id == stream->id);
g_assert_cmpuint (p->stream_id, ==, stream->id);
if (p->component_id == (c + 1)) {
if (p->nominated)
......@@ -2367,7 +2367,7 @@ static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, Nice
if (pair->state == NICE_CHECK_SUCCEEDED &&
pair->discovered_pair != NULL) {
pair = pair->discovered_pair;
g_assert (pair->state == NICE_CHECK_DISCOVERED);
g_assert_cmpint (pair->state, ==, NICE_CHECK_DISCOVERED);
}
/* If the state of this pair is In-Progress, [...] the resulting
......@@ -3181,7 +3181,7 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *str
* was FAILED when a peer-reflexive pair was created */
if (p->succeeded_pair != NULL) {
g_assert (p->state == NICE_CHECK_DISCOVERED);
g_assert_cmpint (p->state, ==, NICE_CHECK_DISCOVERED);
p = p->succeeded_pair;
}
......
......@@ -466,7 +466,7 @@ nice_output_stream_write (GOutputStream *stream, const void *buffer, gsize count
write_data_unref (write_data);
g_object_unref (agent);
g_assert (len != 0);
g_assert_cmpint (len, !=, 0);
return len;
}
......
......@@ -328,7 +328,7 @@ pseudo_tcp_fifo_set_capacity (PseudoTcpFifo *b, gsize size)
static void
pseudo_tcp_fifo_consume_read_data (PseudoTcpFifo *b, gsize size)
{
g_assert (size <= b->data_length);
g_assert_cmpint (size, <=, b->data_length);
b->read_position = (b->read_position + size) % b->buffer_length;
b->data_length -= size;
......@@ -337,7 +337,7 @@ pseudo_tcp_fifo_consume_read_data (PseudoTcpFifo *b, gsize size)
static void
pseudo_tcp_fifo_consume_write_buffer (PseudoTcpFifo *b, gsize size)
{
g_assert (size <= b->buffer_length - b->data_length);
g_assert_cmpint (size, <=, b->buffer_length - b->data_length);
b->data_length += size;
}
......@@ -1376,7 +1376,7 @@ queue (PseudoTcpSocket *self, const gchar * data, guint32 len, TcpFlags flags)
available_space = pseudo_tcp_fifo_get_write_remaining (&priv->sbuf);
if (len > available_space) {
g_assert (flags == FLAG_NONE);
g_assert_cmpint (flags, ==, FLAG_NONE);
len = available_space;
}
......@@ -1422,7 +1422,7 @@ packet(PseudoTcpSocket *self, guint32 seq, TcpFlags flags,
} buffer;
PseudoTcpWriteResult wres = WR_SUCCESS;
g_assert(HEADER_SIZE + len <= MAX_PACKET);
g_assert_cmpuint (HEADER_SIZE + len, <=, MAX_PACKET);
*buffer.u32 = htonl(priv->conv);
*(buffer.u32 + 1) = htonl(seq);
......@@ -1441,7 +1441,7 @@ packet(PseudoTcpSocket *self, guint32 seq, TcpFlags flags,
bytes_read = pseudo_tcp_fifo_read_offset (&priv->sbuf, buffer.u8 + HEADER_SIZE,
len, offset);
g_assert (bytes_read == len);
g_assert_cmpint (bytes_read, ==, len);
}
DEBUG (PSEUDO_TCP_DEBUG_VERBOSE, "Sending <CONV=%u><FLG=%u><SEQ=%u:%u><ACK=%u>"
......@@ -1713,7 +1713,7 @@ process(PseudoTcpSocket *self, Segment *seg)
for (nFree = nAcked; nFree > 0; ) {
SSegment *data;
g_assert(g_queue_get_length (&priv->slist) != 0);
g_assert_cmpuint (g_queue_get_length (&priv->slist), !=, 0);
data = (SSegment *) g_queue_peek_head (&priv->slist);
if (nFree < data->len) {
......@@ -1995,7 +1995,7 @@ process(PseudoTcpSocket *self, Segment *seg)
res = pseudo_tcp_fifo_write_offset (&priv->rbuf, (guint8 *) seg->data,
seg->len, nOffset);
g_assert (res == seg->len);
g_assert_cmpint (res, ==, seg->len);
if (seg->seq == priv->rcv_nxt) {
GList *iter = NULL;
......@@ -2091,7 +2091,7 @@ transmit(PseudoTcpSocket *self, SSegment *segment, guint32 now)
return ECONNABORTED; /* FIXME: This error code doesn’t quite seem right */
}
g_assert(wres == WR_TOO_LARGE);
g_assert_cmpint (wres, ==, WR_TOO_LARGE);
while (TRUE) {
if (PACKET_MAXIMUMS[priv->msslevel + 1] == 0) {
......@@ -2495,7 +2495,7 @@ resize_receive_buffer (PseudoTcpSocket *self, guint32 new_size)
// buffer. This should always be true because this method is called either
// before connection is established or when peers are exchanging connect
// messages.
g_assert(result);
g_assert (result);
priv->rbuf_len = new_size;
priv->rwnd_scale = scale_factor;
priv->ssthresh = new_size;
......
......@@ -226,7 +226,7 @@ fill_vectors (GOutputVector * vecs, GstMapInfo * maps, guint n, GstBuffer * buf)
gsize size = 0;
guint i;
g_assert (gst_buffer_n_memory (buf) == n);
g_assert_cmpuint (gst_buffer_n_memory (buf), ==, n);
for (i = 0; i < n; ++i) {
mem = gst_buffer_peek_memory (buf, i);
......
......@@ -58,11 +58,11 @@ main (void)
nice_rng_generate_bytes_print (rng, TEST_RNGSIZE - 1, buf);
/* g_debug ("%s", buf); */
g_assert (0 == strcmp (buf, "sv1AD7DnJTVykXGYYM6BmnXuYRlZNIJUzQzF+PvASjYxzdTTOngBJ5/gfK0Xj+Ly3ciAAk1Fmo0RPEpq6f4BBnp5jm3LuSbAOj1M5qULEGEv/0DMk0oOPUj6XPN1VwxFpjAfFeAxykiwdDiqNwnVJ/AKyr6/X7C5i+je7DSujURybOp6BkKWroLCzQg2AmTuqz48oNeY9CDeirNwoITfIaC40Ds9OgEDtL8WN5tL4QYdVuZQ85219Thogk775GV"));
g_assert_cmpstr (buf, ==, "sv1AD7DnJTVykXGYYM6BmnXuYRlZNIJUzQzF+PvASjYxzdTTOngBJ5/gfK0Xj+Ly3ciAAk1Fmo0RPEpq6f4BBnp5jm3LuSbAOj1M5qULEGEv/0DMk0oOPUj6XPN1VwxFpjAfFeAxykiwdDiqNwnVJ/AKyr6/X7C5i+je7DSujURybOp6BkKWroLCzQg2AmTuqz48oNeY9CDeirNwoITfIaC40Ds9OgEDtL8WN5tL4QYdVuZQ85219Thogk775GV");
nice_rng_generate_bytes (rng, 4, buf);
buf[4] = 0;
g_assert (0 == strcmp (buf, "\x1f\x0d\x47\xb8"));
g_assert_cmpstr (buf, ==, "\x1f\x0d\x47\xb8");
nice_rng_free (rng);
return 0;
......
......@@ -203,7 +203,7 @@ socket_close (NiceSocket *sock)
static void
assert_ring_buffer_valid (HttpPriv *priv)
{
g_assert (priv->recv_buf_fill <= priv->recv_buf_length);
g_assert_cmpint (priv->recv_buf_fill, <=, priv->recv_buf_length);
g_assert (priv->recv_buf_pos == 0 ||
priv->recv_buf_pos < priv->recv_buf_length);
g_assert (priv->recv_buf_length == 0 || priv->recv_buf != NULL);
......
......@@ -333,7 +333,7 @@ nice_socket_queue_send (GQueue *send_queue, const NiceAddress *to,
offset += len;
}
g_assert (offset == tbs->length);
g_assert_cmpint (offset, ==, tbs->length);
}
}
......
......@@ -666,10 +666,10 @@ _socket_send_messages_wrapped (NiceSocket *sock, const NiceAddress *to,
guint i;
gint ret;
g_assert (n_messages == 1);
g_assert_cmpuint (n_messages, ==, 1);
message = &messages[0];
message_len = output_message_get_size (message);
g_assert (message_len <= G_MAXUINT16);
g_assert_cmpint (message_len, <=, G_MAXUINT16);
/* ICE-TCP requires that all packets be framed with RFC4571 */
......@@ -1239,7 +1239,7 @@ nice_udp_turn_socket_cache_realm_nonce_locked (NiceSocket *sock,
UdpTurnPriv *priv = sock->priv;
gconstpointer tmp;
g_assert (sock->type == NICE_SOCKET_TYPE_UDP_TURN);
g_assert_cmpint (sock->type, ==, NICE_SOCKET_TYPE_UDP_TURN);
g_free (priv->cached_realm);
priv->cached_realm = NULL;
......
......@@ -61,9 +61,9 @@ main (void)
agent = nice_agent_new (NULL, NICE_COMPATIBILITY_RFC5245);
nice_agent_add_local_address (agent, &addr);
g_assert (nice_agent_add_stream (agent, 1) == 1);
g_assert (nice_agent_add_stream (agent, 10) == 2);
g_assert (nice_agent_add_stream (agent, 2) == 3);
g_assert_cmpuint (nice_agent_add_stream (agent, 1), ==, 1);
g_assert_cmpuint (nice_agent_add_stream (agent, 10), ==, 2);
g_assert_cmpuint (nice_agent_add_stream (agent, 2), ==, 3);
g_assert (NULL != agent->streams);
......
......@@ -52,10 +52,10 @@ test_ipv4 (void)
nice_address_init (&addr);
nice_address_init (&other);
nice_address_set_ipv4 (&addr, 0x01020304);
g_assert (addr.s.ip4.sin_family == AF_INET);
g_assert_cmpint (addr.s.ip4.sin_family, ==, AF_INET);
nice_address_to_string (&addr, str);
g_assert (0 == strcmp (str, "1.2.3.4"));
g_assert_cmpstr (str, ==, "1.2.3.4");
nice_address_to_string (&addr, str);
......@@ -115,10 +115,10 @@ test_ipv6 (void)
"\x44\x55\x66\x77"
"\x88\x99\xaa\xbb"
"\xcc\xdd\xee\xff");
g_assert (addr.s.ip6.sin6_family == AF_INET6);
g_assert_cmpint (addr.s.ip6.sin6_family, ==, AF_INET6);
nice_address_to_string (&addr, str);
g_assert (0 == strcmp (str, "11:2233:4455:6677:8899:aabb:ccdd:eeff"));
g_assert_cmpstr (str, ==, "11:2233:4455:6677:8899:aabb:ccdd:eeff");
nice_address_set_port (&addr, 9876); /* in native byte order */
nice_address_set_from_string (&other, "11:2233:4455:6677:8899:aabb:ccdd:eeff");
......
......@@ -396,10 +396,10 @@ test_zero_length_reads_writes (NiceAddress *addr)
pollable_output_stream = G_POLLABLE_OUTPUT_STREAM (output_stream);
/* Check zero-length reads and writes complete immediately without error. */
g_assert (g_input_stream_read (input_stream, buf, 0, NULL, &error) == 0);
g_assert_cmpint (g_input_stream_read (input_stream, buf, 0, NULL, &error), ==, 0);
g_assert_no_error (error);
g_assert (g_output_stream_write (output_stream, buf, 0, NULL, &error) == 0);
g_assert_cmpint (g_output_stream_write (output_stream, buf, 0, NULL, &error), ==, 0);
g_assert_no_error (error);
g_assert (
......@@ -417,10 +417,10 @@ test_zero_length_reads_writes (NiceAddress *addr)
nice_agent_remove_stream (agent, stream_id);
g_assert (g_io_stream_is_closed (G_IO_STREAM (io_stream)));
g_assert (g_input_stream_read (input_stream, buf, 0, NULL, &error) == 0);
g_assert_cmpint (g_input_stream_read (input_stream, buf, 0, NULL, &error), ==, 0);
g_assert_no_error (error);
g_assert (g_output_stream_write (output_stream, buf, 0, NULL, &error) == 0);
g_assert_cmpint (g_output_stream_write (output_stream, buf, 0, NULL, &error), ==, 0);
g_assert_no_error (error);
g_assert (
......
......@@ -78,7 +78,7 @@ static void swap_candidates(NiceAgent *local, guint local_id, NiceAgent *remote,
g_debug ("test-credentials:%s", G_STRFUNC);
cands = nice_agent_get_local_candidates(local, local_id,
NICE_COMPONENT_TYPE_RTP);
g_assert(nice_agent_set_remote_candidates(remote, remote_id,
g_assert (nice_agent_set_remote_candidates(remote, remote_id,
NICE_COMPONENT_TYPE_RTP, cands));
g_slist_free_full (cands, (GDestroyNotify) nice_candidate_free);
......@@ -119,8 +119,8 @@ static void setup(NiceAgent *lagent, NiceAgent *ragent)
{
NiceAddress addr;
g_assert (nice_agent_add_stream (lagent, 1) == 1);
g_assert (nice_agent_add_stream (ragent, 1) == 1);
g_assert_cmpuint (nice_agent_add_stream (lagent, 1), ==, 1);
g_assert_cmpuint (nice_agent_add_stream (ragent, 1), ==, 1);
g_assert (NULL != lagent->streams);
g_assert (NULL != ragent->streams);
......@@ -182,8 +182,8 @@ int main (void)
nice_agent_set_local_credentials (lagent, 1, "unicorns", "awesome");
nice_agent_get_local_credentials (lagent, 1, &ufrag, &password);
g_assert (g_strcmp0("unicorns", ufrag) == 0);
g_assert (g_strcmp0("awesome", password) == 0);
g_assert_cmpstr ("unicorns", ==, ufrag);
g_assert_cmpstr ("awesome", ==, password);
g_free (ufrag);
g_free (password);
......
......@@ -121,7 +121,7 @@ int main (void)
timer_id = g_timeout_add (30000, timer_cb, NULL);
ls_id = nice_agent_add_stream (lagent, 2);
g_assert (ls_id > 0);
g_assert_cmpuint (ls_id, >, 0);
nice_agent_get_local_credentials(lagent, ls_id, &lufrag, &lpassword);
/* step: attach to mainloop (needed to register the fds) */
......@@ -134,11 +134,11 @@ int main (void)
if (ADD_2_STREAMS) {
rs_id_1 = nice_agent_add_stream (ragent, 2);
g_assert (rs_id_1 > 0);
g_assert_cmpuint (rs_id_1, >, 0);
nice_agent_get_local_credentials(ragent, rs_id_1, &rufrag1, &rpassword1);
rs_id_2 = nice_agent_add_stream (ragent, 2);
g_assert (rs_id_2 > 0);
g_assert_cmpuint (rs_id_2, >, 0);
nice_agent_get_local_credentials(ragent, rs_id_2, &rufrag2, &rpassword2);
nice_agent_set_remote_credentials (ragent, rs_id_2, lufrag, lpassword);
......@@ -171,7 +171,7 @@ int main (void)
g_main_loop_get_context (global_mainloop), cb_nice_recv, NULL);
} else {
rs_id_1 = nice_agent_add_stream (ragent, 2);
g_assert (rs_id_1 > 0);
g_assert_cmpuint (rs_id_1, >, 0);
nice_agent_get_local_credentials(ragent, rs_id_1, &rufrag1, &rpassword1);
nice_agent_set_remote_credentials (ragent, rs_id_1, lufrag, lpassword);
......
......@@ -307,8 +307,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
ls_id = nice_agent_add_stream (lagent, 2);
rs_id = nice_agent_add_stream (ragent, 2);
g_assert (ls_id > 0);
g_assert (rs_id > 0);
g_assert_cmpuint (ls_id, >, 0);
g_assert_cmpuint (rs_id, >, 0);
/* Gather candidates and test nice_agent_set_port_range */
nice_agent_set_port_range (lagent, ls_id, 1, 10000, 11000);
......@@ -329,41 +329,41 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
NiceCandidate *cand = NULL;
cands = nice_agent_get_local_candidates (lagent, ls_id, 1);
g_assert (g_slist_length (cands) == 1);
g_assert_cmpuint (g_slist_length (cands), ==, 1);
cand = cands->data;
g_assert (cand->type == NICE_CANDIDATE_TYPE_HOST);
g_assert (nice_address_get_port (&cand->addr) >= 10000);
g_assert (nice_address_get_port (&cand->addr) <= 11000);
g_assert_cmpint (cand->type, ==, NICE_CANDIDATE_TYPE_HOST);
g_assert_cmpuint (nice_address_get_port (&cand->addr), >=, 10000);
g_assert_cmpuint (nice_address_get_port (&cand->addr), <=, 11000);
for (i = cands; i; i = i->next)
nice_candidate_free ((NiceCandidate *) i->data);
g_slist_free (cands);
cands = nice_agent_get_local_candidates (lagent, ls_id, 2);
g_assert (g_slist_length (cands) == 1);
g_assert_cmpuint (g_slist_length (cands), ==, 1);
cand = cands->data;
g_assert (cand->type == NICE_CANDIDATE_TYPE_HOST);
g_assert (nice_address_get_port (&cand->addr) >= 11000);
g_assert (nice_address_get_port (&cand->addr) <= 12000);
g_assert_cmpuint (cand->type, ==, NICE_CANDIDATE_TYPE_HOST);
g_assert_cmpuint (nice_address_get_port (&cand->addr), >=, 11000);
g_assert_cmpuint (nice_address_get_port (&cand->addr), <=, 12000);
for (i = cands; i; i = i->next)
nice_candidate_free ((NiceCandidate *) i->data);
g_slist_free (cands);
cands = nice_agent_get_local_candidates (ragent, rs_id, 1);
g_assert (g_slist_length (cands) == 1);
g_assert_cmpuint (g_slist_length (cands), ==, 1);
cand = cands->data;
g_assert (cand->type == NICE_CANDIDATE_TYPE_HOST);
g_assert (nice_address_get_port (&cand->addr) >= 12000);
g_assert (nice_address_get_port (&cand->addr) <= 13000);
g_assert_cmpint (cand->type, ==, NICE_CANDIDATE_TYPE_HOST);
g_assert_cmpuint (nice_address_get_port (&cand->addr), >=, 12000);
g_assert_cmpuint (nice_address_get_port (&cand->addr), <=, 13000);
for (i = cands; i; i = i->next)
nice_candidate_free ((NiceCandidate *) i->data);
g_slist_free (cands);
cands = nice_agent_get_local_candidates (ragent, rs_id, 2);
g_assert (g_slist_length (cands) == 1);
g_assert_cmpuint (g_slist_length (cands), ==, 1);
cand = cands->data;
g_assert (cand->type == NICE_CANDIDATE_TYPE_HOST);
g_assert (nice_address_get_port (&cand->addr) >= 13000);
g_assert (nice_address_get_port (&cand->addr) <= 14000);
g_assert_cmpint (cand->type, ==, NICE_CANDIDATE_TYPE_HOST);
g_assert_cmpuint (nice_address_get_port (&cand->addr), >=, 13000);
g_assert_cmpuint (nice_address_get_port (&cand->addr), <=, 14000);
for (i = cands; i; i = i->next)
nice_candidate_free ((NiceCandidate *) i->data);
g_slist_free (cands);
......@@ -435,10 +435,10 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
ret = nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678");
g_assert (ret != -1);
g_debug ("Sent %d bytes", ret);
g_assert (ret == 16);
g_assert_cmpint (ret, ==, 16);
while (global_ragent_read != 16)
g_main_context_iteration (NULL, TRUE);
g_assert (global_ragent_read == 16);
g_assert_cmpint (global_ragent_read, ==, 16);
g_debug ("test-drop-invalid: Ran mainloop, removing streams...");
......@@ -520,19 +520,19 @@ int main (void)
g_debug ("test-drop-invalid: TEST STARTS / running test for the 1st time");
result = run_full_test (lagent, ragent, &baseaddr, 4 ,0);
priv_print_global_status ();
g_assert (result == 0);
g_assert (global_lagent_state[0] == NICE_COMPONENT_STATE_READY);
g_assert (global_lagent_state[1] == NICE_COMPONENT_STATE_READY);
g_assert (global_ragent_state[0] == NICE_COMPONENT_STATE_READY);
g_assert (global_ragent_state[1] == NICE_COMPONENT_STATE_READY);
g_assert_cmpint (result, ==, 0);
g_assert_cmpint (global_lagent_state[0], ==, NICE_COMPONENT_STATE_READY);
g_assert_cmpint (global_lagent_state[1], ==, NICE_COMPONENT_STATE_READY);
g_assert_cmpint (global_ragent_state[0], ==, NICE_COMPONENT_STATE_READY);
g_assert_cmpint (global_ragent_state[1], ==, NICE_COMPONENT_STATE_READY);
/* When using TURN, we get peer reflexive candidates for the host cands
that we removed so we can get another new_selected_pair signal later
depending on timing/racing, we could double (or not) the amount we expected
*/
/* note: verify that correct number of local candidates were reported */
g_assert (global_lagent_cands == 2);
g_assert (global_ragent_cands == 2);
g_assert_cmpint (global_lagent_cands, ==, 2);
g_assert_cmpint (global_ragent_cands, ==, 2);
g_object_unref (lagent);
g_object_unref (ragent);
......
......@@ -245,8 +245,8 @@ static int run_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress
/* step: add one stream, with RTP+RTCP components, to each agent */
ls_id = nice_agent_add_stream (lagent, 2);
rs_id = nice_agent_add_stream (ragent, 2);
g_assert (ls_id > 0);
g_assert (rs_id > 0);
g_assert_cmpuint (ls_id, >, 0);
g_assert_cmpuint (rs_id, >, 0);
nice_agent_gather_candidates (lagent, ls_id);
nice_agent_gather_candidates (ragent, rs_id);
......@@ -317,8 +317,8 @@ static int run_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress
g_main_loop_run (global_mainloop);
/* note: verify that agents are in correct state */
g_assert (global_lagent_state == NICE_COMPONENT_STATE_READY);
g_assert (global_ragent_state == NICE_COMPONENT_STATE_READY);
g_assert_cmpint (global_lagent_state, ==, NICE_COMPONENT_STATE_READY);
g_assert_cmpint (global_ragent_state, ==, NICE_COMPONENT_STATE_READY);
/* step: next send a packet -> should work even if no ICE processing
* has been done */
......@@ -327,12 +327,12 @@ static int run_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress
/* step: send a new test packet from L ot R */
global_ragent_read = 0;
g_assert (nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678") == 16);
g_assert_cmpint (nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678"), ==, 16);
global_ragent_read_exit = 16;
g_main_loop_run (global_mainloop);
/* note: verify that payload was succesfully received */
g_assert (global_ragent_read == 16);
g_assert_cmpint (global_ragent_read, ==, 16);
g_debug ("test-fallback: Ran mainloop, removing streams...");
......@@ -381,8 +381,8 @@ static int run_safe_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAdd
/* step: add one stream, with RTP+RTCP components, to each agent */
ls_id = nice_agent_add_stream (lagent, 2);
rs_id = nice_agent_add_stream (ragent, 2);
g_assert (ls_id > 0);
g_assert (rs_id > 0);
g_assert_cmpuint (ls_id, >, 0);
g_assert_cmpuint (rs_id, >, 0);
nice_agent_gather_candidates (lagent, ls_id);
nice_agent_gather_candidates (ragent, rs_id);
......@@ -449,8 +449,8 @@ static int run_safe_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAdd
g_main_loop_run (global_mainloop);
/* note: verify that agents are in correct state */
g_assert (global_lagent_state == NICE_COMPONENT_STATE_READY);
g_assert (global_ragent_state == NICE_COMPONENT_STATE_READY);
g_assert_cmpint (global_lagent_state, ==, NICE_COMPONENT_STATE_READY);
g_assert_cmpint (global_ragent_state, ==, NICE_COMPONENT_STATE_READY);
/* step: next send a packet -> should work even if no ICE processing
* has been done */
......@@ -459,12 +459,12 @@ static int run_safe_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAdd
/* step: send a new test packet from L ot R */
global_ragent_read = 0;
g_assert (nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678") == 16);
g_assert_cmpint (nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678"), ==, 16);
global_ragent_read_exit = 16;
g_main_loop_run (global_mainloop);