* DEALINGS IN THE SOFTWARE.
*/
-#include <assert.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
+#include "config.h"
-#include "xkbcommon/xkbcommon.h"
-#include "rules.h"
#include "test.h"
+#include "xkbcomp/xkbcomp-priv.h"
+#include "xkbcomp/rules.h"
struct test_data {
/* Rules file */
const struct xkb_rule_names rmlvo = {
data->rules, data->model, data->layout, data->variant, data->options
};
- struct xkb_component_names *kccgst;
+ struct xkb_component_names kccgst;
fprintf(stderr, "\n\nChecking : %s\t%s\t%s\t%s\t%s\n", data->rules,
data->model, data->layout, data->variant, data->options);
if (data->should_fail)
- fprintf(stderr, "Expecting: NULL\n");
+ fprintf(stderr, "Expecting: FAILURE\n");
else
fprintf(stderr, "Expecting: %s\t%s\t%s\t%s\n",
data->keycodes, data->types, data->compat, data->symbols);
- kccgst = xkb_components_from_rules(ctx, &rmlvo);
- if (!kccgst) {
- fprintf(stderr, "Received: NULL\n");
+ if (!xkb_components_from_rules(ctx, &rmlvo, &kccgst)) {
+ fprintf(stderr, "Received : FAILURE\n");
return data->should_fail;
}
fprintf(stderr, "Received : %s\t%s\t%s\t%s\n",
- kccgst->keycodes, kccgst->types, kccgst->compat, kccgst->symbols);
+ kccgst.keycodes, kccgst.types, kccgst.compat, kccgst.symbols);
- passed = streq(kccgst->keycodes, data->keycodes) &&
- streq(kccgst->types, data->types) &&
- streq(kccgst->compat, data->compat) &&
- streq(kccgst->symbols, data->symbols);
+ passed = streq(kccgst.keycodes, data->keycodes) &&
+ streq(kccgst.types, data->types) &&
+ streq(kccgst.compat, data->compat) &&
+ streq(kccgst.symbols, data->symbols);
- free(kccgst->keycodes);
- free(kccgst->types);
- free(kccgst->compat);
- free(kccgst->symbols);
- free(kccgst);
+ free(kccgst.keycodes);
+ free(kccgst.types);
+ free(kccgst.compat);
+ free(kccgst.symbols);
return passed;
}
int
-main(void)
+main(int argc, char *argv[])
{
struct xkb_context *ctx;
- const char *srcdir = getenv("srcdir");
- char *path;
- ctx = xkb_context_new(XKB_CONTEXT_NO_DEFAULT_INCLUDES);
+ ctx = test_get_context(0);
assert(ctx);
- assert(asprintf(&path, "%s/test/data", srcdir ? srcdir : ".") > 0);
- assert(xkb_context_include_path_append(ctx, test_get_path("")));
- free(path);
-
struct test_data test1 = {
.rules = "simple",
.options = "my_option",
.keycodes = "my_keycodes", .types = "my_types",
- .compat = "my_compat+some:compat",
+ .compat = "my_compat|some:compat",
.symbols = "my_symbols+extra_variant",
};
assert(test_rules(ctx, &test1));