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:
Dan Winship
2014-12-03 05:57:29 -05:00
parent 367f36d630
commit 9f2e3f6b72
17 changed files with 120 additions and 103 deletions

View File

@@ -1761,9 +1761,7 @@ test_strinfo (void)
strinfo_builder_append_item (builder, "foo", 1);
strinfo_builder_append_item (builder, "bar", 2);
g_assert (strinfo_builder_append_alias (builder, "baz", "bar"));
g_assert_cmpint (builder->len % 4, ==, 0);
g_assert_cmpint (builder->len / 4, ==, length);
g_assert (memcmp (builder->str, strinfo, length * 4) == 0);
g_assert_cmpmem (builder->str, builder->len, strinfo, length * 4);
g_string_free (builder, TRUE);
}