diff options
Diffstat (limited to 'xorg-server/test/xkb.c')
-rw-r--r-- | xorg-server/test/xkb.c | 76 |
1 files changed, 36 insertions, 40 deletions
diff --git a/xorg-server/test/xkb.c b/xorg-server/test/xkb.c index 6fbb26a01..421153cd1 100644 --- a/xorg-server/test/xkb.c +++ b/xorg-server/test/xkb.c @@ -46,8 +46,7 @@ #include <X11/extensions/XKMformat.h> #include "xkbfile.h" #include "../xkb/xkb.h" - -#include <glib.h> +#include <assert.h> /** * Initialize an empty XkbRMLVOSet. @@ -62,16 +61,16 @@ static void xkb_get_rules_test(void) XkbGetRulesDflts(&rmlvo); - g_assert(rmlvo.rules); - g_assert(rmlvo.model); - g_assert(rmlvo.layout); - g_assert(rmlvo.variant); - g_assert(rmlvo.options); - g_assert(strcmp(rmlvo.rules, XKB_DFLT_RULES) == 0); - g_assert(strcmp(rmlvo.model, XKB_DFLT_MODEL) == 0); - g_assert(strcmp(rmlvo.layout, XKB_DFLT_LAYOUT) == 0); - g_assert(strcmp(rmlvo.variant, XKB_DFLT_VARIANT) == 0); - g_assert(strcmp(rmlvo.options, XKB_DFLT_OPTIONS) == 0); + assert(rmlvo.rules); + assert(rmlvo.model); + assert(rmlvo.layout); + assert(rmlvo.variant); + assert(rmlvo.options); + assert(strcmp(rmlvo.rules, XKB_DFLT_RULES) == 0); + assert(strcmp(rmlvo.model, XKB_DFLT_MODEL) == 0); + assert(strcmp(rmlvo.layout, XKB_DFLT_LAYOUT) == 0); + assert(strcmp(rmlvo.variant, XKB_DFLT_VARIANT) == 0); + assert(strcmp(rmlvo.options, XKB_DFLT_OPTIONS) == 0); } /** @@ -95,17 +94,17 @@ static void xkb_set_rules_test(void) XkbGetRulesDflts(&rmlvo_new); /* XkbGetRulesDflts strdups the values */ - g_assert(rmlvo.rules != rmlvo_new.rules); - g_assert(rmlvo.model != rmlvo_new.model); - g_assert(rmlvo.layout != rmlvo_new.layout); - g_assert(rmlvo.variant != rmlvo_new.variant); - g_assert(rmlvo.options != rmlvo_new.options); - - g_assert(strcmp(rmlvo.rules, rmlvo_new.rules) == 0); - g_assert(strcmp(rmlvo.model, rmlvo_new.model) == 0); - g_assert(strcmp(rmlvo.layout, rmlvo_new.layout) == 0); - g_assert(strcmp(rmlvo.variant, rmlvo_new.variant) == 0); - g_assert(strcmp(rmlvo.options, rmlvo_new.options) == 0); + assert(rmlvo.rules != rmlvo_new.rules); + assert(rmlvo.model != rmlvo_new.model); + assert(rmlvo.layout != rmlvo_new.layout); + assert(rmlvo.variant != rmlvo_new.variant); + assert(rmlvo.options != rmlvo_new.options); + + assert(strcmp(rmlvo.rules, rmlvo_new.rules) == 0); + assert(strcmp(rmlvo.model, rmlvo_new.model) == 0); + assert(strcmp(rmlvo.layout, rmlvo_new.layout) == 0); + assert(strcmp(rmlvo.variant, rmlvo_new.variant) == 0); + assert(strcmp(rmlvo.options, rmlvo_new.options) == 0); } @@ -145,29 +144,26 @@ static void xkb_set_get_rules_test(void) /* This test is iffy, because strictly we may be comparing against already * freed memory */ - g_assert(strcmp(rmlvo.rules, rmlvo_backup.rules) == 0); - g_assert(strcmp(rmlvo.model, rmlvo_backup.model) == 0); - g_assert(strcmp(rmlvo.layout, rmlvo_backup.layout) == 0); - g_assert(strcmp(rmlvo.variant, rmlvo_backup.variant) == 0); - g_assert(strcmp(rmlvo.options, rmlvo_backup.options) == 0); + assert(strcmp(rmlvo.rules, rmlvo_backup.rules) == 0); + assert(strcmp(rmlvo.model, rmlvo_backup.model) == 0); + assert(strcmp(rmlvo.layout, rmlvo_backup.layout) == 0); + assert(strcmp(rmlvo.variant, rmlvo_backup.variant) == 0); + assert(strcmp(rmlvo.options, rmlvo_backup.options) == 0); XkbGetRulesDflts(&rmlvo); - g_assert(strcmp(rmlvo.rules, rmlvo_backup.rules) == 0); - g_assert(strcmp(rmlvo.model, rmlvo_backup.model) == 0); - g_assert(strcmp(rmlvo.layout, rmlvo_backup.layout) == 0); - g_assert(strcmp(rmlvo.variant, rmlvo_backup.variant) == 0); - g_assert(strcmp(rmlvo.options, rmlvo_backup.options) == 0); + assert(strcmp(rmlvo.rules, rmlvo_backup.rules) == 0); + assert(strcmp(rmlvo.model, rmlvo_backup.model) == 0); + assert(strcmp(rmlvo.layout, rmlvo_backup.layout) == 0); + assert(strcmp(rmlvo.variant, rmlvo_backup.variant) == 0); + assert(strcmp(rmlvo.options, rmlvo_backup.options) == 0); } int main(int argc, char** argv) { - g_test_init(&argc, &argv,NULL); - g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id="); - - g_test_add_func("/xkb/set-get-rules", xkb_set_get_rules_test); - g_test_add_func("/xkb/get-rules", xkb_get_rules_test); - g_test_add_func("/xkb/set-rules", xkb_set_rules_test); + xkb_set_get_rules_test(); + xkb_get_rules_test(); + xkb_set_rules_test(); - return g_test_run(); + return 0; } |