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 ( ...@@ -4178,7 +4178,7 @@ agent_recv_message_unlocked (
retval = sockret; retval = sockret;
} }
g_assert (retval != RECV_OOB); g_assert_cmpint (retval, !=, RECV_OOB);
if (message->length == 0) { if (message->length == 0) {
retval = RECV_OOB; retval = RECV_OOB;
nice_debug_verbose ("%s: Agent %p: message handled out-of-band", G_STRFUNC, 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, ...@@ -4608,7 +4608,7 @@ pending_io_messages_recv_messages (NiceComponent *component, gboolean reliable,
IOCallbackData *data; IOCallbackData *data;
NiceInputMessage *message = &messages[iter->message]; 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); data = g_queue_peek_head (&component->pending_io_messages);
if (data == NULL) if (data == NULL)
...@@ -5161,7 +5161,7 @@ nice_agent_send_messages_nonblocking_internal ( ...@@ -5161,7 +5161,7 @@ nice_agent_send_messages_nonblocking_internal (
g_set_error (&child_error, G_IO_ERROR, G_IO_ERROR_FAILED, g_set_error (&child_error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Error writing data to socket."); "Error writing data to socket.");
} else if (n_sent > 0 && allow_partial) { } 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); n_sent = output_message_get_size (messages);
} }
} }
...@@ -5182,7 +5182,7 @@ nice_agent_send_messages_nonblocking_internal ( ...@@ -5182,7 +5182,7 @@ nice_agent_send_messages_nonblocking_internal (
done: done:
g_assert ((child_error != NULL) == (n_sent == -1)); g_assert ((child_error != NULL) == (n_sent == -1));
g_assert (n_sent != 0); g_assert_cmpint (n_sent, !=, 0);
g_assert (n_sent < 0 || g_assert (n_sent < 0 ||
(!allow_partial && (guint) n_sent <= n_messages) || (!allow_partial && (guint) n_sent <= n_messages) ||
(allow_partial && n_messages == 1 && (allow_partial && n_messages == 1 &&
...@@ -5615,8 +5615,8 @@ component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data) ...@@ -5615,8 +5615,8 @@ component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data)
RecvStatus retval; RecvStatus retval;
/* Don’t want to trample over partially-valid buffers. */ /* Don’t want to trample over partially-valid buffers. */
g_assert (component->recv_messages_iter.buffer == 0); g_assert_cmpuint (component->recv_messages_iter.buffer, ==, 0);
g_assert (component->recv_messages_iter.offset == 0); g_assert_cmpint (component->recv_messages_iter.offset, ==, 0);
while (!nice_input_message_iter_is_at_end (&component->recv_messages_iter, while (!nice_input_message_iter_is_at_end (&component->recv_messages_iter,
component->recv_messages, component->n_recv_messages)) { component->recv_messages, component->n_recv_messages)) {
......
...@@ -147,9 +147,9 @@ nice_candidate_ice_local_preference_full (guint direction_preference, ...@@ -147,9 +147,9 @@ nice_candidate_ice_local_preference_full (guint direction_preference,
* 9-12: <unused> * 9-12: <unused>
* 13-15: direction_preference * 13-15: direction_preference
*/ */
g_assert (other_preference < NICE_CANDIDATE_MAX_LOCAL_ADDRESSES); g_assert_cmpuint (other_preference, <, NICE_CANDIDATE_MAX_LOCAL_ADDRESSES);
g_assert (turn_preference < NICE_CANDIDATE_MAX_TURN_SERVERS); g_assert_cmpuint (turn_preference, <, NICE_CANDIDATE_MAX_TURN_SERVERS);
g_assert (direction_preference < 8); g_assert_cmpuint (direction_preference, <, 8);
return (direction_preference << 13) + return (direction_preference << 13) +
(turn_preference << 6) + (turn_preference << 6) +
...@@ -253,10 +253,10 @@ nice_candidate_ms_ice_local_preference_full (guint transport_preference, ...@@ -253,10 +253,10 @@ nice_candidate_ms_ice_local_preference_full (guint transport_preference,
* 9-11: direction_preference * 9-11: direction_preference
* 12-15: transport_preference * 12-15: transport_preference
*/ */
g_assert (other_preference < NICE_CANDIDATE_MAX_LOCAL_ADDRESSES); g_assert_cmpuint (other_preference, <, NICE_CANDIDATE_MAX_LOCAL_ADDRESSES);
g_assert (turn_preference < NICE_CANDIDATE_MAX_TURN_SERVERS); g_assert_cmpuint (turn_preference, <, NICE_CANDIDATE_MAX_TURN_SERVERS);
g_assert (direction_preference < 8); g_assert_cmpuint (direction_preference, <, 8);
g_assert (transport_preference < 16); g_assert_cmpuint (transport_preference, <, 16);
return (transport_preference << 12) + return (transport_preference << 12) +
(direction_preference << 9) + (direction_preference << 9) +
......
...@@ -944,8 +944,8 @@ nice_component_emit_io_callback (NiceAgent *agent, NiceComponent *component, ...@@ -944,8 +944,8 @@ nice_component_emit_io_callback (NiceAgent *agent, NiceComponent *component,
return; return;
g_assert (NICE_IS_AGENT (agent)); g_assert (NICE_IS_AGENT (agent));
g_assert (stream_id > 0); g_assert_cmpuint (stream_id, >, 0);
g_assert (component_id > 0); g_assert_cmpuint (component_id, >, 0);
g_assert (io_callback != NULL); g_assert (io_callback != NULL);
/* Only allocate a closure if the callback is being deferred to an idle /* 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 ...@@ -600,9 +600,9 @@ static void priv_conn_check_unfreeze_related (NiceAgent *agent, NiceStream *stre
GSList *i, *j; GSList *i, *j;
g_assert (ok_check); 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);
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); priv_print_conn_check_lists (agent, G_STRFUNC, NULL);
...@@ -1073,10 +1073,10 @@ priv_conn_check_tick_stream_nominate (NiceStream *stream, NiceAgent *agent) ...@@ -1073,10 +1073,10 @@ priv_conn_check_tick_stream_nominate (NiceStream *stream, NiceAgent *agent)
* to test its parent pair instead. * to test its parent pair instead.
*/ */
if (p->succeeded_pair != NULL) { if (p->succeeded_pair != NULL) {
g_assert (p->state == NICE_CHECK_DISCOVERED); g_assert_cmpint (p->state, ==, NICE_CHECK_DISCOVERED);
p = p->succeeded_pair; p = p->succeeded_pair;
} }
g_assert (p->state == NICE_CHECK_SUCCEEDED); g_assert_cmpint (p->state, ==, NICE_CHECK_SUCCEEDED);
if (this_component_pair == NULL) if (this_component_pair == NULL)
/* highest priority pair */ /* highest priority pair */
...@@ -2262,7 +2262,7 @@ static void priv_update_check_list_failed_components (NiceAgent *agent, NiceStre ...@@ -2262,7 +2262,7 @@ static void priv_update_check_list_failed_components (NiceAgent *agent, NiceStre
for (i = stream->conncheck_list; i; i = i->next) { for (i = stream->conncheck_list; i; i = i->next) {
CandidateCheckPair *p = i->data; 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->component_id == (c + 1)) {
if (p->nominated) if (p->nominated)
...@@ -2367,7 +2367,7 @@ static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, Nice ...@@ -2367,7 +2367,7 @@ static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, Nice
if (pair->state == NICE_CHECK_SUCCEEDED && if (pair->state == NICE_CHECK_SUCCEEDED &&
pair->discovered_pair != NULL) { pair->discovered_pair != NULL) {
pair = pair->discovered_pair; 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 /* 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 ...@@ -3181,7 +3181,7 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *str
* was FAILED when a peer-reflexive pair was created */ * was FAILED when a peer-reflexive pair was created */
if (p->succeeded_pair != NULL) { if (p->succeeded_pair != NULL) {
g_assert (p->state == NICE_CHECK_DISCOVERED); g_assert_cmpint (p->state, ==, NICE_CHECK_DISCOVERED);
p = p->succeeded_pair; p = p->succeeded_pair;
} }
......
...@@ -466,7 +466,7 @@ nice_output_stream_write (GOutputStream *stream, const void *buffer, gsize count ...@@ -466,7 +466,7 @@ nice_output_stream_write (GOutputStream *stream, const void *buffer, gsize count
write_data_unref (write_data); write_data_unref (write_data);
g_object_unref (agent); g_object_unref (agent);
g_assert (len != 0); g_assert_cmpint (len, !=, 0);
return len; return len;
} }
......
...@@ -328,7 +328,7 @@ pseudo_tcp_fifo_set_capacity (PseudoTcpFifo *b, gsize size) ...@@ -328,7 +328,7 @@ pseudo_tcp_fifo_set_capacity (PseudoTcpFifo *b, gsize size)
static void static void
pseudo_tcp_fifo_consume_read_data (PseudoTcpFifo *b, gsize size) 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->read_position = (b->read_position + size) % b->buffer_length;
b->data_length -= size; b->data_length -= size;
...@@ -337,7 +337,7 @@ pseudo_tcp_fifo_consume_read_data (PseudoTcpFifo *b, gsize size) ...@@ -337,7 +337,7 @@ pseudo_tcp_fifo_consume_read_data (PseudoTcpFifo *b, gsize size)
static void static void
pseudo_tcp_fifo_consume_write_buffer (PseudoTcpFifo *b, gsize size) 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; b->data_length += size;
} }
...@@ -1376,7 +1376,7 @@ queue (PseudoTcpSocket *self, const gchar * data, guint32 len, TcpFlags flags) ...@@ -1376,7 +1376,7 @@ queue (PseudoTcpSocket *self, const gchar * data, guint32 len, TcpFlags flags)
available_space = pseudo_tcp_fifo_get_write_remaining (&priv->sbuf); available_space = pseudo_tcp_fifo_get_write_remaining (&priv->sbuf);
if (len > available_space) { if (len > available_space) {
g_assert (flags == FLAG_NONE); g_assert_cmpint (flags, ==, FLAG_NONE);
len = available_space; len = available_space;
} }
...@@ -1422,7 +1422,7 @@ packet(PseudoTcpSocket *self, guint32 seq, TcpFlags flags, ...@@ -1422,7 +1422,7 @@ packet(PseudoTcpSocket *self, guint32 seq, TcpFlags flags,
} buffer; } buffer;
PseudoTcpWriteResult wres = WR_SUCCESS; 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 = htonl(priv->conv);
*(buffer.u32 + 1) = htonl(seq); *(buffer.u32 + 1) = htonl(seq);
...@@ -1441,7 +1441,7 @@ packet(PseudoTcpSocket *self, guint32 seq, TcpFlags flags, ...@@ -1441,7 +1441,7 @@ packet(PseudoTcpSocket *self, guint32 seq, TcpFlags flags,
bytes_read = pseudo_tcp_fifo_read_offset (&priv->sbuf, buffer.u8 + HEADER_SIZE, bytes_read = pseudo_tcp_fifo_read_offset (&priv->sbuf, buffer.u8 + HEADER_SIZE,
len, offset); 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>" DEBUG (PSEUDO_TCP_DEBUG_VERBOSE, "Sending <CONV=%u><FLG=%u><SEQ=%u:%u><ACK=%u>"
...@@ -1713,7 +1713,7 @@ process(PseudoTcpSocket *self, Segment *seg) ...@@ -1713,7 +1713,7 @@ process(PseudoTcpSocket *self, Segment *seg)
for (nFree = nAcked; nFree > 0; ) { for (nFree = nAcked; nFree > 0; ) {
SSegment *data; 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); data = (SSegment *) g_queue_peek_head (&priv->slist);
if (nFree < data->len) { if (nFree < data->len) {
...@@ -1995,7 +1995,7 @@ process(PseudoTcpSocket *self, Segment *seg) ...@@ -1995,7 +1995,7 @@ process(PseudoTcpSocket *self, Segment *seg)
res = pseudo_tcp_fifo_write_offset (&priv->rbuf, (guint8 *) seg->data, res = pseudo_tcp_fifo_write_offset (&priv->rbuf, (guint8 *) seg->data,
seg->len, nOffset); seg->len, nOffset);
g_assert (res == seg->len); g_assert_cmpint (res, ==, seg->len);
if (seg->seq == priv->rcv_nxt) { if (seg->seq == priv->rcv_nxt) {
GList *iter = NULL; GList *iter = NULL;
...@@ -2091,7 +2091,7 @@ transmit(PseudoTcpSocket *self, SSegment *segment, guint32 now) ...@@ -2091,7 +2091,7 @@ transmit(PseudoTcpSocket *self, SSegment *segment, guint32 now)
return ECONNABORTED; /* FIXME: This error code doesn’t quite seem right */ 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) { while (TRUE) {
if (PACKET_MAXIMUMS[priv->msslevel + 1] == 0) { if (PACKET_MAXIMUMS[priv->msslevel + 1] == 0) {
...@@ -2495,7 +2495,7 @@ resize_receive_buffer (PseudoTcpSocket *self, guint32 new_size) ...@@ -2495,7 +2495,7 @@ resize_receive_buffer (PseudoTcpSocket *self, guint32 new_size)
// buffer. This should always be true because this method is called either // buffer. This should always be true because this method is called either
// before connection is established or when peers are exchanging connect // before connection is established or when peers are exchanging connect
// messages. // messages.
g_assert(result); g_assert (result);
priv->rbuf_len = new_size; priv->rbuf_len = new_size;
priv->rwnd_scale = scale_factor; priv->rwnd_scale = scale_factor;
priv->ssthresh = new_size; priv->ssthresh = new_size;
......
...@@ -226,7 +226,7 @@ fill_vectors (GOutputVector * vecs, GstMapInfo * maps, guint n, GstBuffer * buf) ...@@ -226,7 +226,7 @@ fill_vectors (GOutputVector * vecs, GstMapInfo * maps, guint n, GstBuffer * buf)
gsize size = 0; gsize size = 0;
guint i; 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) { for (i = 0; i < n; ++i) {
mem = gst_buffer_peek_memory (buf, i); mem = gst_buffer_peek_memory (buf, i);
......
...@@ -58,11 +58,11 @@ main (void) ...@@ -58,11 +58,11 @@ main (void)
nice_rng_generate_bytes_print (rng, TEST_RNGSIZE - 1, buf); nice_rng_generate_bytes_print (rng, TEST_RNGSIZE - 1, buf);
/* g_debug ("%s", 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); nice_rng_generate_bytes (rng, 4, buf);
buf[4] = 0; buf[4] = 0;
g_assert (0 == strcmp (buf, "\x1f\x0d\x47\xb8")); g_assert_cmpstr (buf, ==, "\x1f\x0d\x47\xb8");
nice_rng_free (rng); nice_rng_free (rng);
return 0; return 0;
......
...@@ -203,7 +203,7 @@ socket_close (NiceSocket *sock) ...@@ -203,7 +203,7 @@ socket_close (NiceSocket *sock)
static void static void
assert_ring_buffer_valid (HttpPriv *priv) 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 || g_assert (priv->recv_buf_pos == 0 ||
priv->recv_buf_pos < priv->recv_buf_length); priv->recv_buf_pos < priv->recv_buf_length);
g_assert (priv->recv_buf_length == 0 || priv->recv_buf != NULL); 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, ...@@ -333,7 +333,7 @@ nice_socket_queue_send (GQueue *send_queue, const NiceAddress *to,
offset += len; 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, ...@@ -666,10 +666,10 @@ _socket_send_messages_wrapped (NiceSocket *sock, const NiceAddress *to,
guint i; guint i;
gint ret; gint ret;
g_assert (n_messages == 1); g_assert_cmpuint (n_messages, ==, 1);
message = &messages[0]; message = &messages[0];
message_len = output_message_get_size (message); 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 */ /* ICE-TCP requires that all packets be framed with RFC4571 */
...@@ -1239,7 +1239,7 @@ nice_udp_turn_socket_cache_realm_nonce_locked (NiceSocket *sock, ...@@ -1239,7 +1239,7 @@ nice_udp_turn_socket_cache_realm_nonce_locked (NiceSocket *sock,
UdpTurnPriv *priv = sock->priv; UdpTurnPriv *priv = sock->priv;
gconstpointer tmp; 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); g_free (priv->cached_realm);
priv->cached_realm = NULL; priv->cached_realm = NULL;
......
...@@ -61,9 +61,9 @@ main (void) ...@@ -61,9 +61,9 @@ main (void)
agent = nice_agent_new (NULL, NICE_COMPATIBILITY_RFC5245); agent = nice_agent_new (NULL, NICE_COMPATIBILITY_RFC5245);
nice_agent_add_local_address (agent, &addr); nice_agent_add_local_address (agent, &addr);
g_assert (nice_agent_add_stream (agent, 1) == 1); g_assert_cmpuint (nice_agent_add_stream (agent, 1), ==, 1);
g_assert (nice_agent_add_stream (agent, 10) == 2); g_assert_cmpuint (nice_agent_add_stream (agent, 10), ==, 2);
g_assert (nice_agent_add_stream (agent, 2) == 3); g_assert_cmpuint (nice_agent_add_stream (agent, 2), ==, 3);
g_assert (NULL != agent->streams); g_assert (NULL != agent->streams);
......
...@@ -52,10 +52,10 @@ test_ipv4 (void) ...@@ -52,10 +52,10 @@ test_ipv4 (void)
nice_address_init (&addr); nice_address_init (&addr);
nice_address_init (&other); nice_address_init (&other);
nice_address_set_ipv4 (&addr, 0x01020304); 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); 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); nice_address_to_string (&addr, str);
...@@ -115,10 +115,10 @@ test_ipv6 (void) ...@@ -115,10 +115,10 @@ test_ipv6 (void)
"\x44\x55\x66\x77" "\x44\x55\x66\x77"
"\x88\x99\xaa\xbb" "\x88\x99\xaa\xbb"
"\xcc\xdd\xee\xff"); "\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); 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_port (&addr, 9876); /* in native byte order */
nice_address_set_from_string (&other, "11:2233:4455:6677:8899:aabb:ccdd:eeff"); 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) ...@@ -396,10 +396,10 @@ test_zero_length_reads_writes (NiceAddress *addr)
pollable_output_stream = G_POLLABLE_OUTPUT_STREAM (output_stream); pollable_output_stream = G_POLLABLE_OUTPUT_STREAM (output_stream);
/* Check zero-length reads and writes complete immediately without error. */ /* 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_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_no_error (error);
g_assert ( g_assert (
...@@ -417,10 +417,10 @@ test_zero_length_reads_writes (NiceAddress *addr) ...@@ -417,10 +417,10 @@ test_zero_length_reads_writes (NiceAddress *addr)
nice_agent_remove_stream (agent, stream_id); nice_agent_remove_stream (agent, stream_id);
g_assert (g_io_stream_is_closed (G_IO_STREAM (io_stream))); 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_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_no_error (error);
g_assert ( g_assert (
......
...@@ -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 (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);
...@@ -119,8 +119,8 @@ static void setup(NiceAgent *lagent, NiceAgent *ragent) ...@@ -119,8 +119,8 @@ static void setup(NiceAgent *lagent, NiceAgent *ragent)
{ {
NiceAddress addr; NiceAddress addr;
g_assert (nice_agent_add_stream (lagent, 1) == 1); g_assert_cmpuint (nice_agent_add_stream (lagent, 1), ==, 1);
g_assert (nice_agent_add_stream (ragent, 1) == 1); g_assert_cmpuint (nice_agent_add_stream (ragent, 1), ==, 1);
g_assert (NULL != lagent->streams); g_assert (NULL != lagent->streams);
g_assert (NULL != ragent->streams); g_assert (NULL != ragent->streams);
...@@ -182,8 +182,8 @@ int main (void) ...@@ -182,8 +182,8 @@ int main (void)
nice_agent_set_local_credentials (lagent, 1, "unicorns", "awesome"); nice_agent_set_local_credentials (lagent, 1, "unicorns", "awesome");
nice_agent_get_local_credentials (lagent, 1, &ufrag, &password); nice_agent_get_local_credentials (lagent, 1, &ufrag, &password);
g_assert (g_strcmp0("unicorns", ufrag) == 0); g_assert_cmpstr ("unicorns", ==, ufrag);
g_assert (g_strcmp0("awesome", password) == 0); g_assert_cmpstr ("awesome", ==, password);
g_free (ufrag); g_free (ufrag);
g_free (password); g_free (password);
......
...@@ -121,7 +121,7 @@ int main (void) ...@@ -121,7 +121,7 @@ int main (void)
timer_id = g_timeout_add (30000, timer_cb, NULL); timer_id = g_timeout_add (30000, timer_cb, NULL);
ls_id = nice_agent_add_stream (lagent, 2); 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); nice_agent_get_local_credentials(lagent, ls_id, &lufrag, &lpassword);
/* step: attach to mainloop (needed to register the fds) */ /* step: attach to mainloop (needed to register the fds) */
...@@ -134,11 +134,11 @@ int main (void) ...@@ -134,11 +134,11 @@ int main (void)
if (ADD_2_STREAMS) { if (ADD_2_STREAMS) {
rs_id_1 = nice_agent_add_stream (ragent, 2); 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_get_local_credentials(ragent, rs_id_1, &rufrag1, &rpassword1);