aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/test/list.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-04-27 15:56:59 +0000
committermarha <marha@users.sourceforge.net>2011-04-27 15:56:59 +0000
commit100633b3e7619842f345cb7603b0db6b5761dd11 (patch)
tree3c3af754c7e801c07263269837d6a05072ff834c /xorg-server/test/list.c
parent205a4bdae76f287126db9f45a4f0ba631e3efca1 (diff)
parent96d6df5da9cddedf4931bf8e17f96e242467c661 (diff)
downloadvcxsrv-100633b3e7619842f345cb7603b0db6b5761dd11.tar.gz
vcxsrv-100633b3e7619842f345cb7603b0db6b5761dd11.tar.bz2
vcxsrv-100633b3e7619842f345cb7603b0db6b5761dd11.zip
svn merge ^/branches/released .
Diffstat (limited to 'xorg-server/test/list.c')
-rw-r--r--xorg-server/test/list.c57
1 files changed, 27 insertions, 30 deletions
diff --git a/xorg-server/test/list.c b/xorg-server/test/list.c
index 7e035fe58..2b56f9b8d 100644
--- a/xorg-server/test/list.c
+++ b/xorg-server/test/list.c
@@ -28,7 +28,7 @@
#include <X11/Xlib.h>
#include <list.h>
#include <string.h>
-#include <glib.h>
+#include <assert.h>
struct parent {
int a;
@@ -56,10 +56,10 @@ test_list_init(void)
list_init(&parent.children);
/* test we haven't touched anything else. */
- g_assert(parent.a == tmp.a);
- g_assert(parent.b == tmp.b);
+ assert(parent.a == tmp.a);
+ assert(parent.b == tmp.b);
- g_assert(list_is_empty(&parent.children));
+ assert(list_is_empty(&parent.children));
}
static void
@@ -72,19 +72,19 @@ test_list_add(void)
list_init(&parent.children);
list_add(&child[0].node, &parent.children);
- g_assert(!list_is_empty(&parent.children));
+ assert(!list_is_empty(&parent.children));
c = list_first_entry(&parent.children, struct child, node);
- g_assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
+ assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
/* note: list_add prepends */
list_add(&child[1].node, &parent.children);
c = list_first_entry(&parent.children, struct child, node);
- g_assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
+ assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
list_add(&child[2].node, &parent.children);
c = list_first_entry(&parent.children, struct child, node);
- g_assert(memcmp(c, &child[2], sizeof(struct child)) == 0);
+ assert(memcmp(c, &child[2], sizeof(struct child)) == 0);
};
static void
@@ -97,40 +97,40 @@ test_list_del(void)
list_init(&parent.children);
list_add(&child[0].node, &parent.children);
- g_assert(!list_is_empty(&parent.children));
+ assert(!list_is_empty(&parent.children));
list_del(&parent.children);
- g_assert(list_is_empty(&parent.children));
+ assert(list_is_empty(&parent.children));
list_add(&child[0].node, &parent.children);
list_del(&child[0].node);
- g_assert(list_is_empty(&parent.children));
+ assert(list_is_empty(&parent.children));
list_add(&child[0].node, &parent.children);
list_add(&child[1].node, &parent.children);
c = list_first_entry(&parent.children, struct child, node);
- g_assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
+ assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
/* delete first node */
list_del(&child[1].node);
- g_assert(!list_is_empty(&parent.children));
- g_assert(list_is_empty(&child[1].node));
+ assert(!list_is_empty(&parent.children));
+ assert(list_is_empty(&child[1].node));
c = list_first_entry(&parent.children, struct child, node);
- g_assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
+ assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
/* delete last node */
list_add(&child[1].node, &parent.children);
list_del(&child[0].node);
c = list_first_entry(&parent.children, struct child, node);
- g_assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
+ assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
/* delete list head */
list_add(&child[0].node, &parent.children);
list_del(&parent.children);
- g_assert(list_is_empty(&parent.children));
- g_assert(!list_is_empty(&child[1].node));
- g_assert(!list_is_empty(&child[2].node));
+ assert(list_is_empty(&parent.children));
+ assert(!list_is_empty(&child[1].node));
+ assert(!list_is_empty(&child[2].node));
}
static void
@@ -148,29 +148,26 @@ test_list_for_each(void)
list_add(&child[0].node, &parent.children);
list_for_each_entry(c, &parent.children, node) {
- g_assert(memcmp(c, &child[i], sizeof(struct child)) == 0);
+ assert(memcmp(c, &child[i], sizeof(struct child)) == 0);
i++;
}
/* foreach on empty list */
list_del(&parent.children);
- g_assert(list_is_empty(&parent.children));
+ assert(list_is_empty(&parent.children));
list_for_each_entry(c, &parent.children, node) {
- g_assert(0); /* we must not get here */
+ assert(0); /* we must not get here */
}
}
int main(int argc, char** argv)
{
- g_test_init(&argc, &argv,NULL);
- g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
+ test_list_init();
+ test_list_add();
+ test_list_del();
+ test_list_for_each();
- g_test_add_func("/list/init", test_list_init);
- g_test_add_func("/list/add", test_list_add);
- g_test_add_func("/list/del", test_list_del);
- g_test_add_func("/list/for_each", test_list_for_each);
-
- return g_test_run();
+ return 0;
}