schema CHANGE remove LYEXT_PARENT duplicating ly_stmt
Removing the enumeration also leads to simplify the extension instance
structure where was the information about the parent structure duplicated.
diff --git a/tests/utests/extensions/test_yangdata.c b/tests/utests/extensions/test_yangdata.c
index 9829e36..02b50f1 100644
--- a/tests/utests/extensions/test_yangdata.c
+++ b/tests/utests/extensions/test_yangdata.c
@@ -118,7 +118,7 @@
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, &mod));
assert_null(mod->compiled->exts);
CHECK_LOG_CTX("Extension plugin \"libyang 2 - yang-data, version 1\": "
- "Extension rc:yang-data is ignored since it appears as a non top-level statement in \"data node\" statement.",
+ "Extension rc:yang-data is ignored since it appears as a non top-level statement in \"container\" statement.",
"/b:b/{extension='rc:yang-data'}/template");
assert_int_equal(LY_SUCCESS, lys_print_mem(&printed, mod, LYS_OUT_YANG_COMPILED, 0));
assert_string_equal(printed, info);
diff --git a/tests/utests/schema/test_parser_yang.c b/tests/utests/schema/test_parser_yang.c
index 7a904d5..0abb821 100644
--- a/tests/utests/schema/test_parser_yang.c
+++ b/tests/utests/schema/test_parser_yang.c
@@ -784,7 +784,7 @@
/* extensions */
TEST_GENERIC("prefix:test;}", mod->exts,
assert_string_equal("prefix:test", mod->exts[0].name);
- assert_int_equal(LY_STMT_MODULE, mod->exts[0].insubstmt));
+ assert_int_equal(LY_STMT_MODULE, mod->exts[0].parent_stmt));
mod = mod_renew(YCTX);
/* invalid substatement */
diff --git a/tests/utests/schema/test_parser_yin.c b/tests/utests/schema/test_parser_yin.c
index 0e1b09c..14f6b7d 100644
--- a/tests/utests/schema/test_parser_yin.c
+++ b/tests/utests/schema/test_parser_yin.c
@@ -121,7 +121,7 @@
#define ELEMENT_WRAPPER_END "</status>"
#define TEST_1_CHECK_LYSP_EXT_INSTANCE(NODE, INSUBSTMT)\
- CHECK_LYSP_EXT_INSTANCE((NODE), NULL, 1, NULL, INSUBSTMT, 0, "myext:c-define", 0, 0, LY_PREF_XML)
+ CHECK_LYSP_EXT_INSTANCE((NODE), NULL, 1, NULL, INSUBSTMT, 0, "myext:c-define", LY_PREF_XML)
struct lys_yin_parser_ctx *YCTX;
@@ -335,8 +335,7 @@
ret = yin_parse_extension_instance(YCTX, LY_STMT_CONTACT, 0, &exts);
assert_int_equal(ret, LY_SUCCESS);
- CHECK_LYSP_EXT_INSTANCE(exts, NULL, 1, NULL,
- LY_STMT_CONTACT, 0, "myext:ext", 0, 0, LY_PREF_XML);
+ CHECK_LYSP_EXT_INSTANCE(exts, NULL, 1, NULL, LY_STMT_CONTACT, 0, "myext:ext", LY_PREF_XML);
CHECK_LYSP_STMT(exts->child, arg, 0, LYS_YIN_ATTR, 0, 1, stmt);
stmt = "value";
@@ -356,8 +355,7 @@
ret = yin_parse_extension_instance(YCTX, LY_STMT_CONTACT, 0, &exts);
assert_int_equal(ret, LY_SUCCESS);
- CHECK_LYSP_EXT_INSTANCE(exts, NULL, 0, NULL,
- LY_STMT_CONTACT, 0, "myext:extension-elem", 0, 0, LY_PREF_XML);
+ CHECK_LYSP_EXT_INSTANCE(exts, NULL, 0, NULL, LY_STMT_CONTACT, 0, "myext:extension-elem", LY_PREF_XML);
lysp_ext_instance_free(UTEST_LYCTX, exts);
LY_ARRAY_FREE(exts);
exts = NULL;
@@ -379,8 +377,7 @@
ret = yin_parse_extension_instance(YCTX, LY_STMT_CONTACT, 0, &exts);
assert_int_equal(ret, LY_SUCCESS);
- CHECK_LYSP_EXT_INSTANCE(exts, NULL, 1, NULL,
- LY_STMT_CONTACT, 0, "myext:ext", 0, 0, LY_PREF_XML);
+ CHECK_LYSP_EXT_INSTANCE(exts, NULL, 1, NULL, LY_STMT_CONTACT, 0, "myext:ext", LY_PREF_XML);
stmt = "attr1";
arg = "text1";
@@ -547,8 +544,7 @@
const char *exts_name = "myext:custom";
const char *exts_arg = "totally amazing extension";
- CHECK_LYSP_EXT_INSTANCE(exts, exts_arg, 0, NULL,
- LY_STMT_PREFIX, 0, exts_name, 0, 0, LY_PREF_XML);
+ CHECK_LYSP_EXT_INSTANCE(exts, exts_arg, 0, NULL, LY_STMT_PREFIX, 0, exts_name, LY_PREF_XML);
assert_string_equal(value, "wsefsdf");
assert_string_equal(units, "radians");
assert_string_equal(when_p->cond, "condition...");
diff --git a/tests/utests/utests.h b/tests/utests/utests.h
index 09da1c5..b57df7b 100644
--- a/tests/utests/utests.h
+++ b/tests/utests/utests.h
@@ -428,27 +428,19 @@
* @param[in] ARGUMENT expected optional value of the extension's argument
* @param[in] CHILD 0 -> node doesnt have child, 1 -> node have children
* @param[in] COMPILED 0 -> compiled data dosnt exists, 1 -> compiled data exists
- * @param[in] INSUBSTMS expected value identifying placement of the extension instance
- * @param[in] INSUBSTMS_INDEX expected indentifi index
- * @param[in] PARENT 0-> check if node is root, 1-> check if node is not root
- * @param[in] PARENT_TYPE expected parent type ::LYEXT_PARENT. not relevat if PARENT == 0
+ * @param[in] PARENT_STMT expected value identifying placement of the extension instance
+ * @param[in] PARENT_STMT_INDEX expected indentifi index
* @param[in] FORMAT expected format
*/
-#define CHECK_LYSP_EXT_INSTANCE(NODE, ARGUMENT, CHILD, COMPILED, INSUBSTMT, INSUBSTMT_INDEX, NAME, HAS_PARENT, PARENT_TYPE, FORMAT) \
+#define CHECK_LYSP_EXT_INSTANCE(NODE, ARGUMENT, CHILD, COMPILED, PARENT_STMT, PARENT_STMT_INDEX, NAME, FORMAT) \
assert_non_null(NODE); \
CHECK_STRING((NODE)->argument, ARGUMENT); \
CHECK_POINTER((NODE)->child, CHILD); \
CHECK_POINTER((NODE)->compiled, COMPILED); \
/*assert_int_equal((NODE)->flags, LYS_INTERNAL);*/ \
- assert_int_equal((NODE)->insubstmt, INSUBSTMT); \
- assert_int_equal((NODE)->insubstmt_index, INSUBSTMT_INDEX); \
+ assert_int_equal((NODE)->parent_stmt, PARENT_STMT); \
+ assert_int_equal((NODE)->parent_stmt_index, PARENT_STMT_INDEX); \
assert_string_equal((NODE)->name, NAME); \
- if (HAS_PARENT) { \
- assert_non_null((NODE)->parent); \
- assert_int_equal((NODE)->parent_type, PARENT_TYPE); \
- } else { \
- assert_null((NODE)->parent); \
- } \
assert_int_equal((NODE)->format, FORMAT);
/**