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

tests: Replace g_assert (memcmp) with g_assert_cmpmem()

This makes for clearer reports in the CI
parent 8eeb7936
......@@ -130,7 +130,7 @@ test_ipv6 (void)
nice_address_to_string (&addr, str);
nice_address_to_string (&other, str);
g_assert (memcmp (&sin, &sin2, sizeof(sin)) == 0);
g_assert_cmpmem (&sin, sizeof(sin), &sin2, sizeof(sin2));
/* private IPv6 address */
nice_address_set_ipv6 (&addr, (guchar *)
......
......@@ -210,7 +210,7 @@ test_multi_buffer_recv (void)
g_assert_cmpuint (bufs[6].size, ==, 0);
g_assert_cmpint (strncmp ((gchar *) buf, "hello-world", 11), ==, 0);
g_assert_cmpint (memcmp (buf + 11, dummy_buf, 9), ==, 0);
g_assert_cmpmem (buf + 11, 9, dummy_buf, 9);
}
nice_socket_free (client);
......
......@@ -158,7 +158,7 @@ print_candidate (gpointer data, gpointer user_data)
gchar str_addr[INET6_ADDRSTRLEN];
nice_address_to_string (&cand->addr, str_addr);
g_debug ("Cadidate: %s:%d", str_addr, nice_address_get_port (&cand->addr));
g_debug ("Candidate: %s:%d", str_addr, nice_address_get_port (&cand->addr));
}
static void
......
......@@ -79,7 +79,7 @@ read_stream_cb (GObject *pollable_stream, gpointer _user_data)
g_assert_cmpint (len, ==, MESSAGE_SIZE);
memset (expected_data, user_data->recv_count + '1', sizeof (expected_data));
g_assert (memcmp (buf, expected_data, sizeof (expected_data)) == 0);
g_assert_cmpmem (buf, sizeof (expected_data), expected_data, sizeof (expected_data));
user_data->recv_count++;
......
......@@ -75,7 +75,8 @@ read_thread_cb (GInputStream *input_stream, TestIOStreamThreadData *data)
g_assert_cmpint (len, ==, sizeof (buf));
memset (expected_data, user_data->recv_count + '1', sizeof (expected_data));
g_assert (memcmp (buf, expected_data, sizeof (expected_data)) == 0);
g_assert_cmpmem (buf, sizeof (expected_data), expected_data,
sizeof (expected_data));
}
check_for_termination (data, &user_data->recv_count,
......
......@@ -428,7 +428,7 @@ validate_received_buffer (TestIOStreamThreadData *data, gsize buffer_offset,
memset (expected_buf, 0xaa, buf_len);
generate_buffer_data (test_data->buffer_data_strategy, buffer_offset,
expected_buf, len);
g_assert (memcmp (*buf, expected_buf, len) == 0);
g_assert_cmpmem (*buf, len, expected_buf, len);
g_free (expected_buf);
test_data->received_bytes += len;
......@@ -481,8 +481,7 @@ validate_received_messages (TestIOStreamThreadData *data, gsize buffer_offset,
memset (expected_buf, 0xaa, buffer->size);
generate_buffer_data (test_data->buffer_data_strategy, buffer_offset,
expected_buf, valid_len);
g_assert_cmpint (memcmp (buffer->buffer, expected_buf, valid_len), ==,
0);
g_assert_cmpmem (buffer->buffer, valid_len, expected_buf, valid_len);
g_free (expected_buf);
buffer_offset += valid_len;
message_len_remaining -= valid_len;
......
......@@ -148,11 +148,11 @@ static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id,
if (*count == 10)
return;
g_assert_cmpuint (len, ==, 10);
memset (data, *count + '1', 10);
g_assert (memcmp (buf, data, 10) == 0);
g_assert_cmpmem (buf, len, data, 10);
g_assert_cmpuint (len, ==, 10);
(*count)++;
......
......@@ -186,8 +186,8 @@ tcp_turn_fragmentation (void)
continue;
}
g_assert (message->length == vec->size);
g_assert (!memcmp (message->buffers->buffer, vec->buffer,
message->length));
g_assert_cmpmem (message->buffers->buffer, message->length,
vec->buffer, message->length);
li = li->next;
}
......
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