summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2013-03-19 10:59:38 +0000
committerDaniel Stone <daniel@fooishbar.org>2013-03-19 10:59:38 +0000
commit4d7600bd0c85e9265be406e27f937fc37114f50f (patch)
tree2fd1c700c45d72b65ef19dad1627d6903d033937 /test
parent40c46ecd5b3fdb1d92c7b1745b374184509311cd (diff)
downloadlibxkbcommon-4d7600bd0c85e9265be406e27f937fc37114f50f.tar.gz
libxkbcommon-4d7600bd0c85e9265be406e27f937fc37114f50f.tar.bz2
libxkbcommon-4d7600bd0c85e9265be406e27f937fc37114f50f.zip
test: Add va_list variant of test_key_seq
For use when chaining tests. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'test')
-rw-r--r--test/common.c20
-rw-r--r--test/test.h3
2 files changed, 17 insertions, 6 deletions
diff --git a/test/common.c b/test/common.c
index 2ea2e5b..6d6f25e 100644
--- a/test/common.c
+++ b/test/common.c
@@ -55,11 +55,10 @@
* See below for examples.
*/
int
-test_key_seq(struct xkb_keymap *keymap, ...)
+test_key_seq_va(struct xkb_keymap *keymap, va_list ap)
{
struct xkb_state *state;
- va_list ap;
xkb_keycode_t kc;
int op;
xkb_keysym_t keysym;
@@ -73,8 +72,6 @@ test_key_seq(struct xkb_keymap *keymap, ...)
state = xkb_state_new(keymap);
assert(state);
- va_start(ap, keymap);
-
for (;;) {
kc = va_arg(ap, int) + EVDEV_OFFSET;
op = va_arg(ap, int);
@@ -120,16 +117,27 @@ test_key_seq(struct xkb_keymap *keymap, ...)
goto fail;
}
- va_end(ap);
xkb_state_unref(state);
return 1;
fail:
- va_end(ap);
xkb_state_unref(state);
return 0;
}
+int
+test_key_seq(struct xkb_keymap *keymap, ...)
+{
+ va_list ap;
+ int ret;
+
+ va_start(ap, keymap);
+ ret = test_key_seq_va(keymap, ap);
+ va_end(ap);
+
+ return ret;
+}
+
const char *
test_get_path(const char *path_rel)
{
diff --git a/test/test.h b/test/test.h
index d3e3f62..c39ef8d 100644
--- a/test/test.h
+++ b/test/test.h
@@ -46,6 +46,9 @@ enum key_seq_state {
int
test_key_seq(struct xkb_keymap *keymap, ...);
+int
+test_key_seq_va(struct xkb_keymap *keymap, va_list args);
+
const char *
test_get_path(const char *path_rel);