mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-26 19:08:57 +02:00
gtestutils: add g_assert_cmpmem()
Add a test macro to compare two buffers (which are not already known to be the same length) for equality. https://bugzilla.gnome.org/show_bug.cgi?id=754283
This commit is contained in:
@@ -100,15 +100,10 @@ compare_output (SetupData *data)
|
||||
gsize size;
|
||||
gpointer written;
|
||||
|
||||
written = g_memory_output_stream_get_data (G_MEMORY_OUTPUT_STREAM (data->data_stream));
|
||||
size = g_memory_output_stream_get_data_size (G_MEMORY_OUTPUT_STREAM (data->data_stream));
|
||||
|
||||
/* compare the size of the data */
|
||||
g_assert_cmpint (size, ==, data->expected_size);
|
||||
|
||||
written = g_memory_output_stream_get_data (G_MEMORY_OUTPUT_STREAM (data->data_stream));
|
||||
|
||||
/* compare the data itself */
|
||||
g_assert (memcmp (written, data->expected_output, size) == 0);
|
||||
g_assert_cmpmem (written, size, data->expected_output, data->expected_size);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user