summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2010-05-24 16:24:03 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2010-05-28 16:49:30 +1000
commit151659f9636088fd70bc5586de97bf43ee706180 (patch)
treeb25c8cbb02eaea50bfc892290191a65a2bbed022 /test
parent6cccf0131c8464d8838cae2200730873d7dd9e45 (diff)
test: fix up InputAttributes helper function test.
Just some extra clarification as pointed out by Dan Nicholson, and that memcpy should have been a memcmp. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/input.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/input.c b/test/input.c
index 8a54af9d3..12771c59a 100644
--- a/test/input.c
+++ b/test/input.c
@@ -803,12 +803,18 @@ static void cmp_attr_fields(InputAttributes *attr1,
tags1 = attr1->tags;
tags2 = attr2->tags;
+
+ /* if we don't have any tags, skip the tag checking bits */
if (!tags1)
{
g_assert(!tags2);
return;
}
+ /* Don't lug around empty arrays */
+ g_assert(*tags1);
+ g_assert(*tags2);
+
/* check for identical content, but duplicated */
while (*tags1)
{
@@ -818,6 +824,7 @@ static void cmp_attr_fields(InputAttributes *attr1,
tags2++;
}
+ /* ensure tags1 and tags2 have the same no of elements */
g_assert(!*tags2);
/* check for not sharing memory */
@@ -842,7 +849,7 @@ static void dix_input_attributes(void)
g_assert(!new);
new = DuplicateInputAttributes(&orig);
- g_assert(memcpy(&orig, new, sizeof(InputAttributes)));
+ g_assert(memcmp(&orig, new, sizeof(InputAttributes)) == 0);
orig.product = "product name";
new = DuplicateInputAttributes(&orig);