match_keyword BUGFIX lenght of keyword must be also checked
diff --git a/tests/src/test_parser_yin.c b/tests/src/test_parser_yin.c
index 4869b8e..bcd9c83 100644
--- a/tests/src/test_parser_yin.c
+++ b/tests/src/test_parser_yin.c
@@ -81,76 +81,76 @@
{
(void)state; /* unused */
- assert_int_equal(match_keyword("anydata"), YANG_ANYDATA);
- assert_int_equal(match_keyword("asdasd"), YANG_NONE);
- assert_int_equal(match_keyword(""), YANG_NONE);
- assert_int_equal(match_keyword("anydata"), YANG_ANYDATA);
- assert_int_equal(match_keyword("anyxml"), YANG_ANYXML);
- assert_int_equal(match_keyword("argument"), YANG_ARGUMENT);
- assert_int_equal(match_keyword("augment"), YANG_AUGMENT);
- assert_int_equal(match_keyword("base"), YANG_BASE);
- assert_int_equal(match_keyword("belongs-to"), YANG_BELONGS_TO);
- assert_int_equal(match_keyword("bit"), YANG_BIT);
- assert_int_equal(match_keyword("case"), YANG_CASE);
- assert_int_equal(match_keyword("choice"), YANG_CHOICE);
- assert_int_equal(match_keyword("config"), YANG_CONFIG);
- assert_int_equal(match_keyword("contact"), YANG_CONTACT);
- assert_int_equal(match_keyword("container"), YANG_CONTAINER);
- assert_int_equal(match_keyword("default"), YANG_DEFAULT);
- assert_int_equal(match_keyword("description"), YANG_DESCRIPTION);
- assert_int_equal(match_keyword("deviate"), YANG_DEVIATE);
- assert_int_equal(match_keyword("deviation"), YANG_DEVIATION);
- assert_int_equal(match_keyword("enum"), YANG_ENUM);
- assert_int_equal(match_keyword("error-app-tag"), YANG_ERROR_APP_TAG);
- assert_int_equal(match_keyword("error-message"), YANG_ERROR_MESSAGE);
- assert_int_equal(match_keyword("extension"), YANG_EXTENSION);
- assert_int_equal(match_keyword("feature"), YANG_FEATURE);
- assert_int_equal(match_keyword("fraction-digits"), YANG_FRACTION_DIGITS);
- assert_int_equal(match_keyword("grouping"), YANG_GROUPING);
- assert_int_equal(match_keyword("identity"), YANG_IDENTITY);
- assert_int_equal(match_keyword("if-feature"), YANG_IF_FEATURE);
- assert_int_equal(match_keyword("import"), YANG_IMPORT);
- assert_int_equal(match_keyword("include"), YANG_INCLUDE);
- assert_int_equal(match_keyword("input"), YANG_INPUT);
- assert_int_equal(match_keyword("key"), YANG_KEY);
- assert_int_equal(match_keyword("leaf"), YANG_LEAF);
- assert_int_equal(match_keyword("leaf-list"), YANG_LEAF_LIST);
- assert_int_equal(match_keyword("length"), YANG_LENGTH);
- assert_int_equal(match_keyword("list"), YANG_LIST);
- assert_int_equal(match_keyword("mandatory"), YANG_MANDATORY);
- assert_int_equal(match_keyword("max-elements"), YANG_MAX_ELEMENTS);
- assert_int_equal(match_keyword("min-elements"), YANG_MIN_ELEMENTS);
- assert_int_equal(match_keyword("modifier"), YANG_MODIFIER);
- assert_int_equal(match_keyword("module"), YANG_MODULE);
- assert_int_equal(match_keyword("must"), YANG_MUST);
- assert_int_equal(match_keyword("namespace"), YANG_NAMESPACE);
- assert_int_equal(match_keyword("notification"), YANG_NOTIFICATION);
- assert_int_equal(match_keyword("ordered-by"), YANG_ORDERED_BY);
- assert_int_equal(match_keyword("organization"), YANG_ORGANIZATION);
- assert_int_equal(match_keyword("output"), YANG_OUTPUT);
- assert_int_equal(match_keyword("path"), YANG_PATH);
- assert_int_equal(match_keyword("pattern"), YANG_PATTERN);
- assert_int_equal(match_keyword("position"), YANG_POSITION);
- assert_int_equal(match_keyword("prefix"), YANG_PREFIX);
- assert_int_equal(match_keyword("presence"), YANG_PRESENCE);
- assert_int_equal(match_keyword("range"), YANG_RANGE);
- assert_int_equal(match_keyword("reference"), YANG_REFERENCE);
- assert_int_equal(match_keyword("refine"), YANG_REFINE);
- assert_int_equal(match_keyword("require-instance"), YANG_REQUIRE_INSTANCE);
- assert_int_equal(match_keyword("revision"), YANG_REVISION);
- assert_int_equal(match_keyword("revision-date"), YANG_REVISION_DATE);
- assert_int_equal(match_keyword("rpc"), YANG_RPC);
- assert_int_equal(match_keyword("status"), YANG_STATUS);
- assert_int_equal(match_keyword("submodule"), YANG_SUBMODULE);
- assert_int_equal(match_keyword("type"), YANG_TYPE);
- assert_int_equal(match_keyword("typedef"), YANG_TYPEDEF);
- assert_int_equal(match_keyword("unique"), YANG_UNIQUE);
- assert_int_equal(match_keyword("units"), YANG_UNITS);
- assert_int_equal(match_keyword("uses"), YANG_USES);
- assert_int_equal(match_keyword("value"), YANG_VALUE);
- assert_int_equal(match_keyword("when"), YANG_WHEN);
- assert_int_equal(match_keyword("yang-version"), YANG_YANG_VERSION);
- assert_int_equal(match_keyword("yin-element"), YANG_YIN_ELEMENT);
+ assert_int_equal(match_keyword("anydatax", strlen("anydatax")), YANG_NONE);
+ assert_int_equal(match_keyword("asdasd", strlen("asdasd")), YANG_NONE);
+ assert_int_equal(match_keyword("", 0), YANG_NONE);
+ assert_int_equal(match_keyword("anydata", strlen("anydata")), YANG_ANYDATA);
+ assert_int_equal(match_keyword("anyxml", strlen("anyxml")), YANG_ANYXML);
+ assert_int_equal(match_keyword("argument", strlen("argument")), YANG_ARGUMENT);
+ assert_int_equal(match_keyword("augment", strlen("augment")), YANG_AUGMENT);
+ assert_int_equal(match_keyword("base", strlen("base")), YANG_BASE);
+ assert_int_equal(match_keyword("belongs-to", strlen("belongs-to")), YANG_BELONGS_TO);
+ assert_int_equal(match_keyword("bit", strlen("bit")), YANG_BIT);
+ assert_int_equal(match_keyword("case", strlen("case")), YANG_CASE);
+ assert_int_equal(match_keyword("choice", strlen("choice")), YANG_CHOICE);
+ assert_int_equal(match_keyword("config", strlen("config")), YANG_CONFIG);
+ assert_int_equal(match_keyword("contact", strlen("contact")), YANG_CONTACT);
+ assert_int_equal(match_keyword("container", strlen("container")), YANG_CONTAINER);
+ assert_int_equal(match_keyword("default", strlen("default")), YANG_DEFAULT);
+ assert_int_equal(match_keyword("description", strlen("description")), YANG_DESCRIPTION);
+ assert_int_equal(match_keyword("deviate", strlen("deviate")), YANG_DEVIATE);
+ assert_int_equal(match_keyword("deviation", strlen("deviation")), YANG_DEVIATION);
+ assert_int_equal(match_keyword("enum", strlen("enum")), YANG_ENUM);
+ assert_int_equal(match_keyword("error-app-tag", strlen("error-app-tag")), YANG_ERROR_APP_TAG);
+ assert_int_equal(match_keyword("error-message", strlen("error-message")), YANG_ERROR_MESSAGE);
+ assert_int_equal(match_keyword("extension", strlen("extension")), YANG_EXTENSION);
+ assert_int_equal(match_keyword("feature", strlen("feature")), YANG_FEATURE);
+ assert_int_equal(match_keyword("fraction-digits", strlen("fraction-digits")), YANG_FRACTION_DIGITS);
+ assert_int_equal(match_keyword("grouping", strlen("grouping")), YANG_GROUPING);
+ assert_int_equal(match_keyword("identity", strlen("identity")), YANG_IDENTITY);
+ assert_int_equal(match_keyword("if-feature", strlen("if-feature")), YANG_IF_FEATURE);
+ assert_int_equal(match_keyword("import", strlen("import")), YANG_IMPORT);
+ assert_int_equal(match_keyword("include", strlen("include")), YANG_INCLUDE);
+ assert_int_equal(match_keyword("input", strlen("input")), YANG_INPUT);
+ assert_int_equal(match_keyword("key", strlen("key")), YANG_KEY);
+ assert_int_equal(match_keyword("leaf", strlen("leaf")), YANG_LEAF);
+ assert_int_equal(match_keyword("leaf-list", strlen("leaf-list")), YANG_LEAF_LIST);
+ assert_int_equal(match_keyword("length", strlen("length")), YANG_LENGTH);
+ assert_int_equal(match_keyword("list", strlen("list")), YANG_LIST);
+ assert_int_equal(match_keyword("mandatory", strlen("mandatory")), YANG_MANDATORY);
+ assert_int_equal(match_keyword("max-elements", strlen("max-elements")), YANG_MAX_ELEMENTS);
+ assert_int_equal(match_keyword("min-elements", strlen("min-elements")), YANG_MIN_ELEMENTS);
+ assert_int_equal(match_keyword("modifier", strlen("modifier")), YANG_MODIFIER);
+ assert_int_equal(match_keyword("module", strlen("module")), YANG_MODULE);
+ assert_int_equal(match_keyword("must", strlen("must")), YANG_MUST);
+ assert_int_equal(match_keyword("namespace", strlen("namespace")), YANG_NAMESPACE);
+ assert_int_equal(match_keyword("notification", strlen("notification")), YANG_NOTIFICATION);
+ assert_int_equal(match_keyword("ordered-by", strlen("ordered-by")), YANG_ORDERED_BY);
+ assert_int_equal(match_keyword("organization", strlen("organization")), YANG_ORGANIZATION);
+ assert_int_equal(match_keyword("output", strlen("output")), YANG_OUTPUT);
+ assert_int_equal(match_keyword("path", strlen("path")), YANG_PATH);
+ assert_int_equal(match_keyword("pattern", strlen("pattern")), YANG_PATTERN);
+ assert_int_equal(match_keyword("position", strlen("position")), YANG_POSITION);
+ assert_int_equal(match_keyword("prefix", strlen("prefix")), YANG_PREFIX);
+ assert_int_equal(match_keyword("presence", strlen("presence")), YANG_PRESENCE);
+ assert_int_equal(match_keyword("range", strlen("range")), YANG_RANGE);
+ assert_int_equal(match_keyword("reference", strlen("reference")), YANG_REFERENCE);
+ assert_int_equal(match_keyword("refine", strlen("refine")), YANG_REFINE);
+ assert_int_equal(match_keyword("require-instance", strlen("require-instance")), YANG_REQUIRE_INSTANCE);
+ assert_int_equal(match_keyword("revision", strlen("revision")), YANG_REVISION);
+ assert_int_equal(match_keyword("revision-date", strlen("revision-date")), YANG_REVISION_DATE);
+ assert_int_equal(match_keyword("rpc", strlen("rpc")), YANG_RPC);
+ assert_int_equal(match_keyword("status", strlen("status")), YANG_STATUS);
+ assert_int_equal(match_keyword("submodule", strlen("submodule")), YANG_SUBMODULE);
+ assert_int_equal(match_keyword("type", strlen("type")), YANG_TYPE);
+ assert_int_equal(match_keyword("typedef", strlen("typedef")), YANG_TYPEDEF);
+ assert_int_equal(match_keyword("unique", strlen("unique")), YANG_UNIQUE);
+ assert_int_equal(match_keyword("units", strlen("units")), YANG_UNITS);
+ assert_int_equal(match_keyword("uses", strlen("uses")), YANG_USES);
+ assert_int_equal(match_keyword("value", strlen("value")), YANG_VALUE);
+ assert_int_equal(match_keyword("when", strlen("when")), YANG_WHEN);
+ assert_int_equal(match_keyword("yang-version", strlen("yang-version")), YANG_YANG_VERSION);
+ assert_int_equal(match_keyword("yin-element", strlen("yin-element")), YANG_YIN_ELEMENT);
}
static void