tests MAINTENANCE source code formatting
diff --git a/tests/utests/schema/test_parser_yang.c b/tests/utests/schema/test_parser_yang.c
index 78eb373..c107e76 100644
--- a/tests/utests/schema/test_parser_yang.c
+++ b/tests/utests/schema/test_parser_yang.c
@@ -12,11 +12,6 @@
  *     https://opensource.org/licenses/BSD-3-Clause
  */
 
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
 #include <stdio.h>
 #include <string.h>
 
@@ -26,6 +21,7 @@
 #include "schema_compile.h"
 #include "tree_schema.h"
 #include "tree_schema_internal.h"
+#include "utests.h"
 
 /* originally static functions from tree_schema_free.c and parser_yang.c */
 void lysp_ext_instance_free(struct ly_ctx *ctx, struct lysp_ext_instance *ext);
@@ -40,10 +36,10 @@
 
 LY_ERR buf_add_char(struct ly_ctx *ctx, struct ly_in *in, size_t len, char **buf, size_t *buf_len, size_t *buf_used);
 LY_ERR buf_store_char(struct lys_yang_parser_ctx *ctx, struct ly_in *in, enum yang_arg arg, char **word_p,
-                      size_t *word_len, char **word_b, size_t *buf_len, uint8_t need_buf, uint8_t *prefix);
+        size_t *word_len, char **word_b, size_t *buf_len, uint8_t need_buf, uint8_t *prefix);
 LY_ERR get_keyword(struct lys_yang_parser_ctx *ctx, struct ly_in *in, enum ly_stmt *kw, char **word_p, size_t *word_len);
 LY_ERR get_argument(struct lys_yang_parser_ctx *ctx, struct ly_in *in, enum yang_arg arg,
-                    uint16_t *flags, char **word_p, char **word_b, size_t *word_len);
+        uint16_t *flags, char **word_p, char **word_b, size_t *word_len);
 LY_ERR skip_comment(struct lys_yang_parser_ctx *ctx, struct ly_in *in, uint8_t comment);
 
 LY_ERR parse_action(struct lys_yang_parser_ctx *ctx, struct ly_in *in, struct lysp_node *parent, struct lysp_action **actions);
@@ -90,6 +86,7 @@
         }
     }
 }
+
 #endif
 
 static void
@@ -325,7 +322,6 @@
     assert_int_equal(5, len);
     assert_false(strncmp("hello", word, len));
 
-
     in.current = "\"hello\\n\\t\\\"\\\\\";";
     assert_int_equal(LY_SUCCESS, get_argument(ctx, &in, Y_STR_ARG, NULL, &word, &buf, &len));
     assert_non_null(buf);
@@ -862,9 +858,10 @@
     return (struct lysp_submodule *)ctx->parsed_mod;
 }
 
-static LY_ERR test_imp_clb(const char *UNUSED(mod_name), const char *UNUSED(mod_rev), const char *UNUSED(submod_name),
-                           const char *UNUSED(sub_rev), void *user_data, LYS_INFORMAT *format,
-                           const char **module_data, void (**free_module_data)(void *model_data, void *user_data))
+static LY_ERR
+test_imp_clb(const char *UNUSED(mod_name), const char *UNUSED(mod_rev), const char *UNUSED(submod_name),
+        const char *UNUSED(sub_rev), void *user_data, LYS_INFORMAT *format,
+        const char **module_data, void (**free_module_data)(void *model_data, void *user_data))
 {
     *module_data = user_data;
     *format = LYS_IN_YANG;
@@ -941,36 +938,36 @@
     TEST_NODE(LYS_ANYXML, "anyxml test;}", "test");
     /* augment */
     TEST_GENERIC("augment /somepath;}", mod->augments,
-                 assert_string_equal("/somepath", mod->augments[0].nodeid));
+            assert_string_equal("/somepath", mod->augments[0].nodeid));
     /* choice */
     TEST_NODE(LYS_CHOICE, "choice test;}", "test");
     /* contact 0..1 */
     TEST_GENERIC("contact \"firstname\" + \n\t\" surname\";}", mod->mod->contact,
-                 assert_string_equal("firstname surname", mod->mod->contact));
+            assert_string_equal("firstname surname", mod->mod->contact));
     /* container */
     TEST_NODE(LYS_CONTAINER, "container test;}", "test");
     /* description 0..1 */
     TEST_GENERIC("description \'some description\';}", mod->mod->dsc,
-                 assert_string_equal("some description", mod->mod->dsc));
+            assert_string_equal("some description", mod->mod->dsc));
     /* deviation */
     TEST_GENERIC("deviation /somepath {deviate not-supported;}}", mod->deviations,
-                 assert_string_equal("/somepath", mod->deviations[0].nodeid));
+            assert_string_equal("/somepath", mod->deviations[0].nodeid));
     /* extension */
     TEST_GENERIC("extension test;}", mod->extensions,
-                 assert_string_equal("test", mod->extensions[0].name));
+            assert_string_equal("test", mod->extensions[0].name));
     /* feature */
     TEST_GENERIC("feature test;}", mod->features,
-                 assert_string_equal("test", mod->features[0].name));
+            assert_string_equal("test", mod->features[0].name));
     /* grouping */
     TEST_GENERIC("grouping grp;}", mod->groupings,
-                 assert_string_equal("grp", mod->groupings[0].name));
+            assert_string_equal("grp", mod->groupings[0].name));
     /* identity */
     TEST_GENERIC("identity test;}", mod->identities,
-                 assert_string_equal("test", mod->identities[0].name));
+            assert_string_equal("test", mod->identities[0].name));
     /* import */
     ly_ctx_set_module_imp_clb(ctx->parsed_mod->mod->ctx, test_imp_clb, "module zzz { namespace urn:zzz; prefix z;}");
     TEST_GENERIC("import zzz {prefix z;}}", mod->imports,
-                 assert_string_equal("zzz", mod->imports[0].name));
+            assert_string_equal("zzz", mod->imports[0].name));
 
     /* import - prefix collision */
     in.current = SCHEMA_BEGINNING "import zzz {prefix x;}}";
@@ -1002,7 +999,7 @@
 
     ly_ctx_set_module_imp_clb(ctx->parsed_mod->mod->ctx, test_imp_clb, "submodule xxx {belongs-to name {prefix x;}}");
     TEST_GENERIC("include xxx;}", mod->includes,
-                 assert_string_equal("xxx", mod->includes[0].name));
+            assert_string_equal("xxx", mod->includes[0].name));
 
     /* leaf */
     TEST_NODE(LYS_LEAF, "leaf test {type string;}}", "test");
@@ -1012,22 +1009,22 @@
     TEST_NODE(LYS_LIST, "list test {key a;leaf a {type string;}}}", "test");
     /* notification */
     TEST_GENERIC("notification test;}", mod->notifs,
-                 assert_string_equal("test", mod->notifs[0].name));
+            assert_string_equal("test", mod->notifs[0].name));
     /* organization 0..1 */
     TEST_GENERIC("organization \"CESNET a.l.e.\";}", mod->mod->org,
-                 assert_string_equal("CESNET a.l.e.", mod->mod->org));
+            assert_string_equal("CESNET a.l.e.", mod->mod->org));
     /* reference 0..1 */
     TEST_GENERIC("reference RFC7950;}", mod->mod->ref,
-                 assert_string_equal("RFC7950", mod->mod->ref));
+            assert_string_equal("RFC7950", mod->mod->ref));
     /* revision */
     TEST_GENERIC("revision 2018-10-12;}", mod->revs,
-                 assert_string_equal("2018-10-12", mod->revs[0].date));
+            assert_string_equal("2018-10-12", mod->revs[0].date));
     /* rpc */
     TEST_GENERIC("rpc test;}", mod->rpcs,
-                 assert_string_equal("test", mod->rpcs[0].name));
+            assert_string_equal("test", mod->rpcs[0].name));
     /* typedef */
     TEST_GENERIC("typedef test{type string;}}", mod->typedefs,
-                 assert_string_equal("test", mod->typedefs[0].name));
+            assert_string_equal("test", mod->typedefs[0].name));
     /* uses */
     TEST_NODE(LYS_USES, "uses test;}", "test");
     /* yang-version */
@@ -1075,8 +1072,8 @@
 
     /* extensions */
     TEST_GENERIC("prefix:test;}", mod->exts,
-                 assert_string_equal("prefix:test", mod->exts[0].name);
-                 assert_int_equal(LYEXT_SUBSTMT_SELF, mod->exts[0].insubstmt));
+            assert_string_equal("prefix:test", mod->exts[0].name);
+            assert_int_equal(LYEXT_SUBSTMT_SELF, mod->exts[0].insubstmt));
     mod = mod_renew(ctx);
 
     /* invalid substatement */
@@ -1277,8 +1274,8 @@
 
     /* full content */
     in.current = "cont {action x;anydata any;anyxml anyxml; choice ch;config false;container c;description test;grouping g;if-feature f; leaf l {type string;}"
-          "leaf-list ll {type string;} list li;must 'expr';notification not; presence true; reference test;status current;typedef t {type int8;}uses g;when true;m:ext;} ...";
-    assert_int_equal(LY_SUCCESS, parse_container(ctx, &in, NULL, (struct lysp_node**)&c));
+            "leaf-list ll {type string;} list li;must 'expr';notification not; presence true; reference test;status current;typedef t {type int8;}uses g;when true;m:ext;} ...";
+    assert_int_equal(LY_SUCCESS, parse_container(ctx, &in, NULL, (struct lysp_node **)&c));
     assert_non_null(c);
     assert_int_equal(LYS_CONTAINER, c->nodetype);
     assert_string_equal("cont", c->name);
@@ -1298,23 +1295,23 @@
     assert_null(c->next);
     assert_int_equal(LYS_CONFIG_R | LYS_STATUS_CURR, c->flags);
     ly_set_erase(&ctx->tpdfs_nodes, NULL);
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)c); c = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)c); c = NULL;
 
     /* invalid */
     in.current = " cont {augment /root;} ...";
-    assert_int_equal(LY_EVALID, parse_container(ctx, &in, NULL, (struct lysp_node**)&c));
+    assert_int_equal(LY_EVALID, parse_container(ctx, &in, NULL, (struct lysp_node **)&c));
     logbuf_assert("Invalid keyword \"augment\" as a child of \"container\". Line number 1.");
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)c); c = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)c); c = NULL;
     in.current = " cont {nonsence true;} ...";
-    assert_int_equal(LY_EVALID, parse_container(ctx, &in, NULL, (struct lysp_node**)&c));
+    assert_int_equal(LY_EVALID, parse_container(ctx, &in, NULL, (struct lysp_node **)&c));
     logbuf_assert("Invalid character sequence \"nonsence\", expected a keyword. Line number 1.");
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)c); c = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)c); c = NULL;
 
     ctx->parsed_mod->version = 1; /* simulate YANG 1.0 */
     in.current = " cont {action x;} ...";
-    assert_int_equal(LY_EVALID, parse_container(ctx, &in, NULL, (struct lysp_node**)&c));
+    assert_int_equal(LY_EVALID, parse_container(ctx, &in, NULL, (struct lysp_node **)&c));
     logbuf_assert("Invalid keyword \"action\" as a child of \"container\" - the statement is allowed only in YANG 1.1 modules. Line number 1.");
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)c); c = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)c); c = NULL;
 }
 
 static void
@@ -1344,8 +1341,8 @@
 
     /* full content - without mandatory which is mutual exclusive with default */
     in.current = "l {config false;default \"xxx\";description test;if-feature f;"
-          "must 'expr';reference test;status current;type string; units yyy;when true;m:ext;} ...";
-    assert_int_equal(LY_SUCCESS, parse_leaf(ctx, &in, NULL, (struct lysp_node**)&l));
+            "must 'expr';reference test;status current;type string; units yyy;when true;m:ext;} ...";
+    assert_int_equal(LY_SUCCESS, parse_leaf(ctx, &in, NULL, (struct lysp_node **)&l));
     assert_non_null(l);
     assert_int_equal(LYS_LEAF, l->nodetype);
     assert_string_equal("l", l->name);
@@ -1361,23 +1358,23 @@
     assert_null(l->parent);
     assert_null(l->next);
     assert_int_equal(LYS_CONFIG_R | LYS_STATUS_CURR, l->flags);
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)l); l = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)l); l = NULL;
 
     /* full content - now with mandatory */
     in.current = "l {mandatory true; type string;} ...";
-    assert_int_equal(LY_SUCCESS, parse_leaf(ctx, &in, NULL, (struct lysp_node**)&l));
+    assert_int_equal(LY_SUCCESS, parse_leaf(ctx, &in, NULL, (struct lysp_node **)&l));
     assert_non_null(l);
     assert_int_equal(LYS_LEAF, l->nodetype);
     assert_string_equal("l", l->name);
     assert_string_equal("string", l->type.name);
     assert_int_equal(LYS_MAND_TRUE, l->flags);
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)l); l = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)l); l = NULL;
 
     /* invalid */
     in.current = " l {description \"missing type\";} ...";
-    assert_int_equal(LY_EVALID, parse_leaf(ctx, &in, NULL, (struct lysp_node**)&l));
+    assert_int_equal(LY_EVALID, parse_leaf(ctx, &in, NULL, (struct lysp_node **)&l));
     logbuf_assert("Missing mandatory keyword \"type\" as a child of \"leaf\". Line number 1.");
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)l); l = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)l); l = NULL;
 }
 
 static void
@@ -1410,9 +1407,9 @@
 
     /* full content - without min-elements which is mutual exclusive with default */
     in.current = "ll {config false;default \"xxx\"; default \"yyy\";description test;if-feature f;"
-          "max-elements 10;must 'expr';ordered-by user;reference test;"
-          "status current;type string; units zzz;when true;m:ext;} ...";
-    assert_int_equal(LY_SUCCESS, parse_leaflist(ctx, &in, NULL, (struct lysp_node**)&ll));
+            "max-elements 10;must 'expr';ordered-by user;reference test;"
+            "status current;type string; units zzz;when true;m:ext;} ...";
+    assert_int_equal(LY_SUCCESS, parse_leaflist(ctx, &in, NULL, (struct lysp_node **)&ll));
     assert_non_null(ll);
     assert_int_equal(LYS_LEAFLIST, ll->nodetype);
     assert_string_equal("ll", ll->name);
@@ -1433,11 +1430,11 @@
     assert_null(ll->parent);
     assert_null(ll->next);
     assert_int_equal(LYS_CONFIG_R | LYS_STATUS_CURR | LYS_ORDBY_USER | LYS_SET_MAX, ll->flags);
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)ll); ll = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)ll); ll = NULL;
 
     /* full content - now with min-elements */
     in.current = "ll {min-elements 10; type string;} ...";
-    assert_int_equal(LY_SUCCESS, parse_leaflist(ctx, &in, NULL, (struct lysp_node**)&ll));
+    assert_int_equal(LY_SUCCESS, parse_leaflist(ctx, &in, NULL, (struct lysp_node **)&ll));
     assert_non_null(ll);
     assert_int_equal(LYS_LEAFLIST, ll->nodetype);
     assert_string_equal("ll", ll->name);
@@ -1445,19 +1442,19 @@
     assert_int_equal(0, ll->max);
     assert_int_equal(10, ll->min);
     assert_int_equal(LYS_SET_MIN, ll->flags);
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)ll); ll = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)ll); ll = NULL;
 
     /* invalid */
     in.current = " ll {description \"missing type\";} ...";
-    assert_int_equal(LY_EVALID, parse_leaflist(ctx, &in, NULL, (struct lysp_node**)&ll));
+    assert_int_equal(LY_EVALID, parse_leaflist(ctx, &in, NULL, (struct lysp_node **)&ll));
     logbuf_assert("Missing mandatory keyword \"type\" as a child of \"leaf-list\". Line number 1.");
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)ll); ll = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)ll); ll = NULL;
 
     ctx->parsed_mod->version = 1; /* simulate YANG 1.0 - default statement is not allowed */
     in.current = " ll {default xx; type string;} ...";
-    assert_int_equal(LY_EVALID, parse_leaflist(ctx, &in, NULL, (struct lysp_node**)&ll));
+    assert_int_equal(LY_EVALID, parse_leaflist(ctx, &in, NULL, (struct lysp_node **)&ll));
     logbuf_assert("Invalid keyword \"default\" as a child of \"leaf-list\" - the statement is allowed only in YANG 1.1 modules. Line number 1.");
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)ll); ll = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)ll); ll = NULL;
 }
 
 static void
@@ -1489,9 +1486,9 @@
 
     /* full content */
     in.current = "l {action x;anydata any;anyxml anyxml; choice ch;config false;container c;description test;grouping g;if-feature f; key l; leaf l {type string;}"
-          "leaf-list ll {type string;} list li;max-elements 10; min-elements 1;must 'expr';notification not; ordered-by system; reference test;"
-          "status current;typedef t {type int8;}unique xxx;unique yyy;uses g;when true;m:ext;} ...";
-    assert_int_equal(LY_SUCCESS, parse_list(ctx, &in, NULL, (struct lysp_node**)&l));
+            "leaf-list ll {type string;} list li;max-elements 10; min-elements 1;must 'expr';notification not; ordered-by system; reference test;"
+            "status current;typedef t {type int8;}unique xxx;unique yyy;uses g;when true;m:ext;} ...";
+    assert_int_equal(LY_SUCCESS, parse_list(ctx, &in, NULL, (struct lysp_node **)&l));
     assert_non_null(l);
     assert_int_equal(LYS_LIST, l->nodetype);
     assert_string_equal("l", l->name);
@@ -1512,14 +1509,14 @@
     assert_null(l->next);
     assert_int_equal(LYS_CONFIG_R | LYS_STATUS_CURR | LYS_ORDBY_SYSTEM | LYS_SET_MAX | LYS_SET_MIN, l->flags);
     ly_set_erase(&ctx->tpdfs_nodes, NULL);
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)l); l = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)l); l = NULL;
 
     /* invalid content */
     ctx->parsed_mod->version = 1; /* simulate YANG 1.0 */
     in.current = "l {action x;} ...";
-    assert_int_equal(LY_EVALID, parse_list(ctx, &in, NULL, (struct lysp_node**)&l));
+    assert_int_equal(LY_EVALID, parse_list(ctx, &in, NULL, (struct lysp_node **)&l));
     logbuf_assert("Invalid keyword \"action\" as a child of \"list\" - the statement is allowed only in YANG 1.1 modules. Line number 1.");
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)l); l = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)l); l = NULL;
 }
 
 static void
@@ -1549,8 +1546,8 @@
 
     /* full content - without default due to a collision with mandatory */
     in.current = "ch {anydata any;anyxml anyxml; case c;choice ch;config false;container c;description test;if-feature f;leaf l {type string;}"
-          "leaf-list ll {type string;} list li;mandatory true;reference test;status current;when true;m:ext;} ...";
-    assert_int_equal(LY_SUCCESS, parse_choice(ctx, &in, NULL, (struct lysp_node**)&ch));
+            "leaf-list ll {type string;} list li;mandatory true;reference test;status current;when true;m:ext;} ...";
+    assert_int_equal(LY_SUCCESS, parse_choice(ctx, &in, NULL, (struct lysp_node **)&ch));
     assert_non_null(ch);
     assert_int_equal(LYS_CHOICE, ch->nodetype);
     assert_string_equal("ch", ch->name);
@@ -1562,17 +1559,17 @@
     assert_null(ch->parent);
     assert_null(ch->next);
     assert_int_equal(LYS_CONFIG_R | LYS_STATUS_CURR | LYS_MAND_TRUE, ch->flags);
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)ch); ch = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)ch); ch = NULL;
 
     /* full content - the default missing from the previous node */
     in.current = "ch {default c;case c;} ...";
-    assert_int_equal(LY_SUCCESS, parse_choice(ctx, &in, NULL, (struct lysp_node**)&ch));
+    assert_int_equal(LY_SUCCESS, parse_choice(ctx, &in, NULL, (struct lysp_node **)&ch));
     assert_non_null(ch);
     assert_int_equal(LYS_CHOICE, ch->nodetype);
     assert_string_equal("ch", ch->name);
     assert_string_equal("c", ch->dflt.str);
     assert_int_equal(0, ch->flags);
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)ch); ch = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)ch); ch = NULL;
 }
 
 static void
@@ -1599,8 +1596,8 @@
 
     /* full content */
     in.current = "cs {anydata any;anyxml anyxml; choice ch;container c;description test;if-feature f;leaf l {type string;}"
-          "leaf-list ll {type string;} list li;reference test;status current;uses grp;when true;m:ext;} ...";
-    assert_int_equal(LY_SUCCESS, parse_case(ctx, &in, NULL, (struct lysp_node**)&cs));
+            "leaf-list ll {type string;} list li;reference test;status current;uses grp;when true;m:ext;} ...";
+    assert_int_equal(LY_SUCCESS, parse_case(ctx, &in, NULL, (struct lysp_node **)&cs));
     assert_non_null(cs);
     assert_int_equal(LYS_CASE, cs->nodetype);
     assert_string_equal("cs", cs->name);
@@ -1612,13 +1609,13 @@
     assert_null(cs->parent);
     assert_null(cs->next);
     assert_int_equal(LYS_STATUS_CURR, cs->flags);
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)cs); cs = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)cs); cs = NULL;
 
     /* invalid content */
     in.current = "cs {config true} ...";
-    assert_int_equal(LY_EVALID, parse_case(ctx, &in, NULL, (struct lysp_node**)&cs));
+    assert_int_equal(LY_EVALID, parse_case(ctx, &in, NULL, (struct lysp_node **)&cs));
     logbuf_assert("Invalid keyword \"config\" as a child of \"case\". Line number 1.");
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)cs); cs = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)cs); cs = NULL;
 }
 
 static void
@@ -1651,7 +1648,7 @@
 
     /* full content */
     in.current = "any {config true;description test;if-feature f;mandatory true;must 'expr';reference test;status current;when true;m:ext;} ...";
-    assert_int_equal(LY_SUCCESS, parse_any(ctx, &in, kw, NULL, (struct lysp_node**)&any));
+    assert_int_equal(LY_SUCCESS, parse_any(ctx, &in, kw, NULL, (struct lysp_node **)&any));
     assert_non_null(any);
     assert_int_equal(kw == LY_STMT_ANYDATA ? LYS_ANYDATA : LYS_ANYXML, any->nodetype);
     assert_string_equal("any", any->name);
@@ -1664,7 +1661,7 @@
     assert_null(any->parent);
     assert_null(any->next);
     assert_int_equal(LYS_CONFIG_W | LYS_STATUS_CURR | LYS_MAND_TRUE, any->flags);
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)any); any = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)any); any = NULL;
 }
 
 static void
@@ -1702,7 +1699,7 @@
 
     /* full content */
     in.current = "grp {action x;anydata any;anyxml anyxml; choice ch;container c;description test;grouping g;leaf l {type string;}"
-          "leaf-list ll {type string;} list li;notification not;reference test;status current;typedef t {type int8;}uses g;m:ext;} ...";
+            "leaf-list ll {type string;} list li;notification not;reference test;status current;typedef t {type int8;}uses g;m:ext;} ...";
     assert_int_equal(LY_SUCCESS, parse_grouping(ctx, &in, NULL, &grp));
     assert_non_null(grp);
     assert_int_equal(LYS_GROUPING, grp->nodetype);
@@ -1711,7 +1708,7 @@
     assert_non_null(grp->exts);
     assert_string_equal("test", grp->ref);
     assert_null(grp->parent);
-    assert_int_equal( LYS_STATUS_CURR, grp->flags);
+    assert_int_equal(LYS_STATUS_CURR, grp->flags);
     ly_set_erase(&ctx->tpdfs_nodes, NULL);
     FREE_ARRAY(ctx->parsed_mod->mod->ctx, grp, lysp_grp_free); grp = NULL;
 
@@ -1753,13 +1750,13 @@
 
     /* full content */
     in.current = "top;";
-    assert_int_equal(LY_SUCCESS, parse_container(ctx, &in, NULL, (struct lysp_node**)&c));
+    assert_int_equal(LY_SUCCESS, parse_container(ctx, &in, NULL, (struct lysp_node **)&c));
     in.current = "func {description test;grouping grp;if-feature f;reference test;status current;typedef mytype {type int8;} m:ext;"
-          "input {anydata a1; anyxml a2; choice ch; container c; grouping grp; leaf l {type int8;} leaf-list ll {type int8;}"
-          " list li; must 1; typedef mytypei {type int8;} uses grp; m:ext;}"
-          "output {anydata a1; anyxml a2; choice ch; container c; grouping grp; leaf l {type int8;} leaf-list ll {type int8;}"
-          " list li; must 1; typedef mytypeo {type int8;} uses grp; m:ext;}} ...";
-    assert_int_equal(LY_SUCCESS, parse_action(ctx, &in, (struct lysp_node*)c, &rpcs));
+            "input {anydata a1; anyxml a2; choice ch; container c; grouping grp; leaf l {type int8;} leaf-list ll {type int8;}"
+            " list li; must 1; typedef mytypei {type int8;} uses grp; m:ext;}"
+            "output {anydata a1; anyxml a2; choice ch; container c; grouping grp; leaf l {type int8;} leaf-list ll {type int8;}"
+            " list li; must 1; typedef mytypeo {type int8;} uses grp; m:ext;}} ...";
+    assert_int_equal(LY_SUCCESS, parse_action(ctx, &in, (struct lysp_node *)c, &rpcs));
     assert_non_null(rpcs);
     assert_int_equal(LYS_ACTION, rpcs->nodetype);
     assert_string_equal("func", rpcs->name);
@@ -1794,7 +1791,7 @@
     logbuf_assert("Invalid keyword \"config\" as a child of \"rpc\". Line number 1.");
     FREE_ARRAY(ctx->parsed_mod->mod->ctx, rpcs, lysp_action_free); rpcs = NULL;
 
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)c);
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)c);
 }
 
 static void
@@ -1821,10 +1818,10 @@
 
     /* full content */
     in.current = "top;";
-    assert_int_equal(LY_SUCCESS, parse_container(ctx, &in, NULL, (struct lysp_node**)&c));
+    assert_int_equal(LY_SUCCESS, parse_container(ctx, &in, NULL, (struct lysp_node **)&c));
     in.current = "ntf {anydata a1; anyxml a2; choice ch; container c; description test; grouping grp; if-feature f; leaf l {type int8;}"
-          "leaf-list ll {type int8;} list li; must 1; reference test; status current; typedef mytype {type int8;} uses grp; m:ext;}";
-    assert_int_equal(LY_SUCCESS, parse_notif(ctx, &in, (struct lysp_node*)c, &notifs));
+            "leaf-list ll {type int8;} list li; must 1; reference test; status current; typedef mytype {type int8;} uses grp; m:ext;}";
+    assert_int_equal(LY_SUCCESS, parse_notif(ctx, &in, (struct lysp_node *)c, &notifs));
     assert_non_null(notifs);
     assert_int_equal(LYS_NOTIF, notifs->nodetype);
     assert_string_equal("ntf", notifs->name);
@@ -1847,7 +1844,7 @@
     logbuf_assert("Invalid keyword \"config\" as a child of \"notification\". Line number 1.");
     FREE_ARRAY(ctx->parsed_mod->mod->ctx, notifs, lysp_notif_free); notifs = NULL;
 
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)c);
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)c);
 }
 
 static void
@@ -1874,7 +1871,7 @@
 
     /* full content */
     in.current = "grpref {augment some/node;description test;if-feature f;reference test;refine some/other/node;status current;when true;m:ext;} ...";
-    assert_int_equal(LY_SUCCESS, parse_uses(ctx, &in, NULL, (struct lysp_node**)&u));
+    assert_int_equal(LY_SUCCESS, parse_uses(ctx, &in, NULL, (struct lysp_node **)&u));
     assert_non_null(u);
     assert_int_equal(LYS_USES, u->nodetype);
     assert_string_equal("grpref", u->name);
@@ -1888,7 +1885,7 @@
     assert_null(u->parent);
     assert_null(u->next);
     assert_int_equal(LYS_STATUS_CURR, u->flags);
-    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node*)u); u = NULL;
+    lysp_node_free(ctx->parsed_mod->mod->ctx, (struct lysp_node *)u); u = NULL;
 }
 
 static void
@@ -1915,7 +1912,7 @@
 
     /* full content */
     in.current = "/target/nodeid {action x; anydata any;anyxml anyxml; case cs; choice ch;container c;description test;if-feature f;leaf l {type string;}"
-          "leaf-list ll {type string;} list li;notification not;reference test;status current;uses g;when true;m:ext;} ...";
+            "leaf-list ll {type string;} list li;notification not;reference test;status current;uses g;when true;m:ext;} ...";
     assert_int_equal(LY_SUCCESS, parse_augment(ctx, &in, NULL, &a));
     assert_non_null(a);
     assert_int_equal(LYS_AUGMENT, a->nodetype);
@@ -1987,7 +1984,8 @@
     logbuf_assert("Invalid value \"-0\" of \"position\". Line number 1.");
 }
 
-int main(void)
+int
+main(void)
 {
     const struct CMUnitTest tests[] = {
         cmocka_unit_test_setup_teardown(test_helpers, setup_f, teardown_f),
diff --git a/tests/utests/schema/test_parser_yin.c b/tests/utests/schema/test_parser_yin.c
index 728fe36..fe33de4 100644
--- a/tests/utests/schema/test_parser_yin.c
+++ b/tests/utests/schema/test_parser_yin.c
@@ -12,14 +12,9 @@
  *     https://opensource.org/licenses/BSD-3-Clause
  */
 
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
+#include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
-#include <stdbool.h>
 
 #include "common.h"
 #include "in.h"
@@ -27,6 +22,7 @@
 #include "schema_compile.h"
 #include "tree_schema.h"
 #include "tree_schema_internal.h"
+#include "utests.h"
 #include "xml.h"
 #include "xpath.h"
 
@@ -156,6 +152,7 @@
         }
     }
 }
+
 #endif
 
 #if ENABLE_LOGGER_CHECKING
@@ -192,6 +189,7 @@
 destroy_ly_ctx(void **state)
 {
     struct test_parser_yin_state *st = *state;
+
     ly_ctx_destroy(st->ctx, NULL);
     free(st);
 
@@ -232,7 +230,7 @@
 
 #if ENABLE_LOGGER_CHECKING
     /* teardown logger */
-    if (!st->finished_correctly && logbuf[0] != '\0') {
+    if (!st->finished_correctly && (logbuf[0] != '\0')) {
         fprintf(stderr, "%s\n", logbuf);
     }
 #endif
@@ -245,7 +243,7 @@
     return EXIT_SUCCESS;
 }
 
-static struct test_parser_yin_state*
+static struct test_parser_yin_state *
 reset_state(void **state)
 {
     ((struct test_parser_yin_state *)*state)->finished_correctly = true;
@@ -284,6 +282,7 @@
     size_t prefix_len;
     /* create mock yin namespace in xml context */
     const char *data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" />";
+
     ly_in_new_memory(data, &st->in);
     lyxml_ctx_new(st->ctx, st->in, &st->yin_ctx->xmlctx);
     prefix = st->yin_ctx->xmlctx->prefix;
@@ -392,6 +391,7 @@
     memset(&exts, 0, sizeof(exts));
 
     const char *data = "<myext:elem attr=\"value\" xmlns:myext=\"urn:example:extensions\">text_value</myext:elem>";
+
     ly_in_new_memory(data, &st->in);
     lyxml_ctx_new(st->ctx, st->in, &st->yin_ctx->xmlctx);
 
@@ -428,6 +428,7 @@
     struct test_parser_yin_state *st = *state;
     struct lysp_ext_instance *exts = NULL;
     const char *data = "<myext:ext value1=\"test\" value=\"test2\" xmlns:myext=\"urn:example:extensions\"><myext:subelem>text</myext:subelem></myext:ext>";
+
     ly_in_new_memory(data, &st->in);
     lyxml_ctx_new(st->ctx, st->in, &st->yin_ctx->xmlctx);
 
@@ -473,15 +474,16 @@
     exts = NULL;
     st = reset_state(state);
 
-    data = "<myext:ext attr1=\"text1\" attr2=\"text2\" xmlns:myext=\"urn:example:extensions\">"
-                "<myext:ext-sub1/>"
-                "<myext:ext-sub2 sattr1=\"stext2\">"
-                    "<myext:ext-sub21>"
-                        "<myext:ext-sub211 sattr21=\"text21\"/>"
-                    "</myext:ext-sub21>"
-                "</myext:ext-sub2>"
-                "<myext:ext-sub3 attr3=\"text3\"></myext:ext-sub3>"
-           "</myext:ext>";
+    data =
+            "<myext:ext attr1=\"text1\" attr2=\"text2\" xmlns:myext=\"urn:example:extensions\">\n"
+            "     <myext:ext-sub1/>\n"
+            "     <myext:ext-sub2 sattr1=\"stext2\">\n"
+            "         <myext:ext-sub21>\n"
+            "             <myext:ext-sub211 sattr21=\"text21\"/>\n"
+            "         </myext:ext-sub21>\n"
+            "     </myext:ext-sub2>\n"
+            "     <myext:ext-sub3 attr3=\"text3\"></myext:ext-sub3>\n"
+            "</myext:ext>";
     ly_in_new_memory(data, &st->in);
     lyxml_ctx_new(st->ctx, st->in, &st->yin_ctx->xmlctx);
 
@@ -548,19 +550,20 @@
     exts = NULL;
     st = reset_state(state);
 
-    data = "<myext:extension-elem xmlns:myext=\"urn:example:extensions\" xmlns:yin=\"urn:ietf:params:xml:ns:yang:yin:1\">"
-                "<yin:action name=\"act-name\" pre:prefixed=\"ignored\"/>"
-                "<yin:augment target-node=\"target\"/>"
-                "<yin:status value=\"value\"/>"
-                "<yin:include module=\"mod\"/>"
-                "<yin:input />"
-                "<yin:must condition=\"cond\"/>"
-                "<yin:namespace uri=\"uri\"/>"
-                "<yin:revision date=\"data\"/>"
-                "<yin:unique tag=\"tag\"/>"
-                "<yin:description><yin:text>contact-val</yin:text></yin:description>"
-                "<yin:error-message><yin:value>err-msg</yin:value></yin:error-message>"
-           "</myext:extension-elem>";
+    data =
+            "<myext:extension-elem xmlns:myext=\"urn:example:extensions\" xmlns:yin=\"urn:ietf:params:xml:ns:yang:yin:1\">\n"
+            "     <yin:action name=\"act-name\" pre:prefixed=\"ignored\"/>\n"
+            "     <yin:augment target-node=\"target\"/>\n"
+            "     <yin:status value=\"value\"/>\n"
+            "     <yin:include module=\"mod\"/>\n"
+            "     <yin:input />\n"
+            "     <yin:must condition=\"cond\"/>\n"
+            "     <yin:namespace uri=\"uri\"/>\n"
+            "     <yin:revision date=\"data\"/>\n"
+            "     <yin:unique tag=\"tag\"/>\n"
+            "     <yin:description><yin:text>contact-val</yin:text></yin:description>\n"
+            "     <yin:error-message><yin:value>err-msg</yin:value></yin:error-message>\n"
+            "</myext:extension-elem>";
     ly_in_new_memory(data, &st->in);
     lyxml_ctx_new(st->ctx, st->in, &st->yin_ctx->xmlctx);
 
@@ -589,40 +592,39 @@
 {
     struct test_parser_yin_state *st = *state;
     LY_ERR ret = LY_SUCCESS;
-    const char *data = "<prefix value=\"a_mod\" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">"
-                            "<myext:custom xmlns:myext=\"urn:example:extensions\">"
-                                "totally amazing extension"
-                            "</myext:custom>"
-                            "<extension name=\"ext\">"
-                                "<argument name=\"argname\"></argument>"
-                                "<description><text>desc</text></description>"
-                                "<reference><text>ref</text></reference>"
-                                "<status value=\"deprecated\"></status>"
-                            "</extension>"
-                            "<text xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">wsefsdf</text>"
-                            "<if-feature name=\"foo\"></if-feature>"
-                            "<when condition=\"condition...\">"
-                                "<reference><text>when_ref</text></reference>"
-                                "<description><text>when_desc</text></description>"
-                            "</when>"
-                            "<config value=\"true\"/>"
-                            "<error-message>"
-                                "<value>error-msg</value>"
-                            "</error-message>"
-                            "<error-app-tag value=\"err-app-tag\"/>"
-                            "<units name=\"radians\"></units>"
-                            "<default value=\"default-value\"/>"
-                            "<position value=\"25\"></position>"
-                            "<value value=\"-5\"/>"
-                            "<require-instance value=\"true\"></require-instance>"
-                            "<range value=\"5..10\" />"
-                            "<length value=\"baf\"/>"
-                            "<pattern value='pattern'>"
-                                "<modifier value='invert-match'/>"
-                            "</pattern>"
-                            "<enum name=\"yay\">"
-                            "</enum>"
-                        "</prefix>";
+    const char *data =
+            "<prefix value=\"a_mod\" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">\n"
+            "    <myext:custom xmlns:myext=\"urn:example:extensions\">totally amazing extension</myext:custom>\n"
+            "    <extension name=\"ext\">\n"
+            "        <argument name=\"argname\"></argument>\n"
+            "        <description><text>desc</text></description>\n"
+            "        <reference><text>ref</text></reference>\n"
+            "        <status value=\"deprecated\"></status>\n"
+            "    </extension>\n"
+            "    <text xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">wsefsdf</text>\n"
+            "    <if-feature name=\"foo\"></if-feature>\n"
+            "    <when condition=\"condition...\">\n"
+            "        <reference><text>when_ref</text></reference>\n"
+            "        <description><text>when_desc</text></description>\n"
+            "    </when>\n"
+            "    <config value=\"true\"/>\n"
+            "    <error-message>\n"
+            "        <value>error-msg</value>\n"
+            "    </error-message>\n"
+            "    <error-app-tag value=\"err-app-tag\"/>\n"
+            "    <units name=\"radians\"></units>\n"
+            "    <default value=\"default-value\"/>\n"
+            "    <position value=\"25\"></position>\n"
+            "    <value value=\"-5\"/>\n"
+            "    <require-instance value=\"true\"></require-instance>\n"
+            "    <range value=\"5..10\" />\n"
+            "    <length value=\"baf\"/>\n"
+            "    <pattern value='pattern'>\n"
+            "        <modifier value='invert-match'/>\n"
+            "    </pattern>\n"
+            "    <enum name=\"yay\">\n"
+            "    </enum>\n"
+            "</prefix>";
     struct lysp_ext_instance *exts = NULL;
     const char **if_features = NULL;
     const char *value, *err_msg, *app_tag, *units;
@@ -640,24 +642,25 @@
     lyxml_ctx_next(st->yin_ctx->xmlctx);
 
     struct yin_subelement subelems[17] = {
-                                            {LY_STMT_CONFIG, &config, 0},
-                                            {LY_STMT_DEFAULT, &def, YIN_SUBELEM_UNIQUE},
-                                            {LY_STMT_ENUM, &enum_type, 0},
-                                            {LY_STMT_ERROR_APP_TAG, &app_tag, YIN_SUBELEM_UNIQUE},
-                                            {LY_STMT_ERROR_MESSAGE, &err_msg, 0},
-                                            {LY_STMT_EXTENSION, &ext_def, 0},
-                                            {LY_STMT_IF_FEATURE, &if_features, 0},
-                                            {LY_STMT_LENGTH, &len_type, 0},
-                                            {LY_STMT_PATTERN, &patter_type, 0},
-                                            {LY_STMT_POSITION, &pos_enum, 0},
-                                            {LY_STMT_RANGE, &range_type, 0},
-                                            {LY_STMT_REQUIRE_INSTANCE, &req_type, 0},
-                                            {LY_STMT_UNITS, &units, YIN_SUBELEM_UNIQUE},
-                                            {LY_STMT_VALUE, &val_enum, 0},
-                                            {LY_STMT_WHEN, &when_p, 0},
-                                            {LY_STMT_EXTENSION_INSTANCE, NULL, 0},
-                                            {LY_STMT_ARG_TEXT, &value, 0}
-                                         };
+        {LY_STMT_CONFIG, &config, 0},
+        {LY_STMT_DEFAULT, &def, YIN_SUBELEM_UNIQUE},
+        {LY_STMT_ENUM, &enum_type, 0},
+        {LY_STMT_ERROR_APP_TAG, &app_tag, YIN_SUBELEM_UNIQUE},
+        {LY_STMT_ERROR_MESSAGE, &err_msg, 0},
+        {LY_STMT_EXTENSION, &ext_def, 0},
+        {LY_STMT_IF_FEATURE, &if_features, 0},
+        {LY_STMT_LENGTH, &len_type, 0},
+        {LY_STMT_PATTERN, &patter_type, 0},
+        {LY_STMT_POSITION, &pos_enum, 0},
+        {LY_STMT_RANGE, &range_type, 0},
+        {LY_STMT_REQUIRE_INSTANCE, &req_type, 0},
+        {LY_STMT_UNITS, &units, YIN_SUBELEM_UNIQUE},
+        {LY_STMT_VALUE, &val_enum, 0},
+        {LY_STMT_WHEN, &when_p, 0},
+        {LY_STMT_EXTENSION_INSTANCE, NULL, 0},
+        {LY_STMT_ARG_TEXT, &value, 0}
+    };
+
     ret = yin_parse_content(st->yin_ctx, subelems, 17, LY_STMT_PREFIX, NULL, &exts);
     assert_int_equal(ret, LY_SUCCESS);
     /* check parsed values */
@@ -712,12 +715,13 @@
     /* test unique subelem */
     const char *prefix_value;
     struct yin_subelement subelems2[2] = {{LY_STMT_PREFIX, &prefix_value, YIN_SUBELEM_UNIQUE},
-                                         {LY_STMT_ARG_TEXT, &value, YIN_SUBELEM_UNIQUE}};
+        {LY_STMT_ARG_TEXT, &value, YIN_SUBELEM_UNIQUE}};
+
     data = ELEMENT_WRAPPER_START
-                "<prefix value=\"inv_mod\" />"
-                "<text xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">wsefsdf</text>"
-                "<text xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">wsefsdf</text>"
-           ELEMENT_WRAPPER_END;
+            "<prefix value=\"inv_mod\" />"
+            "<text xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">wsefsdf</text>"
+            "<text xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">wsefsdf</text>"
+            ELEMENT_WRAPPER_END;
     ly_in_new_memory(data, &st->in);
     lyxml_ctx_new(st->ctx, st->in, &st->yin_ctx->xmlctx);
     lyxml_ctx_next(st->yin_ctx->xmlctx);
@@ -731,12 +735,13 @@
 
     /* test first subelem */
     data = ELEMENT_WRAPPER_START
-                "<prefix value=\"inv_mod\" />"
-                "<text xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">wsefsdf</text>"
-                "<text xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">wsefsdf</text>"
-           ELEMENT_WRAPPER_END;
+            "<prefix value=\"inv_mod\" />"
+            "<text xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">wsefsdf</text>"
+            "<text xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">wsefsdf</text>"
+            ELEMENT_WRAPPER_END;
     struct yin_subelement subelems3[2] = {{LY_STMT_PREFIX, &prefix_value, YIN_SUBELEM_UNIQUE},
-                                         {LY_STMT_ARG_TEXT, &value, YIN_SUBELEM_FIRST}};
+        {LY_STMT_ARG_TEXT, &value, YIN_SUBELEM_FIRST}};
+
     ly_in_new_memory(data, &st->in);
     lyxml_ctx_new(st->ctx, st->in, &st->yin_ctx->xmlctx);
     lyxml_ctx_next(st->yin_ctx->xmlctx);
@@ -750,6 +755,7 @@
     /* test mandatory subelem */
     data = ELEMENT_WRAPPER_START ELEMENT_WRAPPER_END;
     struct yin_subelement subelems4[1] = {{LY_STMT_PREFIX, &prefix_value, YIN_SUBELEM_MANDATORY | YIN_SUBELEM_UNIQUE}};
+
     ly_in_new_memory(data, &st->in);
     lyxml_ctx_new(st->ctx, st->in, &st->yin_ctx->xmlctx);
     lyxml_ctx_next(st->yin_ctx->xmlctx);
@@ -802,78 +808,79 @@
     size_t name_len, prefix_len;
     LY_ERR ret = LY_SUCCESS;
     struct yin_subelement subelems[71] = {
-                                            {LY_STMT_ACTION, dest, 0},
-                                            {LY_STMT_ANYDATA, dest, 0},
-                                            {LY_STMT_ANYXML, dest, 0},
-                                            {LY_STMT_ARGUMENT,dest, 0},
-                                            {LY_STMT_AUGMENT, dest, 0},
-                                            {LY_STMT_BASE, dest, 0},
-                                            {LY_STMT_BELONGS_TO, dest, 0},
-                                            {LY_STMT_BIT, dest, 0},
-                                            {LY_STMT_CASE, dest, 0},
-                                            {LY_STMT_CHOICE, dest, 0},
-                                            {LY_STMT_CONFIG, dest, 0},
-                                            {LY_STMT_CONTACT, dest, 0},
-                                            {LY_STMT_CONTAINER, dest, 0},
-                                            {LY_STMT_DEFAULT, dest, YIN_SUBELEM_UNIQUE},
-                                            {LY_STMT_DESCRIPTION, dest, 0},
-                                            {LY_STMT_DEVIATE, dest, 0},
-                                            {LY_STMT_DEVIATION, dest, 0},
-                                            {LY_STMT_ENUM, dest, 0},
-                                            {LY_STMT_ERROR_APP_TAG, dest, YIN_SUBELEM_UNIQUE},
-                                            {LY_STMT_ERROR_MESSAGE, dest, 0},
-                                            {LY_STMT_EXTENSION, dest, 0},
-                                            {LY_STMT_FEATURE, dest, 0},
-                                            {LY_STMT_FRACTION_DIGITS, dest, 0},
-                                            {LY_STMT_GROUPING, dest, 0},
-                                            {LY_STMT_IDENTITY, dest, 0},
-                                            {LY_STMT_IF_FEATURE, dest, 0},
-                                            {LY_STMT_IMPORT, dest, 0},
-                                            {LY_STMT_INCLUDE, dest, 0},
-                                            {LY_STMT_INPUT, dest, 0},
-                                            {LY_STMT_KEY, dest, YIN_SUBELEM_UNIQUE},
-                                            {LY_STMT_LEAF, dest, 0},
-                                            {LY_STMT_LEAF_LIST, dest, 0},
-                                            {LY_STMT_LENGTH, dest, 0},
-                                            {LY_STMT_LIST, dest, 0},
-                                            {LY_STMT_MANDATORY, dest, 0},
-                                            {LY_STMT_MAX_ELEMENTS, dest, 0},
-                                            {LY_STMT_MIN_ELEMENTS, dest, 0},
-                                            {LY_STMT_MODIFIER, dest, 0},
-                                            {LY_STMT_MODULE, dest, 0},
-                                            {LY_STMT_MUST, dest, 0},
-                                            {LY_STMT_NAMESPACE, dest, YIN_SUBELEM_UNIQUE},
-                                            {LY_STMT_NOTIFICATION, dest, 0},
-                                            {LY_STMT_ORDERED_BY, dest, 0},
-                                            {LY_STMT_ORGANIZATION, dest, 0},
-                                            {LY_STMT_OUTPUT, dest, 0},
-                                            {LY_STMT_PATH, dest, 0},
-                                            {LY_STMT_PATTERN, dest, 0},
-                                            {LY_STMT_POSITION, dest, 0},
-                                            {LY_STMT_PREFIX, dest, YIN_SUBELEM_UNIQUE},
-                                            {LY_STMT_PRESENCE, dest, YIN_SUBELEM_UNIQUE},
-                                            {LY_STMT_RANGE, dest, 0},
-                                            {LY_STMT_REFERENCE, dest, 0},
-                                            {LY_STMT_REFINE, dest, 0},
-                                            {LY_STMT_REQUIRE_INSTANCE, dest, 0},
-                                            {LY_STMT_REVISION, dest, 0},
-                                            {LY_STMT_REVISION_DATE, dest, 0},
-                                            {LY_STMT_RPC, dest, 0},
-                                            {LY_STMT_STATUS, dest, 0},
-                                            {LY_STMT_SUBMODULE, dest, 0},
-                                            {LY_STMT_TYPE, dest, 0},
-                                            {LY_STMT_TYPEDEF, dest, 0},
-                                            {LY_STMT_UNIQUE, dest, 0},
-                                            {LY_STMT_UNITS, dest, YIN_SUBELEM_UNIQUE},
-                                            {LY_STMT_USES, dest, 0},
-                                            {LY_STMT_VALUE, dest, 0},
-                                            {LY_STMT_WHEN, dest, 0},
-                                            {LY_STMT_YANG_VERSION, dest, 0},
-                                            {LY_STMT_YIN_ELEMENT, dest, 0},
-                                            {LY_STMT_EXTENSION_INSTANCE, dest, 0},
-                                            {LY_STMT_ARG_TEXT, dest, 0},
-                                            {LY_STMT_ARG_VALUE, dest, 0}
-                                        };
+        {LY_STMT_ACTION, dest, 0},
+        {LY_STMT_ANYDATA, dest, 0},
+        {LY_STMT_ANYXML, dest, 0},
+        {LY_STMT_ARGUMENT, dest, 0},
+        {LY_STMT_AUGMENT, dest, 0},
+        {LY_STMT_BASE, dest, 0},
+        {LY_STMT_BELONGS_TO, dest, 0},
+        {LY_STMT_BIT, dest, 0},
+        {LY_STMT_CASE, dest, 0},
+        {LY_STMT_CHOICE, dest, 0},
+        {LY_STMT_CONFIG, dest, 0},
+        {LY_STMT_CONTACT, dest, 0},
+        {LY_STMT_CONTAINER, dest, 0},
+        {LY_STMT_DEFAULT, dest, YIN_SUBELEM_UNIQUE},
+        {LY_STMT_DESCRIPTION, dest, 0},
+        {LY_STMT_DEVIATE, dest, 0},
+        {LY_STMT_DEVIATION, dest, 0},
+        {LY_STMT_ENUM, dest, 0},
+        {LY_STMT_ERROR_APP_TAG, dest, YIN_SUBELEM_UNIQUE},
+        {LY_STMT_ERROR_MESSAGE, dest, 0},
+        {LY_STMT_EXTENSION, dest, 0},
+        {LY_STMT_FEATURE, dest, 0},
+        {LY_STMT_FRACTION_DIGITS, dest, 0},
+        {LY_STMT_GROUPING, dest, 0},
+        {LY_STMT_IDENTITY, dest, 0},
+        {LY_STMT_IF_FEATURE, dest, 0},
+        {LY_STMT_IMPORT, dest, 0},
+        {LY_STMT_INCLUDE, dest, 0},
+        {LY_STMT_INPUT, dest, 0},
+        {LY_STMT_KEY, dest, YIN_SUBELEM_UNIQUE},
+        {LY_STMT_LEAF, dest, 0},
+        {LY_STMT_LEAF_LIST, dest, 0},
+        {LY_STMT_LENGTH, dest, 0},
+        {LY_STMT_LIST, dest, 0},
+        {LY_STMT_MANDATORY, dest, 0},
+        {LY_STMT_MAX_ELEMENTS, dest, 0},
+        {LY_STMT_MIN_ELEMENTS, dest, 0},
+        {LY_STMT_MODIFIER, dest, 0},
+        {LY_STMT_MODULE, dest, 0},
+        {LY_STMT_MUST, dest, 0},
+        {LY_STMT_NAMESPACE, dest, YIN_SUBELEM_UNIQUE},
+        {LY_STMT_NOTIFICATION, dest, 0},
+        {LY_STMT_ORDERED_BY, dest, 0},
+        {LY_STMT_ORGANIZATION, dest, 0},
+        {LY_STMT_OUTPUT, dest, 0},
+        {LY_STMT_PATH, dest, 0},
+        {LY_STMT_PATTERN, dest, 0},
+        {LY_STMT_POSITION, dest, 0},
+        {LY_STMT_PREFIX, dest, YIN_SUBELEM_UNIQUE},
+        {LY_STMT_PRESENCE, dest, YIN_SUBELEM_UNIQUE},
+        {LY_STMT_RANGE, dest, 0},
+        {LY_STMT_REFERENCE, dest, 0},
+        {LY_STMT_REFINE, dest, 0},
+        {LY_STMT_REQUIRE_INSTANCE, dest, 0},
+        {LY_STMT_REVISION, dest, 0},
+        {LY_STMT_REVISION_DATE, dest, 0},
+        {LY_STMT_RPC, dest, 0},
+        {LY_STMT_STATUS, dest, 0},
+        {LY_STMT_SUBMODULE, dest, 0},
+        {LY_STMT_TYPE, dest, 0},
+        {LY_STMT_TYPEDEF, dest, 0},
+        {LY_STMT_UNIQUE, dest, 0},
+        {LY_STMT_UNITS, dest, YIN_SUBELEM_UNIQUE},
+        {LY_STMT_USES, dest, 0},
+        {LY_STMT_VALUE, dest, 0},
+        {LY_STMT_WHEN, dest, 0},
+        {LY_STMT_YANG_VERSION, dest, 0},
+        {LY_STMT_YIN_ELEMENT, dest, 0},
+        {LY_STMT_EXTENSION_INSTANCE, dest, 0},
+        {LY_STMT_ARG_TEXT, dest, 0},
+        {LY_STMT_ARG_VALUE, dest, 0}
+    };
+
     ly_in_new_memory(data, &st->in);
     lyxml_ctx_new(st->ctx, st->in, &st->yin_ctx->xmlctx);
     prefix = st->yin_ctx->xmlctx->prefix;
@@ -900,16 +907,17 @@
     struct test_parser_yin_state *st = *state;
     struct lysp_type type = {};
     const char *data;
+
     data = ELEMENT_WRAPPER_START
-           "<enum name=\"enum-name\">"
-                "<if-feature name=\"feature\" />"
-                "<value value=\"55\" />"
-                "<status value=\"deprecated\" />"
-                "<description><text>desc...</text></description>"
-                "<reference><text>ref...</text></reference>"
-                EXT_SUBELEM
-           "</enum>"
-           ELEMENT_WRAPPER_END;
+            "<enum name=\"enum-name\">\n"
+            "     <if-feature name=\"feature\" />\n"
+            "     <value value=\"55\" />\n"
+            "     <status value=\"deprecated\" />\n"
+            "     <description><text>desc...</text></description>\n"
+            "     <reference><text>ref...</text></reference>\n"
+            "     " EXT_SUBELEM "\n"
+            "</enum>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &type, NULL, NULL), LY_SUCCESS);
     assert_string_equal(type.enums->name, "enum-name");
     assert_string_equal(type.enums->iffeatures[0].str, "feature");
@@ -924,8 +932,8 @@
     memset(&type, 0, sizeof type);
 
     data = ELEMENT_WRAPPER_START
-           "<enum name=\"enum-name\"></enum>"
-           ELEMENT_WRAPPER_END;
+            "<enum name=\"enum-name\"></enum>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &type, NULL, NULL), LY_SUCCESS);
     assert_string_equal(type.enums->name, "enum-name");
     lysp_type_free(st->ctx, &type);
@@ -940,16 +948,17 @@
     struct test_parser_yin_state *st = *state;
     struct lysp_type type = {};
     const char *data;
+
     data = ELEMENT_WRAPPER_START
-           "<bit name=\"bit-name\">"
-                "<if-feature name=\"feature\" />"
-                "<position value=\"55\" />"
-                "<status value=\"deprecated\" />"
-                "<description><text>desc...</text></description>"
-                "<reference><text>ref...</text></reference>"
-                EXT_SUBELEM
-           "</bit>"
-           ELEMENT_WRAPPER_END;
+            "<bit name=\"bit-name\">\n"
+            "    <if-feature name=\"feature\" />\n"
+            "    <position value=\"55\" />\n"
+            "    <status value=\"deprecated\" />\n"
+            "    <description><text>desc...</text></description>\n"
+            "    <reference><text>ref...</text></reference>\n"
+            EXT_SUBELEM
+            "</bit>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &type, NULL, NULL), LY_SUCCESS);
     assert_string_equal(type.bits->name, "bit-name");
     assert_string_equal(type.bits->iffeatures[0].str, "feature");
@@ -964,8 +973,8 @@
     memset(&type, 0, sizeof type);
 
     data = ELEMENT_WRAPPER_START
-           "<bit name=\"bit-name\"> </bit>"
-           ELEMENT_WRAPPER_END;
+            "<bit name=\"bit-name\"> </bit>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &type, NULL, NULL), LY_SUCCESS);
     assert_string_equal(type.bits->name, "bit-name");
     lysp_type_free(st->ctx, &type);
@@ -984,8 +993,8 @@
 
     /* organization element */
     data = ELEMENT_WRAPPER_START
-                "<organization><text>organization...</text>" EXT_SUBELEM EXT_SUBELEM "</organization>"
-           ELEMENT_WRAPPER_END;
+            "<organization><text>organization...</text>" EXT_SUBELEM EXT_SUBELEM "</organization>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &value, NULL, &exts), LY_SUCCESS);
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
     assert_int_equal(exts[0].insubstmt_index, 0);
@@ -1001,8 +1010,8 @@
 
     /* contact element */
     data = ELEMENT_WRAPPER_START
-                "<contact><text>contact...</text>" EXT_SUBELEM "</contact>"
-           ELEMENT_WRAPPER_END;
+            "<contact><text>contact...</text>" EXT_SUBELEM "</contact>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &value, NULL, &exts), LY_SUCCESS);
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
     assert_int_equal(exts[0].insubstmt_index, 0);
@@ -1015,8 +1024,8 @@
 
     /* description element */
     data = ELEMENT_WRAPPER_START
-                "<description><text>description...</text>" EXT_SUBELEM "</description>"
-           ELEMENT_WRAPPER_END;
+            "<description><text>description...</text>" EXT_SUBELEM "</description>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &value, NULL, &exts), LY_SUCCESS);
     assert_string_equal(value, "description...");
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
@@ -1029,8 +1038,8 @@
 
     /* reference element */
     data = ELEMENT_WRAPPER_START
-                "<reference><text>reference...</text>" EXT_SUBELEM "</reference>"
-           ELEMENT_WRAPPER_END;
+            "<reference><text>reference...</text>" EXT_SUBELEM "</reference>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &value, NULL, &exts), LY_SUCCESS);
     assert_string_equal(value, "reference...");
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
@@ -1043,8 +1052,8 @@
 
     /* reference element */
     data = ELEMENT_WRAPPER_START
-                "<reference invalid=\"text\"><text>reference...</text>""</reference>"
-           ELEMENT_WRAPPER_END;
+            "<reference invalid=\"text\"><text>reference...</text>" "</reference>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &value, NULL, &exts), LY_EVALID);
     logbuf_assert("Unexpected attribute \"invalid\" of \"reference\" element. Line number 1.");
     FREE_STRING(st->ctx, value);
@@ -1054,15 +1063,15 @@
 
     /* missing text subelement */
     data = ELEMENT_WRAPPER_START
-                "<reference>reference...</reference>"
-           ELEMENT_WRAPPER_END;
+            "<reference>reference...</reference>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &value, NULL, &exts), LY_EVALID);
     logbuf_assert("Missing mandatory sub-element \"text\" of \"reference\" element. Line number 1.");
 
     /* reference element */
     data = ELEMENT_WRAPPER_START
-                "<reference>" EXT_SUBELEM "<text>reference...</text></reference>"
-           ELEMENT_WRAPPER_END;
+            "<reference>" EXT_SUBELEM "<text>reference...</text></reference>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &value, NULL, &exts), LY_EVALID);
     logbuf_assert("Sub-element \"text\" of \"reference\" element must be defined as it's first sub-element. Line number 1.");
     FREE_STRING(st->ctx, value);
@@ -1083,14 +1092,14 @@
 
     /* max subelems */
     data = ELEMENT_WRAPPER_START
-                "<import module=\"a\">"
-                    EXT_SUBELEM
-                    "<prefix value=\"a_mod\"/>"
-                    "<revision-date date=\"2015-01-01\"></revision-date>"
-                    "<description><text>import description</text></description>"
-                    "<reference><text>import reference</text></reference>"
-                "</import>"
-           ELEMENT_WRAPPER_END;
+            "<import module=\"a\">\n"
+            EXT_SUBELEM
+            "    <prefix value=\"a_mod\"/>\n"
+            "    <revision-date date=\"2015-01-01\"></revision-date>\n"
+            "    <description><text>import description</text></description>\n"
+            "    <reference><text>import reference</text></reference>\n"
+            "</import>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &imp_meta, NULL, NULL), LY_SUCCESS);
     assert_string_equal(imports->name, "a");
     assert_string_equal(imports->prefix, "a_mod");
@@ -1105,10 +1114,10 @@
 
     /* min subelems */
     data = ELEMENT_WRAPPER_START
-                "<import module=\"a\">"
-                    "<prefix value=\"a_mod\"/>"
-                "</import>"
-           ELEMENT_WRAPPER_END;
+            "<import module=\"a\">\n"
+            "    <prefix value=\"a_mod\"/>\n"
+            "</import>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &imp_meta, NULL, NULL), LY_SUCCESS);
     assert_string_equal(imports->prefix, "a_mod");
     FREE_ARRAY(st->ctx, imports, lysp_import_free);
@@ -1123,18 +1132,27 @@
 
     /* invalid reused prefix */
     data = ELEMENT_WRAPPER_START
-                "<import module=\"a\">"
-                    "<prefix value=\"prefix\"/>"
-                "</import>"
-                "<import module=\"a\">"
-                    "<prefix value=\"prefix\"/>"
-                "</import>"
-           ELEMENT_WRAPPER_END;
+            "<import module=\"a\">\n"
+            "    <prefix value=\"prefix\"/>\n"
+            "</import>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &imp_meta, NULL, NULL), LY_EVALID);
-    logbuf_assert("Prefix \"prefix\" already used as module prefix. Line number 1.");
+    logbuf_assert("Prefix \"prefix\" already used as module prefix. Line number 3.");
     FREE_ARRAY(st->ctx, imports, lysp_import_free);
     imports = NULL;
 
+    data = ELEMENT_WRAPPER_START
+            "<import module=\"a\">\n"
+            "    <prefix value=\"a\"/>\n"
+            "</import>\n"
+            "<import module=\"a\">\n"
+            "    <prefix value=\"a\"/>\n"
+            "</import>"
+            ELEMENT_WRAPPER_END;
+    assert_int_equal(test_element_helper(st, data, &imp_meta, NULL, NULL), LY_EVALID);
+    logbuf_assert("Prefix \"a\" already used to import \"a\" module. Line number 6.");
+    FREE_ARRAY(st->ctx, imports, lysp_import_free);
+    imports = NULL;
     st->finished_correctly = true;
 }
 
@@ -1155,7 +1173,7 @@
     assert_int_equal(test_element_helper(st, data, &flags, NULL, NULL), LY_SUCCESS);
     assert_true(flags & LYS_STATUS_DEPRC);
 
-    data = ELEMENT_WRAPPER_START "<status value=\"obsolete\">"EXT_SUBELEM"</status>" ELEMENT_WRAPPER_END;
+    data = ELEMENT_WRAPPER_START "<status value=\"obsolete\">"EXT_SUBELEM "</status>" ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &flags, NULL, &exts), LY_SUCCESS);
     assert_true(flags & LYS_STATUS_OBSLT);
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
@@ -1180,14 +1198,14 @@
 
     /* max subelems */
     data = ELEMENT_WRAPPER_START
-           "<extension name=\"ext_name\">"
-                "<argument name=\"arg\"></argument>"
-                "<status value=\"current\"/>"
-                "<description><text>ext_desc</text></description>"
-                "<reference><text>ext_ref</text></reference>"
-                EXT_SUBELEM
-           "</extension>"
-           ELEMENT_WRAPPER_END;
+            "<extension name=\"ext_name\">\n"
+            "     <argument name=\"arg\"></argument>\n"
+            "     <status value=\"current\"/>\n"
+            "     <description><text>ext_desc</text></description>\n"
+            "     <reference><text>ext_ref</text></reference>\n"
+            EXT_SUBELEM
+            "</extension>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &ext, NULL, NULL), LY_SUCCESS);
     assert_string_equal(ext->name, "ext_name");
     assert_string_equal(ext->argument, "arg");
@@ -1309,11 +1327,11 @@
 
     /* max subelems */
     data = ELEMENT_WRAPPER_START
-           "<argument name=\"arg-name\">"
-                "<yin-element value=\"true\" />"
-                EXT_SUBELEM
-           "</argument>"
-           ELEMENT_WRAPPER_END;
+            "<argument name=\"arg-name\">\n"
+            "     <yin-element value=\"true\" />\n"
+            EXT_SUBELEM
+            "</argument>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &arg_meta, NULL, &exts), LY_SUCCESS);
     assert_string_equal(arg, "arg-name");
     assert_true(flags & LYS_YINELEM_TRUE);
@@ -1328,9 +1346,9 @@
 
     /* min subelems */
     data = ELEMENT_WRAPPER_START
-           "<argument name=\"arg\">"
-           "</argument>"
-           ELEMENT_WRAPPER_END;
+            "<argument name=\"arg\">"
+            "</argument>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &arg_meta, NULL, NULL), LY_SUCCESS);
     assert_string_equal(arg, "arg");
     assert_true(flags == 0);
@@ -1349,11 +1367,11 @@
     struct lysp_type type = {};
 
     /* as identity subelement */
-    data = "<identity xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">"
-                "<base name=\"base-name\">"
-                    EXT_SUBELEM
-                "</base>"
-           "</identity>";
+    data = "<identity xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">\n"
+            "     <base name=\"base-name\">\n"
+            EXT_SUBELEM
+            "     </base>\n"
+            "</identity>";
     assert_int_equal(test_element_helper(st, data, &bases, NULL, &exts), LY_SUCCESS);
     assert_string_equal(*bases, "base-name");
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
@@ -1365,11 +1383,11 @@
     LY_ARRAY_FREE(bases);
 
     /* as type subelement */
-    data = "<type xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">"
-                "<base name=\"base-name\">"
-                    EXT_SUBELEM
-                "</base>"
-           "</type>";
+    data = "<type xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">\n"
+            "     <base name=\"base-name\">\n"
+            EXT_SUBELEM
+            "     </base>\n"
+            "</type>";
     assert_int_equal(test_element_helper(st, data, &type, NULL, &exts), LY_SUCCESS);
     assert_string_equal(*type.bases, "base-name");
     assert_true(type.flags & LYS_SET_BASE);
@@ -1393,8 +1411,8 @@
     struct lysp_ext_instance *exts = NULL;
 
     data = ELEMENT_WRAPPER_START
-                "<belongs-to module=\"module-name\"><prefix value=\"pref\"/>"EXT_SUBELEM"</belongs-to>"
-           ELEMENT_WRAPPER_END;
+            "<belongs-to module=\"module-name\"><prefix value=\"pref\"/>"EXT_SUBELEM "</belongs-to>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &submod, NULL, &exts), LY_SUCCESS);
     assert_string_equal(submod.prefix, "pref");
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
@@ -1449,7 +1467,7 @@
     struct lysp_qname val = {0};
     struct lysp_ext_instance *exts = NULL;
 
-    data = ELEMENT_WRAPPER_START "<default value=\"defaul-value\">"EXT_SUBELEM"</default>" ELEMENT_WRAPPER_END;
+    data = ELEMENT_WRAPPER_START "<default value=\"defaul-value\">"EXT_SUBELEM "</default>" ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &val, NULL, &exts), LY_SUCCESS);
     assert_string_equal(val.str, "defaul-value");
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
@@ -1475,7 +1493,7 @@
     const char *val = NULL;
     struct lysp_ext_instance *exts = NULL;
 
-    data = ELEMENT_WRAPPER_START "<error-app-tag value=\"val\">"EXT_SUBELEM"</error-app-tag>" ELEMENT_WRAPPER_END;
+    data = ELEMENT_WRAPPER_START "<error-app-tag value=\"val\">"EXT_SUBELEM "</error-app-tag>" ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &val, NULL, &exts), LY_SUCCESS);
     assert_string_equal(val, "val");
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
@@ -1501,7 +1519,7 @@
     const char *val = NULL;
     struct lysp_ext_instance *exts = NULL;
 
-    data = ELEMENT_WRAPPER_START "<error-message><value>val</value>"EXT_SUBELEM"</error-message>" ELEMENT_WRAPPER_END;
+    data = ELEMENT_WRAPPER_START "<error-message><value>val</value>"EXT_SUBELEM "</error-message>" ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &val, NULL, &exts), LY_SUCCESS);
     assert_string_equal(val, "val");
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
@@ -1530,7 +1548,7 @@
     struct lysp_type type = {};
 
     /* valid value */
-    data = ELEMENT_WRAPPER_START "<fraction-digits value=\"10\">"EXT_SUBELEM"</fraction-digits>" ELEMENT_WRAPPER_END;
+    data = ELEMENT_WRAPPER_START "<fraction-digits value=\"10\">"EXT_SUBELEM "</fraction-digits>" ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &type, NULL, NULL), LY_SUCCESS);
     assert_string_equal(type.exts[0].name, "urn:example:extensions:c-define");
     assert_int_equal(type.exts[0].insubstmt_index, 0);
@@ -1571,7 +1589,7 @@
     const char **iffeatures = NULL;
     struct lysp_ext_instance *exts = NULL;
 
-    data = ELEMENT_WRAPPER_START "<if-feature name=\"local-storage\">"EXT_SUBELEM"</if-feature>" ELEMENT_WRAPPER_END;
+    data = ELEMENT_WRAPPER_START "<if-feature name=\"local-storage\">"EXT_SUBELEM "</if-feature>" ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &iffeatures, NULL, &exts), LY_SUCCESS);
     assert_string_equal(*iffeatures, "local-storage");
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
@@ -1601,13 +1619,13 @@
 
     /* max subelems */
     data = ELEMENT_WRAPPER_START
-                "<length value=\"length-str\">"
-                    "<error-message><value>err-msg</value></error-message>"
-                    "<error-app-tag value=\"err-app-tag\"/>"
-                    "<description><text>desc</text></description>"
-                    "<reference><text>ref</text></reference>"
-                    EXT_SUBELEM
-                "</length>"
+            "<length value=\"length-str\">\n"
+            "    <error-message><value>err-msg</value></error-message>\n"
+            "    <error-app-tag value=\"err-app-tag\"/>\n"
+            "    <description><text>desc</text></description>\n"
+            "    <reference><text>ref</text></reference>\n"
+            EXT_SUBELEM
+            "</length>"
             ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &type, NULL, NULL), LY_SUCCESS);
     assert_string_equal(type.length->arg.str, "length-str");
@@ -1624,8 +1642,8 @@
 
     /* min subelems */
     data = ELEMENT_WRAPPER_START
-                "<length value=\"length-str\">"
-                "</length>"
+            "<length value=\"length-str\">"
+            "</length>"
             ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &type, NULL, NULL), LY_SUCCESS);
     assert_string_equal(type.length->arg.str, "length-str");
@@ -1704,15 +1722,15 @@
 
     /* max subelems */
     data = ELEMENT_WRAPPER_START
-                "<pattern value=\"super_pattern\">"
-                    "<modifier value=\"invert-match\"/>"
-                    "<error-message><value>err-msg-value</value></error-message>"
-                    "<error-app-tag value=\"err-app-tag-value\"/>"
-                    "<description><text>&quot;pattern-desc&quot;</text></description>"
-                    "<reference><text>pattern-ref</text></reference>"
-                    EXT_SUBELEM
-                "</pattern>"
-           ELEMENT_WRAPPER_END;
+            "<pattern value=\"super_pattern\">\n"
+            "    <modifier value=\"invert-match\"/>\n"
+            "    <error-message><value>err-msg-value</value></error-message>\n"
+            "    <error-app-tag value=\"err-app-tag-value\"/>\n"
+            "    <description><text>&quot;pattern-desc&quot;</text></description>\n"
+            "    <reference><text>pattern-ref</text></reference>\n"
+            EXT_SUBELEM
+            "</pattern>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &type, NULL, NULL), LY_SUCCESS);
     assert_true(type.flags & LYS_SET_PATTERN);
     assert_string_equal(type.patterns->arg.str, "\x015super_pattern");
@@ -1857,14 +1875,14 @@
 
     /* max subelems */
     data = ELEMENT_WRAPPER_START
-                "<range value=\"range-str\">"
-                    "<error-message><value>err-msg</value></error-message>"
-                    "<error-app-tag value=\"err-app-tag\" />"
-                    "<description><text>desc</text></description>"
-                    "<reference><text>ref</text></reference>"
-                    EXT_SUBELEM
-                "</range>"
-           ELEMENT_WRAPPER_END;
+            "<range value=\"range-str\">\n"
+            "    <error-message><value>err-msg</value></error-message>\n"
+            "    <error-app-tag value=\"err-app-tag\" />\n"
+            "    <description><text>desc</text></description>\n"
+            "    <reference><text>ref</text></reference>\n"
+            EXT_SUBELEM
+            "</range>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &type, NULL, NULL), LY_SUCCESS);
     assert_string_equal(type.range->arg.str, "range-str");
     assert_string_equal(type.range->dsc, "desc");
@@ -1927,7 +1945,7 @@
     char rev[LY_REV_SIZE];
     struct lysp_ext_instance *exts = NULL;
 
-    data = ELEMENT_WRAPPER_START "<revision-date date=\"2000-01-01\">"EXT_SUBELEM"</revision-date>" ELEMENT_WRAPPER_END;
+    data = ELEMENT_WRAPPER_START "<revision-date date=\"2000-01-01\">"EXT_SUBELEM "</revision-date>" ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, rev, NULL, &exts), LY_SUCCESS);
     assert_string_equal(rev, "2000-01-01");
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
@@ -1954,7 +1972,7 @@
     const char **values = NULL;
     struct lysp_ext_instance *exts = NULL;
 
-    data = ELEMENT_WRAPPER_START "<unique tag=\"tag\">"EXT_SUBELEM"</unique>" ELEMENT_WRAPPER_END;
+    data = ELEMENT_WRAPPER_START "<unique tag=\"tag\">"EXT_SUBELEM "</unique>" ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &values, NULL, &exts), LY_SUCCESS);
     assert_string_equal(*values, "tag");
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
@@ -1983,7 +2001,7 @@
     const char *values = NULL;
     struct lysp_ext_instance *exts = NULL;
 
-    data = ELEMENT_WRAPPER_START "<units name=\"name\">"EXT_SUBELEM"</units>" ELEMENT_WRAPPER_END;
+    data = ELEMENT_WRAPPER_START "<units name=\"name\">"EXT_SUBELEM "</units>" ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &values, NULL, &exts), LY_SUCCESS);
     assert_string_equal(values, "name");
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
@@ -2010,12 +2028,12 @@
     struct lysp_when *when = NULL;
 
     data = ELEMENT_WRAPPER_START
-                "<when condition=\"cond\">"
-                    "<description><text>desc</text></description>"
-                    "<reference><text>ref</text></reference>"
-                    EXT_SUBELEM
-                "</when>"
-           ELEMENT_WRAPPER_END;
+            "<when condition=\"cond\">\n"
+            "    <description><text>desc</text></description>\n"
+            "    <reference><text>ref</text></reference>\n"
+            EXT_SUBELEM
+            "</when>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &when, NULL, NULL), LY_SUCCESS);
     assert_string_equal(when->cond, "cond");
     assert_string_equal(when->dsc, "desc");
@@ -2071,20 +2089,20 @@
 
     /* max subelems */
     data = ELEMENT_WRAPPER_START
-                "<type name=\"type-name\">"
-                    "<base name=\"base-name\"/>"
-                    "<bit name=\"bit\"/>"
-                    "<enum name=\"enum\"/>"
-                    "<fraction-digits value=\"2\"/>"
-                    "<length value=\"length\"/>"
-                    "<path value=\"/path\"/>"
-                    "<pattern value=\"pattern\"/>"
-                    "<range value=\"range\" />"
-                    "<require-instance value=\"true\"/>"
-                    "<type name=\"sub-type-name\"/>"
-                    EXT_SUBELEM
-                "</type>"
-           ELEMENT_WRAPPER_END;
+            "<type name=\"type-name\">\n"
+            "    <base name=\"base-name\"/>\n"
+            "    <bit name=\"bit\"/>\n"
+            "    <enum name=\"enum\"/>\n"
+            "    <fraction-digits value=\"2\"/>\n"
+            "    <length value=\"length\"/>\n"
+            "    <path value=\"/path\"/>\n"
+            "    <pattern value=\"pattern\"/>\n"
+            "    <range value=\"range\" />\n"
+            "    <require-instance value=\"true\"/>\n"
+            "    <type name=\"sub-type-name\"/>\n"
+            EXT_SUBELEM
+            "</type>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &type, NULL, NULL), LY_SUCCESS);
     assert_string_equal(type.name, "type-name");
     assert_string_equal(*type.bases, "base-name");
@@ -2131,7 +2149,7 @@
     struct lysp_node_leaflist llist = {};
     struct lysp_refine refine = {};
 
-    data = "<refine xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\"> <max-elements value=\"unbounded\">"EXT_SUBELEM"</max-elements> </refine>";
+    data = "<refine xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\"> <max-elements value=\"unbounded\">"EXT_SUBELEM "</max-elements> </refine>";
     assert_int_equal(test_element_helper(st, data, &refine, NULL, NULL), LY_SUCCESS);
     assert_int_equal(refine.max, 0);
     assert_true(refine.flags & LYS_SET_MAX);
@@ -2140,7 +2158,7 @@
     assert_int_equal(refine.exts[0].insubstmt, LYEXT_SUBSTMT_MAX);
     FREE_ARRAY(st->ctx, refine.exts, lysp_ext_instance_free);
 
-    data = "<list xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\"> <max-elements value=\"5\">"EXT_SUBELEM"</max-elements> </list>";
+    data = "<list xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\"> <max-elements value=\"5\">"EXT_SUBELEM "</max-elements> </list>";
     assert_int_equal(test_element_helper(st, data, &list, NULL, NULL), LY_SUCCESS);
     assert_int_equal(list.max, 5);
     assert_true(list.flags & LYS_SET_MAX);
@@ -2149,7 +2167,7 @@
     assert_int_equal(list.exts[0].insubstmt, LYEXT_SUBSTMT_MAX);
     FREE_ARRAY(st->ctx, list.exts, lysp_ext_instance_free);
 
-    data = "<leaf-list xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\"> <max-elements value=\"85\">"EXT_SUBELEM"</max-elements> </leaf-list>";
+    data = "<leaf-list xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\"> <max-elements value=\"85\">"EXT_SUBELEM "</max-elements> </leaf-list>";
     assert_int_equal(test_element_helper(st, data, &llist, NULL, NULL), LY_SUCCESS);
     assert_int_equal(llist.max, 85);
     assert_true(llist.flags & LYS_SET_MAX);
@@ -2191,7 +2209,7 @@
     struct lysp_node_leaflist llist = {};
     struct lysp_refine refine = {};
 
-    data = "<refine xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\"> <min-elements value=\"0\">"EXT_SUBELEM"</min-elements> </refine>";
+    data = "<refine xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\"> <min-elements value=\"0\">"EXT_SUBELEM "</min-elements> </refine>";
     assert_int_equal(test_element_helper(st, data, &refine, NULL, NULL), LY_SUCCESS);
     assert_int_equal(refine.min, 0);
     assert_true(refine.flags & LYS_SET_MIN);
@@ -2200,7 +2218,7 @@
     assert_int_equal(refine.exts[0].insubstmt, LYEXT_SUBSTMT_MIN);
     FREE_ARRAY(st->ctx, refine.exts, lysp_ext_instance_free);
 
-    data = "<list xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\"> <min-elements value=\"41\">"EXT_SUBELEM"</min-elements> </list>";
+    data = "<list xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\"> <min-elements value=\"41\">"EXT_SUBELEM "</min-elements> </list>";
     assert_int_equal(test_element_helper(st, data, &list, NULL, NULL), LY_SUCCESS);
     assert_int_equal(list.min, 41);
     assert_true(list.flags & LYS_SET_MIN);
@@ -2209,7 +2227,7 @@
     assert_int_equal(list.exts[0].insubstmt, LYEXT_SUBSTMT_MIN);
     FREE_ARRAY(st->ctx, list.exts, lysp_ext_instance_free);
 
-    data = "<leaf-list xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\"> <min-elements value=\"50\">"EXT_SUBELEM"</min-elements> </leaf-list>";
+    data = "<leaf-list xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\"> <min-elements value=\"50\">"EXT_SUBELEM "</min-elements> </leaf-list>";
     assert_int_equal(test_element_helper(st, data, &llist, NULL, NULL), LY_SUCCESS);
     assert_int_equal(llist.min, 50);
     assert_true(llist.flags & LYS_SET_MIN);
@@ -2245,7 +2263,7 @@
     uint16_t flags = 0;
     struct lysp_ext_instance *exts = NULL;
 
-    data = ELEMENT_WRAPPER_START "<ordered-by value=\"system\">"EXT_SUBELEM"</ordered-by>" ELEMENT_WRAPPER_END;
+    data = ELEMENT_WRAPPER_START "<ordered-by value=\"system\">"EXT_SUBELEM "</ordered-by>" ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &flags, NULL, &exts), LY_SUCCESS);
     assert_true(flags & LYS_ORDBY_SYSTEM);
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
@@ -2275,18 +2293,18 @@
 
     /* anyxml max subelems */
     data = ELEMENT_WRAPPER_START
-                "<anyxml name=\"any-name\">"
-                    "<config value=\"true\" />"
-                    "<description><text>desc</text></description>"
-                    "<if-feature name=\"feature\" />"
-                    "<mandatory value=\"true\" />"
-                    "<must condition=\"must-cond\" />"
-                    "<reference><text>ref</text></reference>"
-                    "<status value=\"deprecated\"/>"
-                    "<when condition=\"when-cond\"/>"
-                    EXT_SUBELEM
-                "</anyxml>"
-           ELEMENT_WRAPPER_END;
+            "<anyxml name=\"any-name\">\n"
+            "    <config value=\"true\" />\n"
+            "    <description><text>desc</text></description>\n"
+            "    <if-feature name=\"feature\" />\n"
+            "    <mandatory value=\"true\" />\n"
+            "    <must condition=\"must-cond\" />\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <status value=\"deprecated\"/>\n"
+            "    <when condition=\"when-cond\"/>\n"
+            EXT_SUBELEM
+            "</anyxml>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &node_meta, NULL, NULL), LY_SUCCESS);
     parsed = (struct lysp_node_anydata *)siblings;
     assert_null(parsed->parent);
@@ -2308,18 +2326,18 @@
 
     /* anydata max subelems */
     data = ELEMENT_WRAPPER_START
-                "<anydata name=\"any-name\">"
-                    "<config value=\"true\" />"
-                    "<description><text>desc</text></description>"
-                    "<if-feature name=\"feature\" />"
-                    "<mandatory value=\"true\" />"
-                    "<must condition=\"must-cond\" />"
-                    "<reference><text>ref</text></reference>"
-                    "<status value=\"deprecated\"/>"
-                    "<when condition=\"when-cond\"/>"
-                    EXT_SUBELEM
-                "</anydata>"
-           ELEMENT_WRAPPER_END;
+            "<anydata name=\"any-name\">\n"
+            "    <config value=\"true\" />\n"
+            "    <description><text>desc</text></description>\n"
+            "    <if-feature name=\"feature\" />\n"
+            "    <mandatory value=\"true\" />\n"
+            "    <must condition=\"must-cond\" />\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <status value=\"deprecated\"/>\n"
+            "    <when condition=\"when-cond\"/>\n"
+            EXT_SUBELEM
+            "</anydata>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &node_meta, NULL, NULL), LY_SUCCESS);
     parsed = (struct lysp_node_anydata *)siblings;
     assert_null(parsed->parent);
@@ -2364,20 +2382,20 @@
 
     /* max elements */
     data = ELEMENT_WRAPPER_START
-                "<leaf name=\"leaf\">"
-                    "<config value=\"true\" />"
-                    "<default value=\"def-val\"/>"
-                    "<description><text>desc</text></description>"
-                    "<if-feature name=\"feature\" />"
-                    "<mandatory value=\"true\" />"
-                    "<must condition=\"must-cond\" />"
-                    "<reference><text>ref</text></reference>"
-                    "<status value=\"deprecated\"/>"
-                    "<type name=\"type\"/>"
-                    "<units name=\"uni\"/>"
-                    "<when condition=\"when-cond\"/>"
-                    EXT_SUBELEM
-                "</leaf>"
+            "<leaf name=\"leaf\">\n"
+            "    <config value=\"true\" />\n"
+            "    <default value=\"def-val\"/>\n"
+            "    <description><text>desc</text></description>\n"
+            "    <if-feature name=\"feature\" />\n"
+            "    <mandatory value=\"true\" />\n"
+            "    <must condition=\"must-cond\" />\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <status value=\"deprecated\"/>\n"
+            "    <type name=\"type\"/>\n"
+            "    <units name=\"uni\"/>\n"
+            "    <when condition=\"when-cond\"/>\n"
+            EXT_SUBELEM
+            "</leaf>"
             ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &node_meta, NULL, NULL), LY_SUCCESS);
     parsed = (struct lysp_node_leaf *)siblings;
@@ -2424,22 +2442,22 @@
     struct lysp_node_leaflist *parsed = NULL;
 
     data = ELEMENT_WRAPPER_START
-                "<leaf-list name=\"llist\">"
-                    "<config value=\"true\" />"
-                    "<default value=\"def-val0\"/>"
-                    "<default value=\"def-val1\"/>"
-                    "<description><text>desc</text></description>"
-                    "<if-feature name=\"feature\"/>"
-                    "<max-elements value=\"5\"/>"
-                    "<must condition=\"must-cond\"/>"
-                    "<ordered-by value=\"user\" />"
-                    "<reference><text>ref</text></reference>"
-                    "<status value=\"current\"/>"
-                    "<type name=\"type\"/>"
-                    "<units name=\"uni\"/>"
-                    "<when condition=\"when-cond\"/>"
-                    EXT_SUBELEM
-                "</leaf-list>"
+            "<leaf-list name=\"llist\">\n"
+            "    <config value=\"true\" />\n"
+            "    <default value=\"def-val0\"/>\n"
+            "    <default value=\"def-val1\"/>\n"
+            "    <description><text>desc</text></description>\n"
+            "    <if-feature name=\"feature\"/>\n"
+            "    <max-elements value=\"5\"/>\n"
+            "    <must condition=\"must-cond\"/>\n"
+            "    <ordered-by value=\"user\" />\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <status value=\"current\"/>\n"
+            "    <type name=\"type\"/>\n"
+            "    <units name=\"uni\"/>\n"
+            "    <when condition=\"when-cond\"/>\n"
+            EXT_SUBELEM
+            "</leaf-list>"
             ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &node_meta, NULL, NULL), LY_SUCCESS);
     parsed = (struct lysp_node_leaflist *)siblings;
@@ -2467,20 +2485,20 @@
     siblings = NULL;
 
     data = ELEMENT_WRAPPER_START
-                "<leaf-list name=\"llist\">"
-                    "<config value=\"true\" />"
-                    "<description><text>desc</text></description>"
-                    "<if-feature name=\"feature\"/>"
-                    "<min-elements value=\"5\"/>"
-                    "<must condition=\"must-cond\"/>"
-                    "<ordered-by value=\"user\" />"
-                    "<reference><text>ref</text></reference>"
-                    "<status value=\"current\"/>"
-                    "<type name=\"type\"/>"
-                    "<units name=\"uni\"/>"
-                    "<when condition=\"when-cond\"/>"
-                    EXT_SUBELEM
-                "</leaf-list>"
+            "<leaf-list name=\"llist\">\n"
+            "    <config value=\"true\" />\n"
+            "    <description><text>desc</text></description>\n"
+            "    <if-feature name=\"feature\"/>\n"
+            "    <min-elements value=\"5\"/>\n"
+            "    <must condition=\"must-cond\"/>\n"
+            "    <ordered-by value=\"user\" />\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <status value=\"current\"/>\n"
+            "    <type name=\"type\"/>\n"
+            "    <units name=\"uni\"/>\n"
+            "    <when condition=\"when-cond\"/>\n"
+            EXT_SUBELEM
+            "</leaf-list>"
             ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &node_meta, NULL, NULL), LY_SUCCESS);
     parsed = (struct lysp_node_leaflist *)siblings;
@@ -2506,20 +2524,20 @@
     siblings = NULL;
 
     data = ELEMENT_WRAPPER_START
-                "<leaf-list name=\"llist\">"
-                    "<config value=\"true\" />"
-                    "<description><text>desc</text></description>"
-                    "<if-feature name=\"feature\"/>"
-                    "<max-elements value=\"15\"/>"
-                    "<min-elements value=\"5\"/>"
-                    "<must condition=\"must-cond\"/>"
-                    "<ordered-by value=\"user\" />"
-                    "<reference><text>ref</text></reference>"
-                    "<status value=\"current\"/>"
-                    "<type name=\"type\"/>"
-                    "<units name=\"uni\"/>"
-                    "<when condition=\"when-cond\"/>"
-                "</leaf-list>"
+            "<leaf-list name=\"llist\">\n"
+            "    <config value=\"true\" />\n"
+            "    <description><text>desc</text></description>\n"
+            "    <if-feature name=\"feature\"/>\n"
+            "    <max-elements value=\"15\"/>\n"
+            "    <min-elements value=\"5\"/>\n"
+            "    <must condition=\"must-cond\"/>\n"
+            "    <ordered-by value=\"user\" />\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <status value=\"current\"/>\n"
+            "    <type name=\"type\"/>\n"
+            "    <units name=\"uni\"/>\n"
+            "    <when condition=\"when-cond\"/>\n"
+            "</leaf-list>"
             ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &node_meta, NULL, NULL), LY_SUCCESS);
     parsed = (struct lysp_node_leaflist *)siblings;
@@ -2543,9 +2561,9 @@
     siblings = NULL;
 
     data = ELEMENT_WRAPPER_START
-                "<leaf-list name=\"llist\">"
-                    "<type name=\"type\"/>"
-                "</leaf-list>"
+            "<leaf-list name=\"llist\">\n"
+            "    <type name=\"type\"/>\n"
+            "</leaf-list>"
             ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &node_meta, NULL, NULL), LY_SUCCESS);
     parsed = (struct lysp_node_leaflist *)siblings;
@@ -2556,32 +2574,32 @@
 
     /* invalid combinations */
     data = ELEMENT_WRAPPER_START
-                "<leaf-list name=\"llist\">"
-                    "<max-elements value=\"5\"/>"
-                    "<min-elements value=\"15\"/>"
-                    "<type name=\"type\"/>"
-                "</leaf-list>"
+            "<leaf-list name=\"llist\">\n"
+            "    <max-elements value=\"5\"/>\n"
+            "    <min-elements value=\"15\"/>\n"
+            "    <type name=\"type\"/>"
+            "</leaf-list>"
             ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &node_meta, NULL, NULL), LY_EVALID);
-    logbuf_assert("Invalid combination of min-elements and max-elements: min value 15 is bigger than the max value 5. Line number 1.");
+    logbuf_assert("Invalid combination of min-elements and max-elements: min value 15 is bigger than the max value 5. Line number 4.");
     lysp_node_free(st->ctx, siblings);
     siblings = NULL;
 
     data = ELEMENT_WRAPPER_START
-                "<leaf-list name=\"llist\">"
-                    "<default value=\"def-val1\"/>"
-                    "<min-elements value=\"15\"/>"
-                    "<type name=\"type\"/>"
-                "</leaf-list>"
+            "<leaf-list name=\"llist\">\n"
+            "    <default value=\"def-val1\"/>\n"
+            "    <min-elements value=\"15\"/>\n"
+            "    <type name=\"type\"/>\n"
+            "</leaf-list>"
             ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &node_meta, NULL, NULL), LY_EVALID);
-    logbuf_assert("Invalid combination of sub-elemnts \"min-elements\" and \"default\" in \"leaf-list\" element. Line number 1.");
+    logbuf_assert("Invalid combination of sub-elemnts \"min-elements\" and \"default\" in \"leaf-list\" element. Line number 5.");
     lysp_node_free(st->ctx, siblings);
     siblings = NULL;
 
     data = ELEMENT_WRAPPER_START
-                "<leaf-list name=\"llist\">"
-                "</leaf-list>"
+            "<leaf-list name=\"llist\">"
+            "</leaf-list>"
             ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &node_meta, NULL, NULL), LY_EVALID);
     logbuf_assert("Missing mandatory sub-element \"type\" of \"leaf-list\" element. Line number 1.");
@@ -2599,7 +2617,7 @@
     const char *val;
     struct lysp_ext_instance *exts = NULL;
 
-    data = ELEMENT_WRAPPER_START "<presence value=\"presence-val\">"EXT_SUBELEM"</presence>" ELEMENT_WRAPPER_END;
+    data = ELEMENT_WRAPPER_START "<presence value=\"presence-val\">"EXT_SUBELEM "</presence>" ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &val, NULL, &exts), LY_SUCCESS);
     assert_string_equal(val, "presence-val");
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
@@ -2628,7 +2646,7 @@
     const char *val;
     struct lysp_ext_instance *exts = NULL;
 
-    data = ELEMENT_WRAPPER_START "<key value=\"key-value\">"EXT_SUBELEM"</key>" ELEMENT_WRAPPER_END;
+    data = ELEMENT_WRAPPER_START "<key value=\"key-value\">"EXT_SUBELEM "</key>" ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &val, NULL, &exts), LY_SUCCESS);
     assert_string_equal(val, "key-value");
     assert_string_equal(exts[0].name, "urn:example:extensions:c-define");
@@ -2658,16 +2676,16 @@
     struct tree_node_meta typdef_meta = {NULL, (struct lysp_node **)&tpdfs};
 
     data = ELEMENT_WRAPPER_START
-                "<typedef name=\"tpdf-name\">"
-                    "<default value=\"def-val\"/>"
-                    "<description><text>desc-text</text></description>"
-                    "<reference><text>ref-text</text></reference>"
-                    "<status value=\"current\"/>"
-                    "<type name=\"type\"/>"
-                    "<units name=\"uni\"/>"
-                    EXT_SUBELEM
-                "</typedef>"
-           ELEMENT_WRAPPER_END;
+            "<typedef name=\"tpdf-name\">\n"
+            "    <default value=\"def-val\"/>\n"
+            "    <description><text>desc-text</text></description>\n"
+            "    <reference><text>ref-text</text></reference>\n"
+            "    <status value=\"current\"/>\n"
+            "    <type name=\"type\"/>\n"
+            "    <units name=\"uni\"/>\n"
+            EXT_SUBELEM
+            "</typedef>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &typdef_meta, NULL, NULL), LY_SUCCESS);
     assert_string_equal(tpdfs[0].dflt.str, "def-val");
     assert_string_equal(tpdfs[0].dsc, "desc-text");
@@ -2683,10 +2701,10 @@
     tpdfs = NULL;
 
     data = ELEMENT_WRAPPER_START
-                "<typedef name=\"tpdf-name\">"
-                    "<type name=\"type\"/>"
-                "</typedef>"
-           ELEMENT_WRAPPER_END;
+            "<typedef name=\"tpdf-name\">\n"
+            "    <type name=\"type\"/>\n"
+            "</typedef>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &typdef_meta, NULL, NULL), LY_SUCCESS);
     assert_string_equal(tpdfs[0].name, "tpdf-name");
     assert_string_equal(tpdfs[0].type.name, "type");
@@ -2705,20 +2723,20 @@
 
     /* max subelems */
     data = ELEMENT_WRAPPER_START
-                "<refine target-node=\"target\">"
-                    "<if-feature name=\"feature\" />"
-                    "<must condition=\"cond\" />"
-                    "<presence value=\"presence\" />"
-                    "<default value=\"def\" />"
-                    "<config value=\"true\" />"
-                    "<mandatory value=\"true\" />"
-                    "<min-elements value=\"10\" />"
-                    "<max-elements value=\"20\" />"
-                    "<description><text>desc</text></description>"
-                    "<reference><text>ref</text></reference>"
-                    EXT_SUBELEM
-                "</refine>"
-           ELEMENT_WRAPPER_END;
+            "<refine target-node=\"target\">\n"
+            "    <if-feature name=\"feature\" />\n"
+            "    <must condition=\"cond\" />\n"
+            "    <presence value=\"presence\" />\n"
+            "    <default value=\"def\" />\n"
+            "    <config value=\"true\" />\n"
+            "    <mandatory value=\"true\" />\n"
+            "    <min-elements value=\"10\" />\n"
+            "    <max-elements value=\"20\" />\n"
+            "    <description><text>desc</text></description>\n"
+            "    <reference><text>ref</text></reference>\n"
+            EXT_SUBELEM
+            "</refine>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &refines, NULL, NULL), LY_SUCCESS);
     assert_string_equal(refines->nodeid, "target");
     assert_string_equal(refines->dflts[0].str, "def");
@@ -2758,17 +2776,17 @@
 
     /* max subelems */
     data = ELEMENT_WRAPPER_START
-                "<uses name=\"uses-name\">"
-                    "<when condition=\"cond\" />"
-                    "<if-feature name=\"feature\" />"
-                    "<status value=\"obsolete\" />"
-                    "<description><text>desc</text></description>"
-                    "<reference><text>ref</text></reference>"
-                    "<refine target-node=\"target\"/>"
-                    "<augment target-node=\"target\" />"
-                    EXT_SUBELEM
-                "</uses>"
-           ELEMENT_WRAPPER_END;
+            "<uses name=\"uses-name\">\n"
+            "    <when condition=\"cond\" />\n"
+            "    <if-feature name=\"feature\" />\n"
+            "    <status value=\"obsolete\" />\n"
+            "    <description><text>desc</text></description>\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <refine target-node=\"target\"/>\n"
+            "    <augment target-node=\"target\" />\n"
+            EXT_SUBELEM
+            "</uses>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &node_meta, NULL, NULL), LY_SUCCESS);
     parsed = (struct lysp_node_uses *)&siblings[0];
     assert_string_equal(parsed->name, "uses-name");
@@ -2807,12 +2825,12 @@
 
     /* max subelems */
     data = ELEMENT_WRAPPER_START
-                "<revision date=\"2018-12-25\">"
-                    "<description><text>desc</text></description>"
-                    "<reference><text>ref</text></reference>"
-                    EXT_SUBELEM
-                "</revision>"
-           ELEMENT_WRAPPER_END;
+            "<revision date=\"2018-12-25\">\n"
+            "    <description><text>desc</text></description>\n"
+            "    <reference><text>ref</text></reference>\n"
+            EXT_SUBELEM
+            "</revision>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &revs, NULL, NULL), LY_SUCCESS);
     assert_string_equal(revs->date, "2018-12-25");
     assert_string_equal(revs->dsc, "desc");
@@ -2851,13 +2869,13 @@
     /* max subelems */
     st->yin_ctx->parsed_mod->version = LYS_VERSION_1_1;
     data = ELEMENT_WRAPPER_START
-                "<include module=\"mod\">"
-                    "<description><text>desc</text></description>"
-                    "<reference><text>ref</text></reference>"
-                    "<revision-date date=\"1999-09-09\"/>"
-                    EXT_SUBELEM
-                "</include>"
-           ELEMENT_WRAPPER_END;
+            "<include module=\"mod\">\n"
+            "    <description><text>desc</text></description>\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <revision-date date=\"1999-09-09\"/>\n"
+            EXT_SUBELEM
+            "</include>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &inc_meta, NULL, NULL), LY_SUCCESS);
     assert_string_equal(includes->name, "mod");
     assert_string_equal(includes->dsc, "desc");
@@ -2879,25 +2897,25 @@
     /* invalid combinations */
     st->yin_ctx->parsed_mod->version = LYS_VERSION_1_0;
     data = ELEMENT_WRAPPER_START
-                "<include module=\"mod\">"
-                    "<description><text>desc</text></description>"
-                    "<revision-date date=\"1999-09-09\"/>"
-                "</include>"
-           ELEMENT_WRAPPER_END;
+            "<include module=\"mod\">\n"
+            "    <description><text>desc</text></description>\n"
+            "    <revision-date date=\"1999-09-09\"/>\n"
+            "</include>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &inc_meta, NULL, NULL), LY_EVALID);
-    logbuf_assert("Invalid sub-elemnt \"description\" of \"include\" element - this sub-element is allowed only in modules with version 1.1 or newer. Line number 1.");
+    logbuf_assert("Invalid sub-elemnt \"description\" of \"include\" element - this sub-element is allowed only in modules with version 1.1 or newer. Line number 2.");
     FREE_ARRAY(st->ctx, includes, lysp_include_free);
     includes = NULL;
 
     st->yin_ctx->parsed_mod->version = LYS_VERSION_1_0;
     data = ELEMENT_WRAPPER_START
-                "<include module=\"mod\">"
-                    "<reference><text>ref</text></reference>"
-                    "<revision-date date=\"1999-09-09\"/>"
-                "</include>"
-           ELEMENT_WRAPPER_END;
+            "<include module=\"mod\">\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <revision-date date=\"1999-09-09\"/>\n"
+            "</include>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &inc_meta, NULL, NULL), LY_EVALID);
-    logbuf_assert("Invalid sub-elemnt \"reference\" of \"include\" element - this sub-element is allowed only in modules with version 1.1 or newer. Line number 1.");
+    logbuf_assert("Invalid sub-elemnt \"reference\" of \"include\" element - this sub-element is allowed only in modules with version 1.1 or newer. Line number 2.");
     FREE_ARRAY(st->ctx, includes, lysp_include_free);
     includes = NULL;
 
@@ -2915,33 +2933,33 @@
 
     /* max subelems */
     data = ELEMENT_WRAPPER_START
-                "<list name=\"list-name\">"
-                    "<when condition=\"when\"/>"
-                    "<if-feature name=\"iff\"/>"
-                    "<must condition=\"must-cond\"/>"
-                    "<key value=\"key\"/>"
-                    "<unique tag=\"utag\"/>"
-                    "<config value=\"true\"/>"
-                    "<min-elements value=\"10\"/>"
-                    "<ordered-by value=\"user\"/>"
-                    "<status value=\"deprecated\"/>"
-                    "<description><text>desc</text></description>"
-                    "<reference><text>ref</text></reference>"
-                    "<anydata name=\"anyd\"/>"
-                    "<anyxml name=\"anyx\"/>"
-                    "<container name=\"cont\"/>"
-                    "<choice name=\"choice\"/>"
-                    "<action name=\"action\"/>"
-                    "<grouping name=\"grp\"/>"
-                    "<notification name=\"notf\"/>"
-                    "<leaf name=\"leaf\"> <type name=\"type\"/> </leaf>"
-                    "<leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>"
-                    "<list name=\"sub-list\"/>"
-                    "<typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>"
-                    "<uses name=\"uses-name\"/>"
-                    EXT_SUBELEM
-                "</list>"
-           ELEMENT_WRAPPER_END;
+            "<list name=\"list-name\">\n"
+            "    <when condition=\"when\"/>\n"
+            "    <if-feature name=\"iff\"/>\n"
+            "    <must condition=\"must-cond\"/>\n"
+            "    <key value=\"key\"/>\n"
+            "    <unique tag=\"utag\"/>\n"
+            "    <config value=\"true\"/>\n"
+            "    <min-elements value=\"10\"/>\n"
+            "    <ordered-by value=\"user\"/>\n"
+            "    <status value=\"deprecated\"/>\n"
+            "    <description><text>desc</text></description>\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <anydata name=\"anyd\"/>\n"
+            "    <anyxml name=\"anyx\"/>\n"
+            "    <container name=\"cont\"/>\n"
+            "    <choice name=\"choice\"/>\n"
+            "    <action name=\"action\"/>\n"
+            "    <grouping name=\"grp\"/>\n"
+            "    <notification name=\"notf\"/>\n"
+            "    <leaf name=\"leaf\"> <type name=\"type\"/> </leaf>\n"
+            "    <leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>\n"
+            "    <list name=\"sub-list\"/>\n"
+            "    <typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>\n"
+            "    <uses name=\"uses-name\"/>\n"
+            EXT_SUBELEM
+            "</list>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &node_meta, NULL, NULL), LY_SUCCESS);
     parsed = (struct lysp_node_list *)&siblings[0];
     assert_string_equal(parsed->dsc, "desc");
@@ -3010,25 +3028,25 @@
     /* max subelems */
     st->yin_ctx->parsed_mod->version = LYS_VERSION_1_1;
     data = ELEMENT_WRAPPER_START
-                "<notification name=\"notif-name\">"
-                    "<anydata name=\"anyd\"/>"
-                    "<anyxml name=\"anyx\"/>"
-                    "<description><text>desc</text></description>"
-                    "<if-feature name=\"iff\"/>"
-                    "<leaf name=\"leaf\"> <type name=\"type\"/> </leaf>"
-                    "<leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>"
-                    "<list name=\"sub-list\"/>"
-                    "<must condition=\"cond\"/>"
-                    "<reference><text>ref</text></reference>"
-                    "<status value=\"deprecated\"/>"
-                    "<typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>"
-                    "<uses name=\"uses-name\"/>"
-                    "<container name=\"cont\"/>"
-                    "<choice name=\"choice\"/>"
-                    "<grouping name=\"grp\"/>"
-                    EXT_SUBELEM
-                "</notification>"
-           ELEMENT_WRAPPER_END;
+            "<notification name=\"notif-name\">\n"
+            "    <anydata name=\"anyd\"/>\n"
+            "    <anyxml name=\"anyx\"/>\n"
+            "    <description><text>desc</text></description>\n"
+            "    <if-feature name=\"iff\"/>\n"
+            "    <leaf name=\"leaf\"> <type name=\"type\"/> </leaf>\n"
+            "    <leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>\n"
+            "    <list name=\"sub-list\"/>\n"
+            "    <must condition=\"cond\"/>\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <status value=\"deprecated\"/>\n"
+            "    <typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>\n"
+            "    <uses name=\"uses-name\"/>\n"
+            "    <container name=\"cont\"/>\n"
+            "    <choice name=\"choice\"/>\n"
+            "    <grouping name=\"grp\"/>\n"
+            EXT_SUBELEM
+            "</notification>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &notif_meta, NULL, NULL), LY_SUCCESS);
     assert_string_equal(notifs->name, "notif-name");
     assert_string_equal(notifs->data->name, "anyd");
@@ -3083,25 +3101,25 @@
 
     /* max subelems */
     data = ELEMENT_WRAPPER_START
-                "<grouping name=\"grp-name\">"
-                    "<anydata name=\"anyd\"/>"
-                    "<anyxml name=\"anyx\"/>"
-                    "<description><text>desc</text></description>"
-                    "<grouping name=\"sub-grp\"/>"
-                    "<leaf name=\"leaf\"> <type name=\"type\"/> </leaf>"
-                    "<leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>"
-                    "<list name=\"list\"/>"
-                    "<notification name=\"notf\"/>"
-                    "<reference><text>ref</text></reference>"
-                    "<status value=\"current\"/>"
-                    "<typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>"
-                    "<uses name=\"uses-name\"/>"
-                    "<action name=\"act\"/>"
-                    "<container name=\"cont\"/>"
-                    "<choice name=\"choice\"/>"
-                    EXT_SUBELEM
-                "</grouping>"
-           ELEMENT_WRAPPER_END;
+            "<grouping name=\"grp-name\">\n"
+            "    <anydata name=\"anyd\"/>\n"
+            "    <anyxml name=\"anyx\"/>\n"
+            "    <description><text>desc</text></description>\n"
+            "    <grouping name=\"sub-grp\"/>\n"
+            "    <leaf name=\"leaf\"> <type name=\"type\"/> </leaf>\n"
+            "    <leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>\n"
+            "    <list name=\"list\"/>\n"
+            "    <notification name=\"notf\"/>\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <status value=\"current\"/>\n"
+            "    <typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>\n"
+            "    <uses name=\"uses-name\"/>\n"
+            "    <action name=\"act\"/>\n"
+            "    <container name=\"cont\"/>\n"
+            "    <choice name=\"choice\"/>\n"
+            EXT_SUBELEM
+            "</grouping>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &grp_meta, NULL, NULL), LY_SUCCESS);
     assert_string_equal(grps->name, "grp-name");
     assert_string_equal(grps->data->name, "anyd");
@@ -3152,30 +3170,30 @@
     /* max subelems */
     st->yin_ctx->parsed_mod->version = LYS_VERSION_1_1;
     data = ELEMENT_WRAPPER_START
-                "<container name=\"cont-name\">"
-                    "<anydata name=\"anyd\"/>"
-                    "<anyxml name=\"anyx\"/>"
-                    "<config value=\"true\"/>"
-                    "<container name=\"subcont\"/>"
-                    "<description><text>desc</text></description>"
-                    "<grouping name=\"sub-grp\"/>"
-                    "<if-feature name=\"iff\"/>"
-                    "<leaf name=\"leaf\"> <type name=\"type\"/> </leaf>"
-                    "<leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>"
-                    "<list name=\"list\"/>"
-                    "<must condition=\"cond\"/>"
-                    "<notification name=\"notf\"/>"
-                    "<presence value=\"presence\"/>"
-                    "<reference><text>ref</text></reference>"
-                    "<status value=\"current\"/>"
-                    "<typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>"
-                    "<uses name=\"uses-name\"/>"
-                    "<when condition=\"when-cond\"/>"
-                    "<action name=\"act\"/>"
-                    "<choice name=\"choice\"/>"
-                    EXT_SUBELEM
-                "</container>"
-           ELEMENT_WRAPPER_END;
+            "<container name=\"cont-name\">\n"
+            "    <anydata name=\"anyd\"/>\n"
+            "    <anyxml name=\"anyx\"/>\n"
+            "    <config value=\"true\"/>\n"
+            "    <container name=\"subcont\"/>\n"
+            "    <description><text>desc</text></description>\n"
+            "    <grouping name=\"sub-grp\"/>\n"
+            "    <if-feature name=\"iff\"/>\n"
+            "    <leaf name=\"leaf\"> <type name=\"type\"/> </leaf>\n"
+            "    <leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>\n"
+            "    <list name=\"list\"/>\n"
+            "    <must condition=\"cond\"/>\n"
+            "    <notification name=\"notf\"/>\n"
+            "    <presence value=\"presence\"/>\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <status value=\"current\"/>\n"
+            "    <typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>\n"
+            "    <uses name=\"uses-name\"/>\n"
+            "    <when condition=\"when-cond\"/>\n"
+            "    <action name=\"act\"/>\n"
+            "    <choice name=\"choice\"/>\n"
+            EXT_SUBELEM
+            "</container>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &node_meta, NULL, NULL), LY_SUCCESS);
     parsed = (struct lysp_node_container *)siblings;
     assert_string_equal(parsed->name, "cont-name");
@@ -3241,23 +3259,23 @@
     /* max subelems */
     st->yin_ctx->parsed_mod->version = LYS_VERSION_1_1;
     data = ELEMENT_WRAPPER_START
-                "<case name=\"case-name\">"
-                    "<anydata name=\"anyd\"/>"
-                    "<anyxml name=\"anyx\"/>"
-                    "<container name=\"subcont\"/>"
-                    "<description><text>desc</text></description>"
-                    "<if-feature name=\"iff\"/>"
-                    "<leaf name=\"leaf\"> <type name=\"type\"/> </leaf>"
-                    "<leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>"
-                    "<list name=\"list\"/>"
-                    "<reference><text>ref</text></reference>"
-                    "<status value=\"current\"/>"
-                    "<uses name=\"uses-name\"/>"
-                    "<when condition=\"when-cond\"/>"
-                    "<choice name=\"choice\"/>"
-                    EXT_SUBELEM
-                "</case>"
-           ELEMENT_WRAPPER_END;
+            "<case name=\"case-name\">\n"
+            "    <anydata name=\"anyd\"/>\n"
+            "    <anyxml name=\"anyx\"/>\n"
+            "    <container name=\"subcont\"/>\n"
+            "    <description><text>desc</text></description>\n"
+            "    <if-feature name=\"iff\"/>\n"
+            "    <leaf name=\"leaf\"> <type name=\"type\"/> </leaf>\n"
+            "    <leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>\n"
+            "    <list name=\"list\"/>\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <status value=\"current\"/>\n"
+            "    <uses name=\"uses-name\"/>\n"
+            "    <when condition=\"when-cond\"/>\n"
+            "    <choice name=\"choice\"/>\n"
+            EXT_SUBELEM
+            "</case>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &node_meta, NULL, NULL), LY_SUCCESS);
     parsed = (struct lysp_node_case *)siblings;
     assert_string_equal(parsed->name, "case-name");
@@ -3315,32 +3333,32 @@
     /* max subelems */
     st->yin_ctx->parsed_mod->version = LYS_VERSION_1_1;
     data = ELEMENT_WRAPPER_START
-                "<choice name=\"choice-name\">"
-                    "<anydata name=\"anyd\"/>"
-                    "<anyxml name=\"anyx\"/>"
-                    "<case name=\"sub-case\"/>"
-                    "<choice name=\"choice\"/>"
-                    "<config value=\"true\"/>"
-                    "<container name=\"subcont\"/>"
-                    "<default value=\"def\"/>"
-                    "<description><text>desc</text></description>"
-                    "<if-feature name=\"iff\"/>"
-                    "<leaf name=\"leaf\"> <type name=\"type\"/> </leaf>"
-                    "<leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>"
-                    "<list name=\"list\"/>"
-                    "<mandatory value=\"true\" />"
-                    "<reference><text>ref</text></reference>"
-                    "<status value=\"current\"/>"
-                    "<when condition=\"when-cond\"/>"
-                    EXT_SUBELEM
-                "</choice>"
-           ELEMENT_WRAPPER_END;
+            "<choice name=\"choice-name\">\n"
+            "    <anydata name=\"anyd\"/>\n"
+            "    <anyxml name=\"anyx\"/>\n"
+            "    <case name=\"sub-case\"/>\n"
+            "    <choice name=\"choice\"/>\n"
+            "    <config value=\"true\"/>\n"
+            "    <container name=\"subcont\"/>\n"
+            "    <default value=\"def\"/>\n"
+            "    <description><text>desc</text></description>\n"
+            "    <if-feature name=\"iff\"/>\n"
+            "    <leaf name=\"leaf\"> <type name=\"type\"/> </leaf>\n"
+            "    <leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>\n"
+            "    <list name=\"list\"/>\n"
+            "    <mandatory value=\"true\" />\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <status value=\"current\"/>\n"
+            "    <when condition=\"when-cond\"/>\n"
+            EXT_SUBELEM
+            "</choice>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &node_meta, NULL, NULL), LY_SUCCESS);
     parsed = (struct lysp_node_choice *)siblings;
     assert_string_equal(parsed->name, "choice-name");
     assert_null(parsed->parent);
     assert_int_equal(parsed->nodetype, LYS_CHOICE);
-    assert_true(parsed->flags & LYS_CONFIG_W && parsed->flags & LYS_MAND_TRUE  && parsed->flags & LYS_STATUS_CURR);
+    assert_true(parsed->flags & LYS_CONFIG_W && parsed->flags & LYS_MAND_TRUE && parsed->flags & LYS_STATUS_CURR);
     assert_null(parsed->next);
     assert_string_equal(parsed->dsc, "desc");
     assert_string_equal(parsed->ref, "ref");
@@ -3391,21 +3409,21 @@
     /* max subelements */
     st->yin_ctx->parsed_mod->version = LYS_VERSION_1_1;
     data = ELEMENT_WRAPPER_START
-                "<input>"
-                    "<anydata name=\"anyd\"/>"
-                    "<anyxml name=\"anyx\"/>"
-                    "<choice name=\"choice\"/>"
-                    "<container name=\"subcont\"/>"
-                    "<grouping name=\"sub-grp\"/>"
-                    "<leaf name=\"leaf\"> <type name=\"type\"/> </leaf>"
-                    "<leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>"
-                    "<list name=\"list\"/>"
-                    "<must condition=\"cond\"/>"
-                    "<typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>"
-                    "<uses name=\"uses-name\"/>"
-                    EXT_SUBELEM
-                "</input>"
-           ELEMENT_WRAPPER_END;
+            "<input>\n"
+            "    <anydata name=\"anyd\"/>\n"
+            "    <anyxml name=\"anyx\"/>\n"
+            "    <choice name=\"choice\"/>\n"
+            "    <container name=\"subcont\"/>\n"
+            "    <grouping name=\"sub-grp\"/>\n"
+            "    <leaf name=\"leaf\"> <type name=\"type\"/> </leaf>\n"
+            "    <leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>\n"
+            "    <list name=\"list\"/>\n"
+            "    <must condition=\"cond\"/>\n"
+            "    <typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>\n"
+            "    <uses name=\"uses-name\"/>\n"
+            EXT_SUBELEM
+            "</input>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &inout_meta, NULL, NULL), LY_SUCCESS);
     assert_null(inout.parent);
     assert_int_equal(inout.nodetype, LYS_INPUT);
@@ -3438,21 +3456,21 @@
     /* max subelements */
     st->yin_ctx->parsed_mod->version = LYS_VERSION_1_1;
     data = ELEMENT_WRAPPER_START
-                "<output>"
-                    "<anydata name=\"anyd\"/>"
-                    "<anyxml name=\"anyx\"/>"
-                    "<choice name=\"choice\"/>"
-                    "<container name=\"subcont\"/>"
-                    "<grouping name=\"sub-grp\"/>"
-                    "<leaf name=\"leaf\"> <type name=\"type\"/> </leaf>"
-                    "<leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>"
-                    "<list name=\"list\"/>"
-                    "<must condition=\"cond\"/>"
-                    "<typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>"
-                    "<uses name=\"uses-name\"/>"
-                    EXT_SUBELEM
-                "</output>"
-           ELEMENT_WRAPPER_END;
+            "<output>\n"
+            "    <anydata name=\"anyd\"/>\n"
+            "    <anyxml name=\"anyx\"/>\n"
+            "    <choice name=\"choice\"/>\n"
+            "    <container name=\"subcont\"/>\n"
+            "    <grouping name=\"sub-grp\"/>\n"
+            "    <leaf name=\"leaf\"> <type name=\"type\"/> </leaf>\n"
+            "    <leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>\n"
+            "    <list name=\"list\"/>\n"
+            "    <must condition=\"cond\"/>\n"
+            "    <typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>\n"
+            "    <uses name=\"uses-name\"/>\n"
+            EXT_SUBELEM
+            "</output>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &inout_meta, NULL, NULL), LY_SUCCESS);
     assert_null(inout.parent);
     assert_int_equal(inout.nodetype, LYS_OUTPUT);
@@ -3513,20 +3531,20 @@
     /* max subelems */
     st->yin_ctx->parsed_mod->version = LYS_VERSION_1_1;
     data = ELEMENT_WRAPPER_START
-                "<action name=\"act\">"
-                    "<description><text>desc</text></description>"
-                    "<grouping name=\"grouping\"/>"
-                    "<if-feature name=\"iff\"/>"
-                    "<input><uses name=\"uses-name\"/></input>"
-                    "<output><must condition=\"cond\"/><leaf name=\"l\"><type name=\"type\"/></leaf></output>"
-                    "<reference><text>ref</text></reference>"
-                    "<status value=\"deprecated\"/>"
-                    "<typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>"
-                    EXT_SUBELEM
-                "</action>"
-           ELEMENT_WRAPPER_END;
+            "<action name=\"act\">\n"
+            "    <description><text>desc</text></description>\n"
+            "    <grouping name=\"grouping\"/>\n"
+            "    <if-feature name=\"iff\"/>\n"
+            "    <input><uses name=\"uses-name\"/></input>\n"
+            "    <output><must condition=\"cond\"/><leaf name=\"l\"><type name=\"type\"/></leaf></output>\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <status value=\"deprecated\"/>\n"
+            "    <typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>\n"
+            EXT_SUBELEM
+            "</action>"
+            ELEMENT_WRAPPER_END;
     /* there must be parent for action */
-    act_meta.parent = (void*)1;
+    act_meta.parent = (void *)1;
     assert_int_equal(test_element_helper(st, data, &act_meta, NULL, NULL), LY_SUCCESS);
     act_meta.parent = NULL;
     assert_non_null(actions->parent);
@@ -3548,18 +3566,18 @@
 
     st->yin_ctx->parsed_mod->version = LYS_VERSION_1_1;
     data = ELEMENT_WRAPPER_START
-                "<rpc name=\"act\">"
-                    "<description><text>desc</text></description>"
-                    "<grouping name=\"grouping\"/>"
-                    "<if-feature name=\"iff\"/>"
-                    "<input><uses name=\"uses-name\"/></input>"
-                    "<output><must condition=\"cond\"/><leaf name=\"l\"><type name=\"type\"/></leaf></output>"
-                    "<reference><text>ref</text></reference>"
-                    "<status value=\"deprecated\"/>"
-                    "<typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>"
-                    EXT_SUBELEM
-                "</rpc>"
-           ELEMENT_WRAPPER_END;
+            "<rpc name=\"act\">\n"
+            "    <description><text>desc</text></description>\n"
+            "    <grouping name=\"grouping\"/>\n"
+            "    <if-feature name=\"iff\"/>\n"
+            "    <input><uses name=\"uses-name\"/></input>\n"
+            "    <output><must condition=\"cond\"/><leaf name=\"l\"><type name=\"type\"/></leaf></output>\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <status value=\"deprecated\"/>\n"
+            "    <typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>\n"
+            EXT_SUBELEM
+            "</rpc>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &act_meta, NULL, NULL), LY_SUCCESS);
     assert_null(actions->parent);
     assert_int_equal(actions->nodetype, LYS_RPC);
@@ -3598,26 +3616,26 @@
 
     st->yin_ctx->parsed_mod->version = LYS_VERSION_1_1;
     data = ELEMENT_WRAPPER_START
-                "<augment target-node=\"target\">"
-                    "<action name=\"action\"/>"
-                    "<anydata name=\"anyd\"/>"
-                    "<anyxml name=\"anyx\"/>"
-                    "<case name=\"case\"/>"
-                    "<choice name=\"choice\"/>"
-                    "<container name=\"subcont\"/>"
-                    "<description><text>desc</text></description>"
-                    "<if-feature name=\"iff\"/>"
-                    "<leaf name=\"leaf\"> <type name=\"type\"/> </leaf>"
-                    "<leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>"
-                    "<list name=\"list\"/>"
-                    "<notification name=\"notif\"/>"
-                    "<reference><text>ref</text></reference>"
-                    "<status value=\"current\"/>"
-                    "<uses name=\"uses\"/>"
-                    "<when condition=\"when-cond\"/>"
-                    EXT_SUBELEM
-                "</augment>"
-           ELEMENT_WRAPPER_END;
+            "<augment target-node=\"target\">\n"
+            "    <action name=\"action\"/>\n"
+            "    <anydata name=\"anyd\"/>\n"
+            "    <anyxml name=\"anyx\"/>\n"
+            "    <case name=\"case\"/>\n"
+            "    <choice name=\"choice\"/>\n"
+            "    <container name=\"subcont\"/>\n"
+            "    <description><text>desc</text></description>\n"
+            "    <if-feature name=\"iff\"/>\n"
+            "    <leaf name=\"leaf\"> <type name=\"type\"/> </leaf>\n"
+            "    <leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>\n"
+            "    <list name=\"list\"/>\n"
+            "    <notification name=\"notif\"/>\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <status value=\"current\"/>\n"
+            "    <uses name=\"uses\"/>\n"
+            "    <when condition=\"when-cond\"/>\n"
+            EXT_SUBELEM
+            "</augment>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &aug_meta, NULL, NULL), LY_SUCCESS);
     assert_string_equal(augments->nodeid, "target");
     assert_null(augments->parent);
@@ -3704,10 +3722,10 @@
 
     /* max subelems and valid arguments */
     data = ELEMENT_WRAPPER_START
-                "<deviate value=\"not-supported\">"
-                    EXT_SUBELEM
-                "</deviate>"
-           ELEMENT_WRAPPER_END;
+            "<deviate value=\"not-supported\">"
+            EXT_SUBELEM
+            "</deviate>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &deviates, NULL, NULL), LY_SUCCESS);
     assert_int_equal(deviates->mod, LYS_DEV_NOT_SUPPORTED);
     assert_string_equal(deviates->exts[0].name, "urn:example:extensions:c-define");
@@ -3718,18 +3736,18 @@
     deviates = NULL;
 
     data = ELEMENT_WRAPPER_START
-                "<deviate value=\"add\">"
-                    "<units name=\"units\"/>"
-                    "<must condition=\"cond\"/>"
-                    "<unique tag=\"utag\"/>"
-                    "<default value=\"def\"/>"
-                    "<config value=\"true\"/>"
-                    "<mandatory value=\"true\"/>"
-                    "<min-elements value=\"5\"/>"
-                    "<max-elements value=\"15\"/>"
-                    EXT_SUBELEM
-                "</deviate>"
-           ELEMENT_WRAPPER_END;
+            "<deviate value=\"add\">\n"
+            "    <units name=\"units\"/>\n"
+            "    <must condition=\"cond\"/>\n"
+            "    <unique tag=\"utag\"/>\n"
+            "    <default value=\"def\"/>\n"
+            "    <config value=\"true\"/>\n"
+            "    <mandatory value=\"true\"/>\n"
+            "    <min-elements value=\"5\"/>\n"
+            "    <max-elements value=\"15\"/>\n"
+            EXT_SUBELEM
+            "</deviate>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &deviates, NULL, NULL), LY_SUCCESS);
     d_add = (struct lysp_deviate_add *)deviates;
     assert_int_equal(d_add->mod, LYS_DEV_ADD);
@@ -3749,17 +3767,17 @@
     deviates = NULL;
 
     data = ELEMENT_WRAPPER_START
-                "<deviate value=\"replace\">"
-                    "<type name=\"newtype\"/>"
-                    "<units name=\"uni\"/>"
-                    "<default value=\"def\"/>"
-                    "<config value=\"true\"/>"
-                    "<mandatory value=\"true\"/>"
-                    "<min-elements value=\"5\"/>"
-                    "<max-elements value=\"15\"/>"
-                    EXT_SUBELEM
-                "</deviate>"
-           ELEMENT_WRAPPER_END;
+            "<deviate value=\"replace\">\n"
+            "    <type name=\"newtype\"/>\n"
+            "    <units name=\"uni\"/>\n"
+            "    <default value=\"def\"/>\n"
+            "    <config value=\"true\"/>\n"
+            "    <mandatory value=\"true\"/>\n"
+            "    <min-elements value=\"5\"/>\n"
+            "    <max-elements value=\"15\"/>\n"
+            EXT_SUBELEM
+            "</deviate>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &deviates, NULL, NULL), LY_SUCCESS);
     d_rpl = (struct lysp_deviate_rpl *)deviates;
     assert_int_equal(d_rpl->mod, LYS_DEV_REPLACE);
@@ -3778,14 +3796,14 @@
     deviates = NULL;
 
     data = ELEMENT_WRAPPER_START
-                "<deviate value=\"delete\">"
-                    "<units name=\"u\"/>"
-                    "<must condition=\"c\"/>"
-                    "<unique tag=\"tag\"/>"
-                    "<default value=\"default\"/>"
-                    EXT_SUBELEM
-                "</deviate>"
-           ELEMENT_WRAPPER_END;
+            "<deviate value=\"delete\">\n"
+            "    <units name=\"u\"/>\n"
+            "    <must condition=\"c\"/>\n"
+            "    <unique tag=\"tag\"/>\n"
+            "    <default value=\"default\"/>\n"
+            EXT_SUBELEM
+            "</deviate>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &deviates, NULL, NULL), LY_SUCCESS);
     d_del = (struct lysp_deviate_del *)deviates;
     assert_int_equal(d_del->mod, LYS_DEV_DELETE);
@@ -3823,12 +3841,12 @@
     deviates = NULL;
 
     data = ELEMENT_WRAPPER_START
-                "<deviate value=\"not-supported\">"
-                    "<must condition=\"c\"/>"
-                "</deviate>"
-           ELEMENT_WRAPPER_END;
+            "<deviate value=\"not-supported\">\n"
+            "    <must condition=\"c\"/>\n"
+            "</deviate>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &deviates, NULL, NULL), LY_EVALID);
-    logbuf_assert("Deviate of this type doesn't allow \"must\" as it's sub-element. Line number 1.");
+    logbuf_assert("Deviate of this type doesn't allow \"must\" as it's sub-element. Line number 2.");
 
     st->finished_correctly = true;
 }
@@ -3842,10 +3860,10 @@
 
     /* min subelems */
     data = ELEMENT_WRAPPER_START
-                "<deviation target-node=\"target\">"
-                    "<deviate value=\"not-supported\"/>"
-                "</deviation>"
-           ELEMENT_WRAPPER_END;
+            "<deviation target-node=\"target\">\n"
+            "    <deviate value=\"not-supported\"/>\n"
+            "</deviation>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &deviations, NULL, NULL), LY_SUCCESS);
     assert_string_equal(deviations->nodeid, "target");
     assert_int_equal(deviations->deviates->mod, LYS_DEV_NOT_SUPPORTED);
@@ -3854,13 +3872,13 @@
 
     /* max subelems */
     data = ELEMENT_WRAPPER_START
-                "<deviation target-node=\"target\">"
-                    "<reference><text>ref</text></reference>"
-                    "<description><text>desc</text></description>"
-                    "<deviate value=\"add\"/>"
-                    EXT_SUBELEM
-                "</deviation>"
-           ELEMENT_WRAPPER_END;
+            "<deviation target-node=\"target\">\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <description><text>desc</text></description>\n"
+            "    <deviate value=\"add\"/>\n"
+            EXT_SUBELEM
+            "</deviation>"
+            ELEMENT_WRAPPER_END;
     assert_int_equal(test_element_helper(st, data, &deviations, NULL, NULL), LY_SUCCESS);
     assert_string_equal(deviations->nodeid, "target");
     assert_int_equal(deviations->deviates->mod, LYS_DEV_ADD);
@@ -3905,35 +3923,37 @@
 
     /* max subelems */
     data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" name=\"mod\">\n"
-                "<yang-version value=\"1.1\"/>\n"
-                "<namespace uri=\"ns\"/>\n"
-                "<prefix value=\"pref\"/>\n"
-                "<include module=\"b-mod\"/>\n"
-                "<import module=\"a-mod\"><prefix value=\"imp-pref\"/></import>\n"
-                "<organization><text>org</text></organization>\n"
-                "<contact><text>contact</text></contact>\n"
-                "<description><text>desc</text></description>"
-                "<reference><text>ref</text></reference>\n"
-                "<revision date=\"2019-02-02\"/>\n"
-                "<anydata name=\"anyd\"/>\n"
-                "<anyxml name=\"anyx\"/>\n"
-                "<choice name=\"choice\"/>\n"
-                "<container name=\"cont\"/>\n"
-                "<leaf name=\"leaf\"> <type name=\"type\"/> </leaf>\n"
-                "<leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>\n"
-                "<list name=\"sub-list\"/>\n"
-                "<uses name=\"uses-name\"/>\n"
-                "<augment target-node=\"target\"/>\n"
-                "<deviation target-node=\"target\">""<deviate value=\"not-supported\"/>""</deviation>\n"
-                "<extension name=\"ext\"/>\n"
-                "<feature name=\"feature\"/>\n"
-                "<grouping name=\"grp\"/>\n"
-                "<identity name=\"ident-name\"/>\n"
-                "<notification name=\"notf\"/>\n"
-                "<rpc name=\"rpc-name\"/>\n"
-                "<typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>\n"
-                EXT_SUBELEM"\n"
-           "</module>\n";
+            "    <yang-version value=\"1.1\"/>\n"
+            "    <namespace uri=\"ns\"/>\n"
+            "    <prefix value=\"pref\"/>\n"
+            "    <include module=\"b-mod\"/>\n"
+            "    <import module=\"a-mod\"><prefix value=\"imp-pref\"/></import>\n"
+            "    <organization><text>org</text></organization>\n"
+            "    <contact><text>contact</text></contact>\n"
+            "    <description><text>desc</text></description>\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <revision date=\"2019-02-02\"/>\n"
+            "    <anydata name=\"anyd\"/>\n"
+            "    <anyxml name=\"anyx\"/>\n"
+            "    <choice name=\"choice\"/>\n"
+            "    <container name=\"cont\"/>\n"
+            "    <leaf name=\"leaf\"> <type name=\"type\"/> </leaf>\n"
+            "    <leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>\n"
+            "    <list name=\"sub-list\"/>\n"
+            "    <uses name=\"uses-name\"/>\n"
+            "    <augment target-node=\"target\"/>\n"
+            "    <deviation target-node=\"target\">\n"
+            "        <deviate value=\"not-supported\"/>\n"
+            "    </deviation>\n"
+            "    <extension name=\"ext\"/>\n"
+            "    <feature name=\"feature\"/>\n"
+            "    <grouping name=\"grp\"/>\n"
+            "    <identity name=\"ident-name\"/>\n"
+            "    <notification name=\"notf\"/>\n"
+            "    <rpc name=\"rpc-name\"/>\n"
+            "    <typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>\n"
+            EXT_SUBELEM "\n"
+            "</module>\n";
     assert_int_equal(ly_in_new_memory(data, &st->in), LY_SUCCESS);
     assert_int_equal(lyxml_ctx_new(st->ctx, st->in, &st->yin_ctx->xmlctx), LY_SUCCESS);
 
@@ -3984,11 +4004,11 @@
     ly_in_free(st->in, 0);
     lyxml_ctx_free(st->yin_ctx->xmlctx);
     lysp_mod = mod_renew(st->yin_ctx);
-    data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" name=\"mod\">"
-                "<namespace uri=\"ns\"/>"
-                "<prefix value=\"pref\"/>"
-                "<yang-version value=\"1.1\"/>"
-           "</module>";
+    data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" name=\"mod\">\n"
+            "    <namespace uri=\"ns\"/>\n"
+            "    <prefix value=\"pref\"/>\n"
+            "    <yang-version value=\"1.1\"/>\n"
+            "</module>";
     assert_int_equal(ly_in_new_memory(data, &st->in), LY_SUCCESS);
     assert_int_equal(lyxml_ctx_new(st->ctx, st->in, &st->yin_ctx->xmlctx), LY_SUCCESS);
     assert_int_equal(yin_parse_mod(st->yin_ctx, lysp_mod), LY_SUCCESS);
@@ -3998,16 +4018,16 @@
     ly_in_free(st->in, 0);
     lyxml_ctx_free(st->yin_ctx->xmlctx);
     lysp_mod = mod_renew(st->yin_ctx);
-    data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" name=\"mod\">"
-                "<feature name=\"feature\"/>\n"
-                "<namespace uri=\"ns\"/>"
-                "<prefix value=\"pref\"/>"
-                "<yang-version value=\"1.1\"/>"
-           "</module>";
+    data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" name=\"mod\">\n"
+            "    <feature name=\"feature\"/>\n"
+            "    <namespace uri=\"ns\"/>\n"
+            "    <prefix value=\"pref\"/>\n"
+            "    <yang-version value=\"1.1\"/>\n"
+            "</module>";
     assert_int_equal(ly_in_new_memory(data, &st->in), LY_SUCCESS);
     assert_int_equal(lyxml_ctx_new(st->ctx, st->in, &st->yin_ctx->xmlctx), LY_SUCCESS);
     assert_int_equal(yin_parse_mod(st->yin_ctx, lysp_mod), LY_EVALID);
-    logbuf_assert("Invalid order of module\'s sub-elements \"namespace\" can\'t appear after \"feature\". Line number 2.");
+    logbuf_assert("Invalid order of module\'s sub-elements \"namespace\" can\'t appear after \"feature\". Line number 3.");
 
     st->finished_correctly = true;
 }
@@ -4036,34 +4056,38 @@
 
     /* max subelements */
     data = "<submodule xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" name=\"mod\">\n"
-                "<yang-version value=\"1.1\"/>\n"
-                "<belongs-to module=\"module-name\"><prefix value=\"pref\"/></belongs-to>"
-                "<include module=\"b-mod\"/>\n"
-                "<import module=\"a-mod\"><prefix value=\"imp-pref\"/></import>\n"
-                "<organization><text>org</text></organization>\n"
-                "<contact><text>contact</text></contact>\n"
-                "<description><text>desc</text></description>"
-                "<reference><text>ref</text></reference>\n"
-                "<revision date=\"2019-02-02\"/>\n"
-                "<anydata name=\"anyd\"/>\n"
-                "<anyxml name=\"anyx\"/>\n"
-                "<choice name=\"choice\"/>\n"
-                "<container name=\"cont\"/>\n"
-                "<leaf name=\"leaf\"> <type name=\"type\"/> </leaf>\n"
-                "<leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>\n"
-                "<list name=\"sub-list\"/>\n"
-                "<uses name=\"uses-name\"/>\n"
-                "<augment target-node=\"target\"/>\n"
-                "<deviation target-node=\"target\">""<deviate value=\"not-supported\"/>""</deviation>\n"
-                "<extension name=\"ext\"/>\n"
-                "<feature name=\"feature\"/>\n"
-                "<grouping name=\"grp\"/>\n"
-                "<identity name=\"ident-name\"/>\n"
-                "<notification name=\"notf\"/>\n"
-                "<rpc name=\"rpc-name\"/>\n"
-                "<typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>\n"
-                EXT_SUBELEM"\n"
-           "</submodule>\n";
+            "    <yang-version value=\"1.1\"/>\n"
+            "    <belongs-to module=\"module-name\">\n"
+            "        <prefix value=\"pref\"/>\n"
+            "    </belongs-to>\n"
+            "    <include module=\"b-mod\"/>\n"
+            "    <import module=\"a-mod\"><prefix value=\"imp-pref\"/></import>\n"
+            "    <organization><text>org</text></organization>\n"
+            "    <contact><text>contact</text></contact>\n"
+            "    <description><text>desc</text></description>\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <revision date=\"2019-02-02\"/>\n"
+            "    <anydata name=\"anyd\"/>\n"
+            "    <anyxml name=\"anyx\"/>\n"
+            "    <choice name=\"choice\"/>\n"
+            "    <container name=\"cont\"/>\n"
+            "    <leaf name=\"leaf\"> <type name=\"type\"/> </leaf>\n"
+            "    <leaf-list name=\"llist\"> <type name=\"type\"/> </leaf-list>\n"
+            "    <list name=\"sub-list\"/>\n"
+            "    <uses name=\"uses-name\"/>\n"
+            "    <augment target-node=\"target\"/>\n"
+            "    <deviation target-node=\"target\">\n"
+            "        <deviate value=\"not-supported\"/>\n"
+            "    </deviation>\n"
+            "    <extension name=\"ext\"/>\n"
+            "    <feature name=\"feature\"/>\n"
+            "    <grouping name=\"grp\"/>\n"
+            "    <identity name=\"ident-name\"/>\n"
+            "    <notification name=\"notf\"/>\n"
+            "    <rpc name=\"rpc-name\"/>\n"
+            "    <typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>\n"
+            EXT_SUBELEM "\n"
+            "</submodule>\n";
     assert_int_equal(ly_in_new_memory(data, &st->in), LY_SUCCESS);
     assert_int_equal(lyxml_ctx_new(st->ctx, st->in, &st->yin_ctx->xmlctx), LY_SUCCESS);
 
@@ -4113,10 +4137,10 @@
     ly_in_free(st->in, 0);
     lyxml_ctx_free(st->yin_ctx->xmlctx);
     lysp_submod = submod_renew(st->yin_ctx, "module-name");
-    data = "<submodule xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" name=\"submod\">"
-                "<yang-version value=\"1\"/>"
-                "<belongs-to module=\"module-name\"><prefix value=\"pref\"/></belongs-to>"
-           "</submodule>";
+    data = "<submodule xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" name=\"submod\">\n"
+            "    <yang-version value=\"1\"/>\n"
+            "    <belongs-to module=\"module-name\"><prefix value=\"pref\"/></belongs-to>\n"
+            "</submodule>";
     assert_int_equal(ly_in_new_memory(data, &st->in), LY_SUCCESS);
     assert_int_equal(lyxml_ctx_new(st->ctx, st->in, &st->yin_ctx->xmlctx), LY_SUCCESS);
     assert_int_equal(yin_parse_submod(st->yin_ctx, lysp_submod), LY_SUCCESS);
@@ -4127,15 +4151,15 @@
     ly_in_free(st->in, 0);
     lyxml_ctx_free(st->yin_ctx->xmlctx);
     lysp_submod = submod_renew(st->yin_ctx, "module-name");
-    data = "<submodule xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" name=\"submod\">"
-                "<yang-version value=\"1\"/>"
-                "<reference><text>ref</text></reference>\n"
-                "<belongs-to module=\"module-name\"><prefix value=\"pref\"/></belongs-to>"
-           "</submodule>";
+    data = "<submodule xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" name=\"submod\">\n"
+            "    <yang-version value=\"1\"/>\n"
+            "    <reference><text>ref</text></reference>\n"
+            "    <belongs-to module=\"module-name\"><prefix value=\"pref\"/></belongs-to>\n"
+            "</submodule>";
     assert_int_equal(ly_in_new_memory(data, &st->in), LY_SUCCESS);
     assert_int_equal(lyxml_ctx_new(st->ctx, st->in, &st->yin_ctx->xmlctx), LY_SUCCESS);
     assert_int_equal(yin_parse_submod(st->yin_ctx, lysp_submod), LY_EVALID);
-    logbuf_assert("Invalid order of submodule's sub-elements \"belongs-to\" can't appear after \"reference\". Line number 2.");
+    logbuf_assert("Invalid order of submodule's sub-elements \"belongs-to\" can't appear after \"reference\". Line number 4.");
 
     st->finished_correctly = true;
 }
@@ -4153,26 +4177,26 @@
     mod = calloc(1, sizeof *mod);
     mod->ctx = st->ctx;
     data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" xmlns:md=\"urn:ietf:params:xml:ns:yang:ietf-yang-metadata\" name=\"a\"> \n"
-           "<yang-version value=\"1.1\"/>\n"
-           "<namespace uri=\"urn:tests:extensions:metadata:a\"/>\n"
-           "<prefix value=\"a\"/>\n"
-           "<import module=\"ietf-yang-metadata\">\n"
-                "<prefix value=\"md\"/>\n"
-           "</import>\n"
-           "<feature name=\"f\"/>\n"
-           "<md:annotation name=\"x\">\n"
-                "<description>\n"
-                "<text>test</text>\n"
-                "</description>\n"
-                "<reference>\n"
-                "<text>test</text>\n"
-                "</reference>\n"
-                "<if-feature name=\"f\"/>\n"
-                "<status value=\"current\"/>\n"
-                "<type name=\"uint8\"/>\n"
-                "<units name=\"meters\"/>\n"
-           "</md:annotation>\n"
-           "</module>\n";
+            "    <yang-version value=\"1.1\"/>\n"
+            "    <namespace uri=\"urn:tests:extensions:metadata:a\"/>\n"
+            "    <prefix value=\"a\"/>\n"
+            "    <import module=\"ietf-yang-metadata\">\n"
+            "        <prefix value=\"md\"/>\n"
+            "    </import>\n"
+            "    <feature name=\"f\"/>\n"
+            "    <md:annotation name=\"x\">\n"
+            "        <description>\n"
+            "            <text>test</text>\n"
+            "        </description>\n"
+            "        <reference>\n"
+            "            <text>test</text>\n"
+            "        </reference>\n"
+            "        <if-feature name=\"f\"/>\n"
+            "        <status value=\"current\"/>\n"
+            "        <type name=\"uint8\"/>\n"
+            "        <units name=\"meters\"/>\n"
+            "    </md:annotation>\n"
+            "</module>\n";
     assert_int_equal(ly_in_new_memory(data, &in), LY_SUCCESS);
     assert_int_equal(yin_parse_module(&yin_ctx, in, mod, &unres), LY_SUCCESS);
     assert_null(mod->parsed->exts->child->next->child);
@@ -4186,33 +4210,33 @@
 
     mod = calloc(1, sizeof *mod);
     mod->ctx = st->ctx;
-    data =  "<module name=\"example-foo\""
-             "xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\""
-             "xmlns:foo=\"urn:example:foo\""
-             "xmlns:myext=\"urn:example:extensions\">\n"
+    data = "<module name=\"example-foo\""
+            "    xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\""
+            "    xmlns:foo=\"urn:example:foo\""
+            "    xmlns:myext=\"urn:example:extensions\">\n"
 
-                "<yang-version value=\"1\"/>\n"
+            "    <yang-version value=\"1\"/>\n"
 
-                "<namespace uri=\"urn:example:foo\"/>\n"
-                "<prefix value=\"foo\"/>\n"
+            "    <namespace uri=\"urn:example:foo\"/>\n"
+            "    <prefix value=\"foo\"/>\n"
 
-                "<import module=\"example-extensions\">\n"
-                    "<prefix value=\"myext\"/>\n"
-                "</import>\n"
+            "    <import module=\"example-extensions\">\n"
+            "        <prefix value=\"myext\"/>\n"
+            "    </import>\n"
 
-                "<list name=\"interface\">\n"
-                    "<key value=\"name\"/>\n"
-                    "<leaf name=\"name\">\n"
-                        "<type name=\"string\"/>\n"
-                    "</leaf>\n"
-                    "<leaf name=\"mtu\">\n"
-                        "<type name=\"uint32\"/>\n"
-                        "<description>\n"
-                            "<text>The MTU of the interface.</text>\n"
-                        "</description>\n"
-                        "<myext:c-define name=\"MY_MTU\"/>\n"
-                    "</leaf>\n"
-                "</list>\n"
+            "    <list name=\"interface\">\n"
+            "        <key value=\"name\"/>\n"
+            "        <leaf name=\"name\">\n"
+            "            <type name=\"string\"/>\n"
+            "        </leaf>\n"
+            "        <leaf name=\"mtu\">\n"
+            "            <type name=\"uint32\"/>\n"
+            "            <description>\n"
+            "                <text>The MTU of the interface.</text>\n"
+            "            </description>\n"
+            "            <myext:c-define name=\"MY_MTU\"/>\n"
+            "        </leaf>\n"
+            "    </list>\n"
             "</module>\n";
     assert_int_equal(ly_in_new_memory(data, &in), LY_SUCCESS);
     assert_int_equal(yin_parse_module(&yin_ctx, in, mod, &unres), LY_SUCCESS);
@@ -4225,10 +4249,10 @@
 
     mod = calloc(1, sizeof *mod);
     mod->ctx = st->ctx;
-    data =  "<module name=\"example-foo\" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">\n"
-                "<yang-version value=\"1\"/>\n"
-                "<namespace uri=\"urn:example:foo\"/>\n"
-                "<prefix value=\"foo\"/>\n"
+    data = "<module name=\"example-foo\" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">\n"
+            "    <yang-version value=\"1\"/>\n"
+            "    <namespace uri=\"urn:example:foo\"/>\n"
+            "    <prefix value=\"foo\"/>\n"
             "</module>\n";
     assert_int_equal(ly_in_new_memory(data, &in), LY_SUCCESS);
     assert_int_equal(yin_parse_module(&yin_ctx, in, mod, &unres), LY_SUCCESS);
@@ -4239,10 +4263,9 @@
     mod = NULL;
     yin_ctx = NULL;
 
-
     mod = calloc(1, sizeof *mod);
     mod->ctx = st->ctx;
-    data =  "<submodule name=\"example-foo\" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">"
+    data = "<submodule name=\"example-foo\" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">"
             "</submodule>\n";
     assert_int_equal(ly_in_new_memory(data, &in), LY_SUCCESS);
     assert_int_equal(yin_parse_module(&yin_ctx, in, mod, &unres), LY_EINVAL);
@@ -4253,15 +4276,15 @@
 
     mod = calloc(1, sizeof *mod);
     mod->ctx = st->ctx;
-    data =  "<module name=\"example-foo\" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">\n"
-                "<yang-version value=\"1\"/>\n"
-                "<namespace uri=\"urn:example:foo\"/>\n"
-                "<prefix value=\"foo\"/>\n"
-            "</module>"
+    data = "<module name=\"example-foo\" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">\n"
+            "    <yang-version value=\"1\"/>\n"
+            "    <namespace uri=\"urn:example:foo\"/>\n"
+            "    <prefix value=\"foo\"/>\n"
+            "</module>\n"
             "<module>";
     assert_int_equal(ly_in_new_memory(data, &in), LY_SUCCESS);
     assert_int_equal(yin_parse_module(&yin_ctx, in, mod, &unres), LY_EVALID);
-    logbuf_assert("Trailing garbage \"<module>\" after module, expected end-of-input. Line number 5.");
+    logbuf_assert("Trailing garbage \"<module>\" after module, expected end-of-input. Line number 6.");
     lys_module_free(mod, NULL);
     yin_parser_ctx_free(yin_ctx);
     ly_in_free(in, 0);
@@ -4282,29 +4305,29 @@
 
     lydict_insert(st->ctx, "a", 0, &st->yin_ctx->parsed_mod->mod->name);
 
-    data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+    data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
             "<submodule name=\"asub\""
-              "xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\""
-              "xmlns:a=\"urn:a\">"
-                "<yang-version value=\"1\"/>\n"
-                "<belongs-to module=\"a\">"
-                    "<prefix value=\"a_pref\"/>"
-                "</belongs-to>"
-                "<include module=\"atop\"/>"
-                "<feature name=\"fox\"/>"
-                "<notification name=\"bar-notif\">"
-                    "<if-feature name=\"bar\"/>"
-                "</notification>"
-                "<notification name=\"fox-notif\">"
-                    "<if-feature name=\"fox\"/>"
-                "</notification>"
-                "<augment target-node=\"/a_pref:top\">"
-                    "<if-feature name=\"bar\"/>"
-                    "<container name=\"bar-sub\"/>"
-                "</augment>"
-                "<augment target-node=\"/top\">"
-                    "<container name=\"bar-sub2\"/>"
-                "</augment>"
+            "    xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\""
+            "    xmlns:a=\"urn:a\">\n"
+            "    <yang-version value=\"1\"/>\n"
+            "    <belongs-to module=\"a\">\n"
+            "        <prefix value=\"a_pref\"/>\n"
+            "    </belongs-to>\n"
+            "    <include module=\"atop\"/>\n"
+            "    <feature name=\"fox\"/>\n"
+            "    <notification name=\"bar-notif\">\n"
+            "        <if-feature name=\"bar\"/>\n"
+            "    </notification>\n"
+            "    <notification name=\"fox-notif\">\n"
+            "        <if-feature name=\"fox\"/>\n"
+            "    </notification>\n"
+            "    <augment target-node=\"/a_pref:top\">\n"
+            "        <if-feature name=\"bar\"/>\n"
+            "        <container name=\"bar-sub\"/>\n"
+            "    </augment>\n"
+            "    <augment target-node=\"/top\">\n"
+            "        <container name=\"bar-sub2\"/>\n"
+            "    </augment>\n"
             "</submodule>";
     assert_int_equal(ly_in_new_memory(data, &in), LY_SUCCESS);
     assert_int_equal(yin_parse_submodule(&yin_ctx, st->ctx, (struct lys_parser_ctx *)st->yin_ctx, in, &submod), LY_SUCCESS);
@@ -4314,12 +4337,12 @@
     yin_ctx = NULL;
     submod = NULL;
 
-    data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-            "<submodule name=\"asub\" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">"
-                "<yang-version value=\"1\"/>\n"
-                "<belongs-to module=\"a\">"
-                    "<prefix value=\"a_pref\"/>"
-                "</belongs-to>"
+    data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+            "<submodule name=\"asub\" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">\n"
+            "    <yang-version value=\"1\"/>\n"
+            "    <belongs-to module=\"a\">\n"
+            "        <prefix value=\"a_pref\"/>\n"
+            "    </belongs-to>\n"
             "</submodule>";
     assert_int_equal(ly_in_new_memory(data, &in), LY_SUCCESS);
     assert_int_equal(yin_parse_submodule(&yin_ctx, st->ctx, (struct lys_parser_ctx *)st->yin_ctx, in, &submod), LY_SUCCESS);
@@ -4329,7 +4352,7 @@
     yin_ctx = NULL;
     submod = NULL;
 
-    data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+    data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
             "<module name=\"inval\" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">"
             "</module>";
     assert_int_equal(ly_in_new_memory(data, &in), LY_SUCCESS);
@@ -4341,22 +4364,22 @@
     yin_ctx = NULL;
     submod = NULL;
 
-    data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-            "<submodule name=\"asub\" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">"
-                "<yang-version value=\"1\"/>\n"
-                "<belongs-to module=\"a\">"
-                    "<prefix value=\"a_pref\"/>"
-                "</belongs-to>"
-            "</submodule>"
-            "<submodule name=\"asub\" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">"
-                "<yang-version value=\"1\"/>\n"
-                "<belongs-to module=\"a\">"
-                    "<prefix value=\"a_pref\"/>"
-                "</belongs-to>"
+    data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+            "<submodule name=\"asub\" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">\n"
+            "    <yang-version value=\"1\"/>\n"
+            "    <belongs-to module=\"a\">\n"
+            "        <prefix value=\"a_pref\"/>\n"
+            "    </belongs-to>\n"
+            "</submodule>\n"
+            "<submodule name=\"asub\" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">\n"
+            "    <yang-version value=\"1\"/>\n"
+            "    <belongs-to module=\"a\">\n"
+            "        <prefix value=\"a_pref\"/>\n"
+            "    </belongs-to>\n"
             "</submodule>";
     assert_int_equal(ly_in_new_memory(data, &in), LY_SUCCESS);
     assert_int_equal(yin_parse_submodule(&yin_ctx, st->ctx, (struct lys_parser_ctx *)st->yin_ctx, in, &submod), LY_EVALID);
-    logbuf_assert("Trailing garbage \"<submodule name...\" after submodule, expected end-of-input. Line number 2.");
+    logbuf_assert("Trailing garbage \"<submodule name...\" after submodule, expected end-of-input. Line number 8.");
     lysp_module_free((struct lysp_module *)submod);
     yin_parser_ctx_free(yin_ctx);
     ly_in_free(in, 0);
diff --git a/tests/utests/schema/test_printer_yang.c b/tests/utests/schema/test_printer_yang.c
index b59e6b2..4296c05 100644
--- a/tests/utests/schema/test_printer_yang.c
+++ b/tests/utests/schema/test_printer_yang.c
@@ -12,19 +12,12 @@
  *     https://opensource.org/licenses/BSD-3-Clause
  */
 
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
-#include <stdio.h>
-#include <string.h>
-
 #include "common.h"
 #include "context.h"
 #include "out.h"
 #include "printer_schema.h"
 #include "tree_schema.h"
+#include "utests.h"
 
 #define BUFSIZE 1024
 char logbuf[BUFSIZE] = {0};
@@ -49,6 +42,7 @@
         }
     }
 }
+
 #endif
 
 static int
@@ -218,9 +212,10 @@
     ly_ctx_destroy(ctx, NULL);
 }
 
-static LY_ERR test_imp_clb(const char *UNUSED(mod_name), const char *UNUSED(mod_rev), const char *UNUSED(submod_name),
-                           const char *UNUSED(sub_rev), void *user_data, LYS_INFORMAT *format,
-                           const char **module_data, void (**free_module_data)(void *model_data, void *user_data))
+static LY_ERR
+test_imp_clb(const char *UNUSED(mod_name), const char *UNUSED(mod_rev), const char *UNUSED(submod_name),
+        const char *UNUSED(sub_rev), void *user_data, LYS_INFORMAT *format,
+        const char **module_data, void (**free_module_data)(void *model_data, void *user_data))
 {
     *module_data = user_data;
     *format = LYS_IN_YANG;
@@ -277,7 +272,8 @@
     ly_ctx_destroy(ctx, NULL);
 }
 
-int main(void)
+int
+main(void)
 {
     const struct CMUnitTest tests[] = {
         cmocka_unit_test_setup_teardown(test_module, logger_setup, logger_teardown),
diff --git a/tests/utests/schema/test_printer_yin.c b/tests/utests/schema/test_printer_yin.c
index dcb5925..3688faa 100644
--- a/tests/utests/schema/test_printer_yin.c
+++ b/tests/utests/schema/test_printer_yin.c
@@ -12,20 +12,12 @@
  *     https://opensource.org/licenses/BSD-3-Clause
  */
 
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
 #include "common.h"
 #include "context.h"
 #include "out.h"
 #include "printer_schema.h"
 #include "tree_schema.h"
+#include "utests.h"
 
 #define BUFSIZE 1024
 char logbuf[BUFSIZE] = {0};
@@ -50,6 +42,7 @@
         }
     }
 }
+
 #endif
 
 static int
@@ -94,7 +87,7 @@
     struct ly_ctx *ctx = {0};
     const struct lys_module *mod;
 
-    const char * orig =
+    const char *orig =
             "module all {\n"
             "    yang-version 1.1;\n"
             "    namespace \"urn:all\";\n"
@@ -332,7 +325,7 @@
             "    }\n"
             "}\n";
 
-    const char * ori_res =
+    const char *ori_res =
             "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
             "<module name=\"all\"\n"
             "        xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\"\n"
@@ -596,9 +589,10 @@
     ly_ctx_destroy(ctx, NULL);
 }
 
-static LY_ERR test_imp_clb(const char *UNUSED(mod_name), const char *UNUSED(mod_rev), const char *UNUSED(submod_name),
-                           const char *UNUSED(sub_rev), void *user_data, LYS_INFORMAT *format,
-                           const char **module_data, void (**free_module_data)(void *model_data, void *user_data))
+static LY_ERR
+test_imp_clb(const char *UNUSED(mod_name), const char *UNUSED(mod_rev), const char *UNUSED(submod_name),
+        const char *UNUSED(sub_rev), void *user_data, LYS_INFORMAT *format,
+        const char **module_data, void (**free_module_data)(void *model_data, void *user_data))
 {
     *module_data = user_data;
     *format = LYS_IN_YIN;
@@ -664,7 +658,8 @@
     ly_ctx_destroy(ctx, NULL);
 }
 
-int main(void)
+int
+main(void)
 {
     const struct CMUnitTest tests[] = {
         cmocka_unit_test_setup_teardown(test_module, logger_setup, logger_teardown),
@@ -673,4 +668,3 @@
 
     return cmocka_run_group_tests(tests, NULL, NULL);
 }
-
diff --git a/tests/utests/schema/test_schema.c b/tests/utests/schema/test_schema.c
index d8da7d6..ebe8af3 100644
--- a/tests/utests/schema/test_schema.c
+++ b/tests/utests/schema/test_schema.c
@@ -14,18 +14,13 @@
 
 #include "test_schema.h"
 
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
 #include <string.h>
 
 #include "log.h"
 #include "parser_schema.h"
 #include "tests/config.h"
 #include "tree_schema.h"
+#include "utests.h"
 
 #if ENABLE_LOGGER_CHECKING
 
@@ -48,6 +43,7 @@
         }
     }
 }
+
 #endif
 
 static int
@@ -85,8 +81,8 @@
 
 LY_ERR
 test_imp_clb(const char *UNUSED(mod_name), const char *UNUSED(mod_rev), const char *UNUSED(submod_name),
-             const char *UNUSED(sub_rev), void *user_data, LYS_INFORMAT *format,
-             const char **module_data, void (**free_module_data)(void *model_data, void *user_data))
+        const char *UNUSED(sub_rev), void *user_data, LYS_INFORMAT *format,
+        const char **module_data, void (**free_module_data)(void *model_data, void *user_data))
 {
     *module_data = user_data;
     *format = LYS_IN_YANG;
@@ -108,7 +104,8 @@
 void test_identity(void **state);
 void test_feature(void **state);
 
-int main(void)
+int
+main(void)
 {
     const struct CMUnitTest tests[] = {
         /** test_schema_common.c */
diff --git a/tests/utests/schema/test_schema.h b/tests/utests/schema/test_schema.h
index 866e986..2599db3 100644
--- a/tests/utests/schema/test_schema.h
+++ b/tests/utests/schema/test_schema.h
@@ -11,6 +11,7 @@
  *
  *     https://opensource.org/licenses/BSD-3-Clause
  */
+
 #ifndef TESTS_UTESTS_SCHEMA_TEST_SCHEMA_H_
 #define TESTS_UTESTS_SCHEMA_TEST_SCHEMA_H_
 
@@ -22,7 +23,7 @@
 #define ENABLE_LOGGER_CHECKING 1
 
 #if ENABLE_LOGGER_CHECKING
-    extern char logbuf[];
+extern char logbuf[];
 #   define logbuf_assert(str) assert_string_equal(logbuf, str)
 #else
 #   define logbuf_assert(str)
@@ -31,9 +32,8 @@
 void logbuf_clean(void);
 
 LY_ERR test_imp_clb(const char *UNUSED(mod_name), const char *UNUSED(mod_rev), const char *UNUSED(submod_name),
-                    const char *UNUSED(sub_rev), void *user_data, LYS_INFORMAT *format,
-                    const char **module_data, void (**free_module_data)(void *model_data, void *user_data));
-
+        const char *UNUSED(sub_rev), void *user_data, LYS_INFORMAT * format,
+        const char **module_data, void (**free_module_data)(void *model_data, void *user_data));
 
 #define TEST_YANG_MODULE_10(MOD_NAME, MOD_PREFIX, MOD_NS, CONTENT) \
     "module "MOD_NAME" { namespace "MOD_NS"; prefix "MOD_PREFIX"; "CONTENT"}"
@@ -87,7 +87,7 @@
                         "Duplicate keyword \""MEMBER"\". Line number "LINE"."); \
     }
 
-#define TEST_STMT_SUBSTM_ERR(CTX, RFC7950, STMT, SUBSTMT, VALUE); \
+#define TEST_STMT_SUBSTM_ERR(CTX, RFC7950, STMT, SUBSTMT, VALUE) ;\
         TEST_SCHEMA_ERR(CTX, RFC7950, 0, "inv", STMT" test {"SUBSTMT" "VALUE";}", "Invalid keyword \""SUBSTMT"\" as a child of \""STMT"\". Line number 1.");
 
 #endif /* TESTS_UTESTS_SCHEMA_TEST_SCHEMA_H_ */
diff --git a/tests/utests/schema/test_schema_common.c b/tests/utests/schema/test_schema_common.c
index dabf106..8e3bc5d 100644
--- a/tests/utests/schema/test_schema_common.c
+++ b/tests/utests/schema/test_schema_common.c
@@ -12,18 +12,13 @@
  *     https://opensource.org/licenses/BSD-3-Clause
  */
 
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
 #include <string.h>
 
 #include "context.h"
 #include "log.h"
 #include "tree_schema.h"
 #include "tree_schema_internal.h"
+#include "utests.h"
 
 #include "test_schema.h"
 
@@ -41,19 +36,19 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {yang-version 1.1; namespace urn:a;prefix a;"
-                                        "container a { container one {presence test;} leaf two {type string;} leaf-list three {type string;}"
-                                        "  list four {config false;} choice x { leaf five {type string;} case y {leaf six {type string;}}}"
-                                        "  anyxml seven; action eight {input {leaf eight-input {type string;}} output {leaf eight-output {type string;}}}"
-                                        "  notification nine {leaf nine-data {type string;}}}"
-                                        "leaf b {type string;} leaf-list c {type string;} list d {config false;}"
-                                        "choice x { case empty-x { choice empty-xc { case nothing;}} leaf e {type string;} case y {leaf f {type string;}}} anyxml g;"
-                                        "rpc h {input {leaf h-input {type string;}} output {leaf h-output {type string;}}}"
-                                        "rpc i;"
-                                        "notification j {leaf i-data {type string;}}"
-                                        "notification k;}", LYS_IN_YANG, &mod));
+            "container a { container one {presence test;} leaf two {type string;} leaf-list three {type string;}"
+            "  list four {config false;} choice x { leaf five {type string;} case y {leaf six {type string;}}}"
+            "  anyxml seven; action eight {input {leaf eight-input {type string;}} output {leaf eight-output {type string;}}}"
+            "  notification nine {leaf nine-data {type string;}}}"
+            "leaf b {type string;} leaf-list c {type string;} list d {config false;}"
+            "choice x { case empty-x { choice empty-xc { case nothing;}} leaf e {type string;} case y {leaf f {type string;}}} anyxml g;"
+            "rpc h {input {leaf h-input {type string;}} output {leaf h-output {type string;}}}"
+            "rpc i;"
+            "notification j {leaf i-data {type string;}}"
+            "notification k;}", LYS_IN_YANG, &mod));
     assert_non_null(node = lys_getnext(node, NULL, mod->compiled, 0));
     assert_string_equal("a", node->name);
-    cont = (const struct lysc_node_container*)node;
+    cont = (const struct lysc_node_container *)node;
     assert_non_null(node = lys_getnext(node, NULL, mod->compiled, 0));
     assert_string_equal("b", node->name);
     assert_non_null(node = lys_getnext(node, NULL, mod->compiled, 0));
@@ -68,7 +63,7 @@
     assert_string_equal("g", node->name);
     assert_non_null(node = lys_getnext(node, NULL, mod->compiled, 0));
     assert_string_equal("h", node->name);
-    rpc = (const struct lysc_action*)node;
+    rpc = (const struct lysc_action *)node;
     assert_non_null(node = lys_getnext(node, NULL, mod->compiled, 0));
     assert_string_equal("i", node->name);
     assert_non_null(node = lys_getnext(node, NULL, mod->compiled, 0));
@@ -77,52 +72,52 @@
     assert_string_equal("k", node->name);
     assert_null(node = lys_getnext(node, NULL, mod->compiled, 0));
     /* Inside container */
-    assert_non_null(node = lys_getnext(node, (const struct lysc_node*)cont, mod->compiled, 0));
+    assert_non_null(node = lys_getnext(node, (const struct lysc_node *)cont, mod->compiled, 0));
     assert_string_equal("one", node->name);
-    assert_non_null(node = lys_getnext(node, (const struct lysc_node*)cont, mod->compiled, 0));
+    assert_non_null(node = lys_getnext(node, (const struct lysc_node *)cont, mod->compiled, 0));
     assert_string_equal("two", node->name);
-    assert_non_null(node = lys_getnext(node, (const struct lysc_node*)cont, mod->compiled, 0));
+    assert_non_null(node = lys_getnext(node, (const struct lysc_node *)cont, mod->compiled, 0));
     assert_string_equal("three", node->name);
-    assert_non_null(node = four = lys_getnext(node, (const struct lysc_node*)cont, mod->compiled, 0));
+    assert_non_null(node = four = lys_getnext(node, (const struct lysc_node *)cont, mod->compiled, 0));
     assert_string_equal("four", node->name);
-    assert_non_null(node = lys_getnext(node, (const struct lysc_node*)cont, mod->compiled, 0));
+    assert_non_null(node = lys_getnext(node, (const struct lysc_node *)cont, mod->compiled, 0));
     assert_string_equal("five", node->name);
-    assert_non_null(node = lys_getnext(node, (const struct lysc_node*)cont, mod->compiled, 0));
+    assert_non_null(node = lys_getnext(node, (const struct lysc_node *)cont, mod->compiled, 0));
     assert_string_equal("six", node->name);
-    assert_non_null(node = lys_getnext(node, (const struct lysc_node*)cont, mod->compiled, 0));
+    assert_non_null(node = lys_getnext(node, (const struct lysc_node *)cont, mod->compiled, 0));
     assert_string_equal("seven", node->name);
-    assert_non_null(node = lys_getnext(node, (const struct lysc_node*)cont, mod->compiled, 0));
+    assert_non_null(node = lys_getnext(node, (const struct lysc_node *)cont, mod->compiled, 0));
     assert_string_equal("eight", node->name);
-    assert_non_null(node = lys_getnext(node, (const struct lysc_node*)cont, mod->compiled, 0));
+    assert_non_null(node = lys_getnext(node, (const struct lysc_node *)cont, mod->compiled, 0));
     assert_string_equal("nine", node->name);
-    assert_null(node = lys_getnext(node, (const struct lysc_node*)cont, mod->compiled, 0));
+    assert_null(node = lys_getnext(node, (const struct lysc_node *)cont, mod->compiled, 0));
     /* Inside RPC */
-    assert_non_null(node = lys_getnext(node, (const struct lysc_node*)rpc, mod->compiled, 0));
+    assert_non_null(node = lys_getnext(node, (const struct lysc_node *)rpc, mod->compiled, 0));
     assert_string_equal("h-input", node->name);
-    assert_null(node = lys_getnext(node, (const struct lysc_node*)rpc, mod->compiled, 0));
+    assert_null(node = lys_getnext(node, (const struct lysc_node *)rpc, mod->compiled, 0));
 
     /* options */
-    assert_non_null(node = lys_getnext(four, (const struct lysc_node*)cont, mod->compiled, LYS_GETNEXT_WITHCHOICE));
+    assert_non_null(node = lys_getnext(four, (const struct lysc_node *)cont, mod->compiled, LYS_GETNEXT_WITHCHOICE));
     assert_string_equal("x", node->name);
-    assert_non_null(node = lys_getnext(node, (const struct lysc_node*)cont, mod->compiled, LYS_GETNEXT_WITHCHOICE));
+    assert_non_null(node = lys_getnext(node, (const struct lysc_node *)cont, mod->compiled, LYS_GETNEXT_WITHCHOICE));
     assert_string_equal("seven", node->name);
 
-    assert_non_null(node = lys_getnext(four, (const struct lysc_node*)cont, mod->compiled, LYS_GETNEXT_NOCHOICE));
+    assert_non_null(node = lys_getnext(four, (const struct lysc_node *)cont, mod->compiled, LYS_GETNEXT_NOCHOICE));
     assert_string_equal("seven", node->name);
 
-    assert_non_null(node = lys_getnext(four, (const struct lysc_node*)cont, mod->compiled, LYS_GETNEXT_WITHCASE));
+    assert_non_null(node = lys_getnext(four, (const struct lysc_node *)cont, mod->compiled, LYS_GETNEXT_WITHCASE));
     assert_string_equal("five", node->name);
-    assert_non_null(node = lys_getnext(node, (const struct lysc_node*)cont, mod->compiled, LYS_GETNEXT_WITHCASE));
+    assert_non_null(node = lys_getnext(node, (const struct lysc_node *)cont, mod->compiled, LYS_GETNEXT_WITHCASE));
     assert_string_equal("y", node->name);
-    assert_non_null(node = lys_getnext(node, (const struct lysc_node*)cont, mod->compiled, LYS_GETNEXT_WITHCASE));
+    assert_non_null(node = lys_getnext(node, (const struct lysc_node *)cont, mod->compiled, LYS_GETNEXT_WITHCASE));
     assert_string_equal("seven", node->name);
 
     assert_non_null(node = lys_getnext(NULL, NULL, mod->compiled, LYS_GETNEXT_INTONPCONT));
     assert_string_equal("one", node->name);
 
-    assert_non_null(node = lys_getnext(NULL, (const struct lysc_node*)rpc, mod->compiled, LYS_GETNEXT_OUTPUT));
+    assert_non_null(node = lys_getnext(NULL, (const struct lysc_node *)rpc, mod->compiled, LYS_GETNEXT_OUTPUT));
     assert_string_equal("h-output", node->name);
-    assert_null(node = lys_getnext(node, (const struct lysc_node*)rpc, mod->compiled, LYS_GETNEXT_OUTPUT));
+    assert_null(node = lys_getnext(node, (const struct lysc_node *)rpc, mod->compiled, LYS_GETNEXT_OUTPUT));
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module c {namespace urn:c;prefix c; rpc c;}", LYS_IN_YANG, &mod));
     assert_non_null(node = lys_getnext(NULL, NULL, mod->compiled, 0));
@@ -143,6 +138,7 @@
     *state = NULL;
     ly_ctx_destroy(ctx, NULL);
 }
+
 void
 test_date(void **state)
 {
@@ -187,9 +183,9 @@
     logbuf_assert("");
 
     /* revisions are stored in wrong order - the newest is the last */
-    LY_ARRAY_NEW_RET(NULL, revs, rev,);
+    LY_ARRAY_NEW_RET(NULL, revs, rev, );
     strcpy(rev->date, "2018-01-01");
-    LY_ARRAY_NEW_RET(NULL, revs, rev,);
+    LY_ARRAY_NEW_RET(NULL, revs, rev, );
     strcpy(rev->date, "2018-12-31");
 
     assert_int_equal(2, LY_ARRAY_COUNT(revs));
@@ -272,10 +268,10 @@
     logbuf_assert("Invalid name \"uint64\" of typedef - name collision with a built-in type. Line number 1.");
 
     str = "module mytypes {namespace urn:types; prefix t; typedef binary_ {type string;} typedef bits_ {type string;} typedef boolean_ {type string;} "
-          "typedef decimal64_ {type string;} typedef empty_ {type string;} typedef enumeration_ {type string;} typedef int8_ {type string;} typedef int16_ {type string;}"
-          "typedef int32_ {type string;} typedef int64_ {type string;} typedef instance-identifier_ {type string;} typedef identityref_ {type string;}"
-          "typedef leafref_ {type string;} typedef string_ {type int8;} typedef union_ {type string;} typedef uint8_ {type string;} typedef uint16_ {type string;}"
-          "typedef uint32_ {type string;} typedef uint64_ {type string;}}";
+            "typedef decimal64_ {type string;} typedef empty_ {type string;} typedef enumeration_ {type string;} typedef int8_ {type string;} typedef int16_ {type string;}"
+            "typedef int32_ {type string;} typedef int64_ {type string;} typedef instance-identifier_ {type string;} typedef identityref_ {type string;}"
+            "typedef leafref_ {type string;} typedef string_ {type int8;} typedef union_ {type string;} typedef uint8_ {type string;} typedef uint16_ {type string;}"
+            "typedef uint32_ {type string;} typedef uint64_ {type string;}}";
     assert_int_equal(lys_parse_mem(ctx, str, LYS_IN_YANG, NULL), LY_SUCCESS);
 
     str = "module a {namespace urn:a; prefix a; typedef test {type string;} typedef test {type int8;}}";
@@ -326,372 +322,372 @@
 
     /* config -> config */
     str =
-        "module a {"
-            "namespace urn:a;"
-            "prefix a;"
-            "container cont {"
-                "leaf l {"
-                    "type empty;"
-                "}"
-            "}"
-            "container cont2 {"
-                "leaf l2 {"
-                    "must ../../cont/l;"
-                    "type leafref {"
-                        "path /cont/l;"
-                    "}"
-                "}"
-            "}"
-        "}";
+            "module a {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    container cont {\n"
+            "        leaf l {\n"
+            "            type empty;\n"
+            "        }\n"
+            "    }\n"
+            "    container cont2 {\n"
+            "        leaf l2 {\n"
+            "            must ../../cont/l;\n"
+            "            type leafref {\n"
+            "                path /cont/l;\n"
+            "            }\n"
+            "        }\n"
+            "    }\n"
+            "}";
     assert_int_equal(lys_parse_mem(ctx, str, LYS_IN_YANG, NULL), LY_SUCCESS);
     logbuf_assert("");
 
     /* config -> state leafref */
     str =
-        "module b {"
-            "namespace urn:a;"
-            "prefix a;"
-            "container cont {"
-                "config false;"
-                "leaf l {"
-                    "type empty;"
-                "}"
-            "}"
-            "container cont2 {"
-                "leaf l2 {"
-                    "type leafref {"
-                        "path /cont/l;"
-                    "}"
-                "}"
-            "}"
-        "}";
+            "module b {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    container cont {\n"
+            "        config false;\n"
+            "        leaf l {\n"
+            "            type empty;\n"
+            "        }\n"
+            "    }\n"
+            "    container cont2 {\n"
+            "        leaf l2 {\n"
+            "            type leafref {\n"
+            "                path /cont/l;\n"
+            "            }\n"
+            "        }\n"
+            "    }\n"
+            "}";
     assert_int_equal(lys_parse_mem(ctx, str, LYS_IN_YANG, NULL), LY_EVALID);
     logbuf_assert("Invalid leafref path \"/cont/l\" - target is supposed to represent configuration data"
-        " (as the leafref does), but it does not. /b:cont2/l2");
+            " (as the leafref does), but it does not. /b:cont2/l2");
     logbuf_clean();
 
     /* config -> state must */
     str =
-        "module b {"
-            "namespace urn:a;"
-            "prefix a;"
-            "container cont {"
-                "config false;"
-                "leaf l {"
-                    "type empty;"
-                "}"
-            "}"
-            "container cont2 {"
-                "leaf l2 {"
-                    "must ../../cont/l;"
-                    "type empty;"
-                "}"
-            "}"
-        "}";
+            "module b {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    container cont {\n"
+            "        config false;\n"
+            "        leaf l {\n"
+            "            type empty;\n"
+            "        }\n"
+            "    }\n"
+            "    container cont2 {\n"
+            "        leaf l2 {\n"
+            "            must ../../cont/l;\n"
+            "            type empty;\n"
+            "        }\n"
+            "    }\n"
+            "}";
     assert_int_equal(lys_parse_mem(ctx, str, LYS_IN_YANG, NULL), LY_SUCCESS);
     logbuf_assert("Schema node \"l\" not found (\"../../cont/l\") with context node \"/b:cont2/l2\".");
     logbuf_clean();
 
     /* state -> config */
     str =
-        "module c {"
-            "namespace urn:a;"
-            "prefix a;"
-            "container cont {"
-                "leaf l {"
-                    "type empty;"
-                "}"
-            "}"
-            "container cont2 {"
-                "config false;"
-                "leaf l2 {"
-                    "must ../../cont/l;"
-                    "type leafref {"
-                        "path /cont/l;"
-                    "}"
-                "}"
-            "}"
-        "}";
+            "module c {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    container cont {\n"
+            "        leaf l {\n"
+            "            type empty;\n"
+            "        }\n"
+            "    }\n"
+            "    container cont2 {\n"
+            "        config false;\n"
+            "        leaf l2 {\n"
+            "            must ../../cont/l;\n"
+            "            type leafref {\n"
+            "                path /cont/l;\n"
+            "            }\n"
+            "        }\n"
+            "    }\n"
+            "}";
     assert_int_equal(lys_parse_mem(ctx, str, LYS_IN_YANG, NULL), LY_SUCCESS);
     logbuf_assert("");
 
     /* notif -> state */
     str =
-        "module d {"
-            "namespace urn:a;"
-            "prefix a;"
-            "container cont {"
-                "config false;"
-                "leaf l {"
-                    "type empty;"
-                "}"
-            "}"
-            "notification notif {"
-                "leaf l2 {"
-                    "must ../../cont/l;"
-                    "type leafref {"
-                        "path /cont/l;"
-                    "}"
-                "}"
-            "}"
-        "}";
+            "module d {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    container cont {\n"
+            "        config false;\n"
+            "        leaf l {\n"
+            "            type empty;\n"
+            "        }\n"
+            "    }\n"
+            "    notification notif {\n"
+            "        leaf l2 {\n"
+            "            must ../../cont/l;\n"
+            "            type leafref {\n"
+            "                path /cont/l;\n"
+            "            }\n"
+            "        }\n"
+            "    }\n"
+            "}";
     assert_int_equal(lys_parse_mem(ctx, str, LYS_IN_YANG, NULL), LY_SUCCESS);
     logbuf_assert("");
 
     /* notif -> notif */
     str =
-        "module e {"
-            "namespace urn:a;"
-            "prefix a;"
-            "notification notif {"
-                "leaf l {"
-                    "type empty;"
-                "}"
-                "leaf l2 {"
-                    "must ../../notif/l;"
-                    "type leafref {"
-                        "path /notif/l;"
-                    "}"
-                "}"
-            "}"
-        "}";
+            "module e {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    notification notif {\n"
+            "        leaf l {\n"
+            "            type empty;\n"
+            "        }\n"
+            "        leaf l2 {\n"
+            "            must ../../notif/l;\n"
+            "            type leafref {\n"
+            "                path /notif/l;\n"
+            "            }\n"
+            "        }\n"
+            "    }\n"
+            "}";
     assert_int_equal(lys_parse_mem(ctx, str, LYS_IN_YANG, NULL), LY_SUCCESS);
     logbuf_assert("");
 
     /* rpc input -> state */
     str =
-        "module f {"
-            "namespace urn:a;"
-            "prefix a;"
-            "container cont {"
-                "config false;"
-                "leaf l {"
-                    "type empty;"
-                "}"
-            "}"
-            "rpc rp {"
-                "input {"
-                    "leaf l2 {"
-                        "must ../../cont/l;"
-                        "type leafref {"
-                            "path /cont/l;"
-                        "}"
-                    "}"
-                "}"
-            "}"
-        "}";
+            "module f {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    container cont {\n"
+            "        config false;\n"
+            "        leaf l {\n"
+            "            type empty;\n"
+            "        }\n"
+            "    }\n"
+            "    rpc rp {\n"
+            "        input {\n"
+            "            leaf l2 {\n"
+            "                must ../../cont/l;\n"
+            "                type leafref {\n"
+            "                    path /cont/l;\n"
+            "                }\n"
+            "            }\n"
+            "        }\n"
+            "    }\n"
+            "}";
     assert_int_equal(lys_parse_mem(ctx, str, LYS_IN_YANG, NULL), LY_SUCCESS);
     logbuf_assert("");
 
     /* rpc input -> rpc input */
     str =
-        "module g {"
-            "namespace urn:a;"
-            "prefix a;"
-            "rpc rp {"
-                "input {"
-                    "leaf l {"
-                        "type empty;"
-                    "}"
-                    "leaf l2 {"
-                        "must ../l;"
-                        "type leafref {"
-                            "path /rp/l;"
-                        "}"
-                    "}"
-                "}"
-            "}"
-        "}";
+            "module g {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    rpc rp {\n"
+            "        input {\n"
+            "            leaf l {\n"
+            "                type empty;\n"
+            "            }\n"
+            "            leaf l2 {\n"
+            "                must ../l;\n"
+            "                type leafref {\n"
+            "                    path /rp/l;\n"
+            "                }\n"
+            "            }\n"
+            "        }\n"
+            "    }\n"
+            "}";
     assert_int_equal(lys_parse_mem(ctx, str, LYS_IN_YANG, NULL), LY_SUCCESS);
     logbuf_assert("");
 
     /* rpc input -> rpc output leafref */
     str =
-        "module h {"
-            "namespace urn:a;"
-            "prefix a;"
-            "rpc rp {"
-                "input {"
-                    "leaf l2 {"
-                        "type leafref {"
-                            "path /rp/l;"
-                        "}"
-                    "}"
-                "}"
-                "output {"
-                    "leaf l {"
-                        "type empty;"
-                    "}"
-                "}"
-            "}"
-        "}";
+            "module h {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    rpc rp {\n"
+            "        input {\n"
+            "            leaf l2 {\n"
+            "                type leafref {\n"
+            "                    path /rp/l;\n"
+            "                }\n"
+            "            }\n"
+            "        }\n"
+            "        output {\n"
+            "            leaf l {\n"
+            "                type empty;\n"
+            "            }\n"
+            "        }\n"
+            "    }\n"
+            "}";
     assert_int_equal(lys_parse_mem(ctx, str, LYS_IN_YANG, NULL), LY_EVALID);
     logbuf_assert("Not found node \"l\" in path. /h:rp/l2");
     logbuf_clean();
 
     /* rpc input -> rpc output must */
     str =
-        "module h {"
-            "namespace urn:a;"
-            "prefix a;"
-            "rpc rp {"
-                "input {"
-                    "leaf l2 {"
-                        "must ../l;"
-                        "type empty;"
-                    "}"
-                "}"
-                "output {"
-                    "leaf l {"
-                        "type empty;"
-                    "}"
-                "}"
-            "}"
-        "}";
+            "module h {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    rpc rp {\n"
+            "        input {\n"
+            "            leaf l2 {\n"
+            "                must ../l;\n"
+            "                type empty;\n"
+            "            }\n"
+            "        }\n"
+            "        output {\n"
+            "            leaf l {\n"
+            "                type empty;\n"
+            "            }\n"
+            "        }\n"
+            "    }\n"
+            "}";
     assert_int_equal(lys_parse_mem(ctx, str, LYS_IN_YANG, NULL), LY_SUCCESS);
     logbuf_assert("Schema node \"l\" not found (\"../l\") with context node \"/h:rp/l2\".");
     logbuf_clean();
 
     /* rpc input -> notif leafref */
     str =
-        "module i {"
-            "namespace urn:a;"
-            "prefix a;"
-            "rpc rp {"
-                "input {"
-                    "leaf l2 {"
-                        "type leafref {"
-                            "path ../../notif/l;"
-                        "}"
-                    "}"
-                "}"
-            "}"
-            "notification notif {"
-                "leaf l {"
-                    "type empty;"
-                "}"
-            "}"
-        "}";
+            "module i {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    rpc rp {\n"
+            "        input {\n"
+            "            leaf l2 {\n"
+            "                type leafref {\n"
+            "                    path ../../notif/l;\n"
+            "                }\n"
+            "            }\n"
+            "        }\n"
+            "    }\n"
+            "    notification notif {\n"
+            "        leaf l {\n"
+            "            type empty;\n"
+            "        }\n"
+            "    }\n"
+            "}";
     assert_int_equal(lys_parse_mem(ctx, str, LYS_IN_YANG, NULL), LY_EVALID);
     logbuf_assert("Not found node \"notif\" in path. /i:rp/l2");
     logbuf_clean();
 
     /* rpc input -> notif must */
     str =
-        "module i {"
-            "namespace urn:a;"
-            "prefix a;"
-            "rpc rp {"
-                "input {"
-                    "leaf l2 {"
-                        "must /notif/l;"
-                        "type empty;"
-                    "}"
-                "}"
-            "}"
-            "notification notif {"
-                "leaf l {"
-                    "type empty;"
-                "}"
-            "}"
-        "}";
+            "module i {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    rpc rp {\n"
+            "        input {\n"
+            "            leaf l2 {\n"
+            "                must /notif/l;\n"
+            "                type empty;\n"
+            "            }\n"
+            "        }\n"
+            "    }\n"
+            "    notification notif {\n"
+            "        leaf l {\n"
+            "            type empty;\n"
+            "        }\n"
+            "    }\n"
+            "}";
     assert_int_equal(lys_parse_mem(ctx, str, LYS_IN_YANG, NULL), LY_SUCCESS);
     logbuf_assert("Schema node \"l\" not found (\"/notif/l\") with context node \"/i:rp/l2\".");
     logbuf_clean();
 
     /* action output -> state */
     str =
-        "module j {"
-            "yang-version 1.1;"
-            "namespace urn:a;"
-            "prefix a;"
-            "container cont {"
-                "list ll {"
-                    "key k;"
-                    "leaf k {"
-                        "type string;"
-                    "}"
-                    "action act {"
-                        "output {"
-                            "leaf l2 {"
-                                "must /cont/l;"
-                                "type leafref {"
-                                    "path ../../../l;"
-                                "}"
-                            "}"
-                        "}"
-                    "}"
-                "}"
-                "leaf l {"
-                    "config false;"
-                    "type empty;"
-                "}"
-            "}"
-        "}";
+            "module j {\n"
+            "    yang-version 1.1;\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    container cont {\n"
+            "        list ll {\n"
+            "            key k;\n"
+            "            leaf k {\n"
+            "                type string;\n"
+            "            }\n"
+            "            action act {\n"
+            "                output {\n"
+            "                    leaf l2 {\n"
+            "                        must /cont/l;\n"
+            "                        type leafref {\n"
+            "                            path ../../../l;\n"
+            "                        }\n"
+            "                    }\n"
+            "                }\n"
+            "            }\n"
+            "        }\n"
+            "        leaf l {\n"
+            "            config false;\n"
+            "            type empty;\n"
+            "        }\n"
+            "    }\n"
+            "}";
     assert_int_equal(lys_parse_mem(ctx, str, LYS_IN_YANG, NULL), LY_SUCCESS);
     logbuf_assert("");
 
     /* action output -> action input leafref */
     str =
-        "module k {"
-            "yang-version 1.1;"
-            "namespace urn:a;"
-            "prefix a;"
-            "container cont {"
-                "list ll {"
-                    "key k;"
-                    "leaf k {"
-                        "type string;"
-                    "}"
-                    "action act {"
-                        "input {"
-                            "leaf l {"
-                                "type empty;"
-                            "}"
-                        "}"
-                        "output {"
-                            "leaf l2 {"
-                                "type leafref {"
-                                    "path ../l;"
-                                "}"
-                            "}"
-                        "}"
-                    "}"
-                "}"
-            "}"
-        "}";
+            "module k {\n"
+            "    yang-version 1.1;\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    container cont {\n"
+            "        list ll {\n"
+            "            key k;\n"
+            "            leaf k {\n"
+            "                type string;\n"
+            "            }\n"
+            "            action act {\n"
+            "                input {\n"
+            "                    leaf l {\n"
+            "                        type empty;\n"
+            "                    }\n"
+            "                }\n"
+            "                output {\n"
+            "                    leaf l2 {\n"
+            "                        type leafref {\n"
+            "                            path ../l;\n"
+            "                        }\n"
+            "                    }\n"
+            "                }\n"
+            "            }\n"
+            "        }\n"
+            "    }\n"
+            "}";
     assert_int_equal(lys_parse_mem(ctx, str, LYS_IN_YANG, NULL), LY_EVALID);
     logbuf_assert("Not found node \"l\" in path. /k:cont/ll/act/l2");
     logbuf_clean();
 
     /* action output -> action input must */
     str =
-        "module k {"
-            "yang-version 1.1;"
-            "namespace urn:a;"
-            "prefix a;"
-            "container cont {"
-                "list ll {"
-                    "key k;"
-                    "leaf k {"
-                        "type string;"
-                    "}"
-                    "action act {"
-                        "input {"
-                            "leaf l {"
-                                "type empty;"
-                            "}"
-                        "}"
-                        "output {"
-                            "leaf l2 {"
-                                "must /cont/ll/act/l;"
-                                "type empty;"
-                            "}"
-                        "}"
-                    "}"
-                "}"
-            "}"
-        "}";
+            "module k {\n"
+            "    yang-version 1.1;\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    container cont {\n"
+            "        list ll {\n"
+            "            key k;\n"
+            "            leaf k {\n"
+            "                type string;\n"
+            "            }\n"
+            "            action act {\n"
+            "                input {\n"
+            "                    leaf l {\n"
+            "                        type empty;\n"
+            "                    }\n"
+            "                }\n"
+            "                output {\n"
+            "                    leaf l2 {\n"
+            "                        must /cont/ll/act/l;\n"
+            "                        type empty;\n"
+            "                    }\n"
+            "                }\n"
+            "            }\n"
+            "        }\n"
+            "    }\n"
+            "}";
     assert_int_equal(lys_parse_mem(ctx, str, LYS_IN_YANG, NULL), LY_SUCCESS);
     logbuf_assert("Schema node \"l\" not found (\"/cont/ll/act/l\") with context node \"/k:cont/ll/act/l2\".");
     logbuf_clean();
diff --git a/tests/utests/schema/test_schema_stmts.c b/tests/utests/schema/test_schema_stmts.c
index 55400b4..24417c4 100644
--- a/tests/utests/schema/test_schema_stmts.c
+++ b/tests/utests/schema/test_schema_stmts.c
@@ -12,18 +12,13 @@
  *     https://opensource.org/licenses/BSD-3-Clause
  */
 
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
 #include <string.h>
 
-#include "log.h"
 #include "context.h"
+#include "log.h"
 #include "test_schema.h"
 #include "tree_schema.h"
+#include "utests.h"
 
 #include "test_schema.h"
 
@@ -46,8 +41,8 @@
 
     /* full content */
     TEST_SCHEMA_OK(ctx, 1, 0, "identityone",
-                   "identity test {base \"a\";base b; description text;reference \'another text\';status current; if-feature x;if-feature y; identityone:ext;}"
-                   "identity a; identity b; extension ext; feature x; feature y;", mod);
+            "identity test {base \"a\";base b; description text;reference \'another text\';status current; if-feature x;if-feature y; identityone:ext;}"
+            "identity a; identity b; extension ext; feature x; feature y;", mod);
     assert_non_null(mod->parsed->identities);
     assert_int_equal(3, LY_ARRAY_COUNT(mod->parsed->identities));
 
@@ -59,13 +54,13 @@
      */
     /* max subelems */
     TEST_SCHEMA_OK(ctx, 1, 1, "identityone-yin", "<identity name=\"ident-name\">"
-                       "<if-feature name=\"iff\"/>"
-                       "<base name=\"base-name\"/>"
-                       "<status value=\"deprecated\"/>"
-                       "<description><text>desc</text></description>"
-                       "<reference><text>ref</text></reference>"
-                       /* TODO yin-extension-prefix-compilation-bug "<myext:ext xmlns:myext=\"urn:libyang:test:identityone-yin\"/>" */
-                   "</identity><extension name=\"ext\"/><identity name=\"base-name\"/><feature name=\"iff\"/>", mod);
+            "<if-feature name=\"iff\"/>"
+            "<base name=\"base-name\"/>"
+            "<status value=\"deprecated\"/>"
+            "<description><text>desc</text></description>"
+            "<reference><text>ref</text></reference>"
+            /* TODO yin-extension-prefix-compilation-bug "<myext:ext xmlns:myext=\"urn:libyang:test:identityone-yin\"/>" */
+            "</identity><extension name=\"ext\"/><identity name=\"base-name\"/><feature name=\"iff\"/>", mod);
     assert_int_equal(2, LY_ARRAY_COUNT(mod->parsed->identities));
     assert_string_equal(mod->parsed->identities[0].name, "ident-name");
     assert_string_equal(mod->parsed->identities[0].bases[0], "base-name");
@@ -86,15 +81,15 @@
 
     /* invalid substatement */
     TEST_SCHEMA_ERR(ctx, 0, 1, "inv", "<identity name=\"ident-name\"><if-feature name=\"iff\"/></identity>",
-                    "Invalid sub-elemnt \"if-feature\" of \"identity\" element - this sub-element is allowed only in modules with version 1.1 or newer. Line number 1.");
+            "Invalid sub-elemnt \"if-feature\" of \"identity\" element - this sub-element is allowed only in modules with version 1.1 or newer. Line number 1.");
 
     /*
      * compiling
      */
     TEST_SCHEMA_OK(ctx, 0, 0, "a", "identity a1;", mod_imp);
     TEST_SCHEMA_OK(ctx, 1, 0, "b", "import a {prefix a;}"
-                   "identity b1; identity b2; identity b3 {base b1; base b:b2; base a:a1;}"
-                   "identity b4 {base b:b1; base b3;}", mod);
+            "identity b1; identity b2; identity b3 {base b1; base b:b2; base a:a1;}"
+            "identity b4 {base b:b1; base b3;}", mod);
     assert_non_null(mod_imp->compiled);
     assert_non_null(mod_imp->identities);
     assert_non_null(mod->identities);
@@ -120,26 +115,26 @@
 
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "submodule inv_sub {belongs-to inv {prefix inv;} identity i1;}");
     TEST_SCHEMA_ERR(ctx, 0, 0, "inv", "include inv_sub;identity i1;",
-                    "Duplicate identifier \"i1\" of identity statement. Line number 1.");
-    TEST_SCHEMA_ERR(ctx, 0, 0,"inv", "identity i1 {base i2;}", "Unable to find base (i2) of identity \"i1\". /inv:{identity='i1'}");
-    TEST_SCHEMA_ERR(ctx, 0, 0,"inv", "identity i1 {base i1;}", "Identity \"i1\" is derived from itself. /inv:{identity='i1'}");
-    TEST_SCHEMA_ERR(ctx, 0, 0,"inv", "identity i1 {base i2;}identity i2 {base i3;}identity i3 {base i1;}",
-                    "Identity \"i1\" is indirectly derived from itself. /inv:{identity='i3'}");
+            "Duplicate identifier \"i1\" of identity statement. Line number 1.");
+    TEST_SCHEMA_ERR(ctx, 0, 0, "inv", "identity i1 {base i2;}", "Unable to find base (i2) of identity \"i1\". /inv:{identity='i1'}");
+    TEST_SCHEMA_ERR(ctx, 0, 0, "inv", "identity i1 {base i1;}", "Identity \"i1\" is derived from itself. /inv:{identity='i1'}");
+    TEST_SCHEMA_ERR(ctx, 0, 0, "inv", "identity i1 {base i2;}identity i2 {base i3;}identity i3 {base i1;}",
+            "Identity \"i1\" is indirectly derived from itself. /inv:{identity='i3'}");
 
     /* base in non-implemented module */
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb,
-                              "module base {namespace \"urn\"; prefix b; identity i1; identity i2 {base i1;}}");
+            "module base {namespace \"urn\"; prefix b; identity i1; identity i2 {base i1;}}");
     TEST_SCHEMA_OK(ctx, 0, 0, "ident", "import base {prefix b;} identity ii {base b:i1;}", mod);
 
     /* default value from non-implemented module */
     TEST_SCHEMA_ERR(ctx, 0, 0, "ident2", "import base {prefix b;} leaf l {type identityref {base b:i1;} default b:i2;}",
-                    "Invalid default - value does not fit the type (Invalid identityref \"b:i2\" value"
-                    " - identity found in non-implemented module \"base\".). /ident2:l");
+            "Invalid default - value does not fit the type (Invalid identityref \"b:i2\" value"
+            " - identity found in non-implemented module \"base\".). /ident2:l");
 
     /* default value in typedef from non-implemented module */
     TEST_SCHEMA_ERR(ctx, 0, 0, "ident2", "import base {prefix b;} typedef t1 {type identityref {base b:i1;} default b:i2;}"
-                    "leaf l {type t1;}", "Invalid default - value does not fit the type (Invalid"
-                    " identityref \"b:i2\" value - identity found in non-implemented module \"base\".). /ident2:l");
+            "leaf l {type t1;}", "Invalid default - value does not fit the type (Invalid"
+            " identityref \"b:i2\" value - identity found in non-implemented module \"base\".). /ident2:l");
 
     /*
      * printing
@@ -174,8 +169,8 @@
 
     /* full content */
     TEST_SCHEMA_OK(ctx, 1, 0, "featureone",
-                   "feature test {description text;reference \'another text\';status current; if-feature x; if-feature y; featureone:ext;}"
-                   "extension ext; feature x; feature y;", mod);
+            "feature test {description text;reference \'another text\';status current; if-feature x; if-feature y; featureone:ext;}"
+            "extension ext; feature x; feature y;", mod);
     assert_non_null(mod->parsed->features);
     assert_int_equal(3, LY_ARRAY_COUNT(mod->parsed->features));
 
@@ -187,12 +182,12 @@
      */
     /* max subelems */
     TEST_SCHEMA_OK(ctx, 0, 1, "featureone-yin", "<feature name=\"feature-name\">"
-                       "<if-feature name=\"iff\"/>"
-                       "<status value=\"deprecated\"/>"
-                       "<description><text>desc</text></description>"
-                       "<reference><text>ref</text></reference>"
-                       /* TODO yin-extension-prefix-compilation-bug "<myext:ext xmlns:myext=\"urn:libyang:test:featureone-yin\"/>" */
-                   "</feature><extension name=\"ext\"/><feature name=\"iff\"/>", mod);
+            "<if-feature name=\"iff\"/>"
+            "<status value=\"deprecated\"/>"
+            "<description><text>desc</text></description>"
+            "<reference><text>ref</text></reference>"
+            /* TODO yin-extension-prefix-compilation-bug "<myext:ext xmlns:myext=\"urn:libyang:test:featureone-yin\"/>" */
+            "</feature><extension name=\"ext\"/><feature name=\"iff\"/>", mod);
     assert_int_equal(2, LY_ARRAY_COUNT(mod->parsed->features));
     assert_string_equal(mod->parsed->features[0].name, "feature-name");
     assert_string_equal(mod->parsed->features[0].dsc, "desc");
@@ -210,19 +205,19 @@
 
     /* invalid substatement */
     TEST_SCHEMA_ERR(ctx, 0, 1, "inv", "<feature name=\"feature-name\"><organization><text>org</text></organization></feature>",
-                    "Unexpected sub-element \"organization\" of \"feature\" element. Line number 1.");
+            "Unexpected sub-element \"organization\" of \"feature\" element. Line number 1.");
 
     /*
      * compiling
      */
 
     TEST_SCHEMA_OK(ctx, 1, 0, "a", "feature f1 {description test1;reference test2;status current;} feature f2; feature f3;\n"
-                   "feature orfeature {if-feature \"f1 or f2\";}\n"
-                   "feature andfeature {if-feature \"f1 and f2\";}\n"
-                   "feature f6 {if-feature \"not f1\";}\n"
-                   "feature f7 {if-feature \"(f2 and f3) or (not f1)\";}\n"
-                   "feature f8 {if-feature \"f1 or f2 or f3 or orfeature or andfeature\";}\n"
-                   "feature f9 {if-feature \"not not f1\";}", mod);
+            "feature orfeature {if-feature \"f1 or f2\";}\n"
+            "feature andfeature {if-feature \"f1 and f2\";}\n"
+            "feature f6 {if-feature \"not f1\";}\n"
+            "feature f7 {if-feature \"(f2 and f3) or (not f1)\";}\n"
+            "feature f8 {if-feature \"f1 or f2 or f3 or orfeature or andfeature\";}\n"
+            "feature f9 {if-feature \"not not f1\";}", mod);
     assert_non_null(mod->parsed->features);
     assert_int_equal(9, LY_ARRAY_COUNT(mod->parsed->features));
 
@@ -233,41 +228,41 @@
 
     /* some invalid expressions */
     TEST_SCHEMA_ERR(ctx, 1, 0, "inv", "feature f{if-feature f1;}",
-                    "Invalid value \"f1\" of if-feature - unable to find feature \"f1\".");
+            "Invalid value \"f1\" of if-feature - unable to find feature \"f1\".");
     TEST_SCHEMA_ERR(ctx, 1, 0, "inv", "feature f1; feature f2{if-feature 'f and';}",
-                    "Invalid value \"f and\" of if-feature - unexpected end of expression.");
+            "Invalid value \"f and\" of if-feature - unexpected end of expression.");
     TEST_SCHEMA_ERR(ctx, 1, 0, "inv", "feature f{if-feature 'or';}",
-                    "Invalid value \"or\" of if-feature - unexpected end of expression.");
+            "Invalid value \"or\" of if-feature - unexpected end of expression.");
     TEST_SCHEMA_ERR(ctx, 1, 0, "inv", "feature f1; feature f2{if-feature '(f1';}",
-                    "Invalid value \"(f1\" of if-feature - non-matching opening and closing parentheses.");
+            "Invalid value \"(f1\" of if-feature - non-matching opening and closing parentheses.");
     TEST_SCHEMA_ERR(ctx, 1, 0, "inv", "feature f1; feature f2{if-feature 'f1)';}",
-                    "Invalid value \"f1)\" of if-feature - non-matching opening and closing parentheses.");
+            "Invalid value \"f1)\" of if-feature - non-matching opening and closing parentheses.");
     TEST_SCHEMA_ERR(ctx, 1, 0, "inv", "feature f1; feature f2{if-feature ---;}",
-                    "Invalid value \"---\" of if-feature - unable to find feature \"---\".");
+            "Invalid value \"---\" of if-feature - unable to find feature \"---\".");
     TEST_SCHEMA_ERR(ctx, 0, 0, "inv", "feature f1; feature f2{if-feature 'not f1';}",
-                    "Invalid value \"not f1\" of if-feature - YANG 1.1 expression in YANG 1.0 module.");
+            "Invalid value \"not f1\" of if-feature - YANG 1.1 expression in YANG 1.0 module.");
     TEST_SCHEMA_ERR(ctx, 0, 0, "inv", "feature f1; feature f1;",
-                    "Duplicate identifier \"f1\" of feature statement. Line number 1.");
+            "Duplicate identifier \"f1\" of feature statement. Line number 1.");
 
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "submodule inv_sub {belongs-to inv {prefix inv;} feature f1;}");
     TEST_SCHEMA_ERR(ctx, 0, 0, "inv", "include inv_sub;feature f1;",
-                    "Duplicate identifier \"f1\" of feature statement. Line number 1.");
+            "Duplicate identifier \"f1\" of feature statement. Line number 1.");
     TEST_SCHEMA_ERR(ctx, 0, 0, "inv", "feature f1 {if-feature f2;} feature f2 {if-feature f1;}",
-                    "Feature \"f1\" is indirectly referenced from itself.");
+            "Feature \"f1\" is indirectly referenced from itself.");
     TEST_SCHEMA_ERR(ctx, 0, 0, "inv", "feature f1 {if-feature f1;}",
-                    "Feature \"f1\" is referenced from itself.");
+            "Feature \"f1\" is referenced from itself.");
     TEST_SCHEMA_ERR(ctx, 1, 0, "inv", "feature f {if-feature ();}",
-                    "Invalid value \"()\" of if-feature - number of features in expression does not match the required number of operands for the operations.");
+            "Invalid value \"()\" of if-feature - number of features in expression does not match the required number of operands for the operations.");
     TEST_SCHEMA_ERR(ctx, 1, 0, "inv", "feature f1; feature f {if-feature 'f1(';}",
-                    "Invalid value \"f1(\" of if-feature - non-matching opening and closing parentheses.");
+            "Invalid value \"f1(\" of if-feature - non-matching opening and closing parentheses.");
     TEST_SCHEMA_ERR(ctx, 1, 0, "inv", "feature f1; feature f {if-feature 'and f1';}",
-                    "Invalid value \"and f1\" of if-feature - missing feature/expression before \"and\" operation.");
+            "Invalid value \"and f1\" of if-feature - missing feature/expression before \"and\" operation.");
     TEST_SCHEMA_ERR(ctx, 1, 0, "inv", "feature f1; feature f {if-feature 'f1 not ';}",
-                    "Invalid value \"f1 not \" of if-feature - unexpected end of expression.");
+            "Invalid value \"f1 not \" of if-feature - unexpected end of expression.");
     TEST_SCHEMA_ERR(ctx, 1, 0, "inv", "feature f1; feature f {if-feature 'f1 not not ';}",
-                    "Invalid value \"f1 not not \" of if-feature - unexpected end of expression.");
+            "Invalid value \"f1 not not \" of if-feature - unexpected end of expression.");
     TEST_SCHEMA_ERR(ctx, 1, 0, "inv", "feature f1; feature f2; feature f {if-feature 'or f1 f2';}",
-                    "Invalid value \"or f1 f2\" of if-feature - missing feature/expression before \"or\" operation.");
+            "Invalid value \"or f1 f2\" of if-feature - missing feature/expression before \"or\" operation.");
 
     /*
      * printing
diff --git a/tests/utests/schema/test_tree_schema_compile.c b/tests/utests/schema/test_tree_schema_compile.c
index 82e5151..7f0e4da 100644
--- a/tests/utests/schema/test_tree_schema_compile.c
+++ b/tests/utests/schema/test_tree_schema_compile.c
@@ -12,20 +12,13 @@
  *     https://opensource.org/licenses/BSD-3-Clause
  */
 
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
-#include <stdio.h>
-#include <string.h>
-
 #include "common.h"
 #include "in.h"
 #include "parser_internal.h"
 #include "path.h"
 #include "plugins_types.h"
 #include "schema_compile.h"
+#include "utests.h"
 #include "xpath.h"
 
 void yang_parser_ctx_free(struct lys_yang_parser_ctx *ctx);
@@ -48,6 +41,7 @@
         strncpy(logbuf, msg, BUFSIZE - 1);
     }
 }
+
 #endif
 
 static int
@@ -84,9 +78,10 @@
 #   define logbuf_assert(str)
 #endif
 
-static LY_ERR test_imp_clb(const char *UNUSED(mod_name), const char *UNUSED(mod_rev), const char *UNUSED(submod_name),
-                           const char *UNUSED(sub_rev), void *user_data, LYS_INFORMAT *format,
-                           const char **module_data, void (**free_module_data)(void *model_data, void *user_data))
+static LY_ERR
+test_imp_clb(const char *UNUSED(mod_name), const char *UNUSED(mod_rev), const char *UNUSED(submod_name),
+        const char *UNUSED(sub_rev), void *user_data, LYS_INFORMAT *format,
+        const char **module_data, void (**free_module_data)(void *model_data, void *user_data))
 {
     *module_data = user_data;
     *format = LYS_IN_YANG;
@@ -108,7 +103,7 @@
     struct lys_glob_unres unres = {0};
 
     str = "module test {namespace urn:test; prefix t;"
-          "feature f1;feature f2 {if-feature f1;}}";
+            "feature f1;feature f2 {if-feature f1;}}";
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, 0, &ctx));
 
     assert_int_equal(LY_EINVAL, lys_compile(NULL, 0, NULL));
@@ -175,42 +170,42 @@
 
     /* top-level */
     yang_data = "module a {namespace urn:a;prefix a;"
-            "container c;"
-            "leaf a {type empty;}"
-            "leaf c {type empty;}"
-        "}";
+            "  container c;"
+            "  leaf a {type empty;}"
+            "  leaf c {type empty;}"
+            "}";
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, yang_data, LYS_IN_YANG, NULL));
     logbuf_assert("Duplicate identifier \"c\" of data definition/RPC/action/notification statement. /a:c");
     logbuf_clean();
 
     yang_data = "module a {namespace urn:a;prefix a;"
-            "container c;"
-            "leaf a {type empty;}"
-            "notification c;"
-        "}";
+            "  container c;"
+            "  leaf a {type empty;}"
+            "  notification c;"
+            "}";
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, yang_data, LYS_IN_YANG, NULL));
     logbuf_assert("Duplicate identifier \"c\" of data definition/RPC/action/notification statement. /a:c");
     logbuf_clean();
 
     yang_data = "module a {namespace urn:a;prefix a;"
-            "container c;"
-            "leaf a {type empty;}"
-            "rpc c;"
-        "}";
+            "  container c;"
+            "  leaf a {type empty;}"
+            "  rpc c;"
+            "}";
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, yang_data, LYS_IN_YANG, NULL));
     logbuf_assert("Duplicate identifier \"c\" of data definition/RPC/action/notification statement. /a:c");
     logbuf_clean();
 
     yang_data = "module a {namespace urn:a;prefix a;"
-            "container c;"
-            "leaf a {type empty;}"
-            "choice ch {"
-                "leaf c {type string;}"
-                "case c2 {"
-                    "leaf aa {type empty;}"
-                "}"
-            "}"
-        "}";
+            "  container c;"
+            "  leaf a {type empty;}"
+            "  choice ch {"
+            "    leaf c {type string;}"
+            "    case c2 {"
+            "      leaf aa {type empty;}"
+            "    }"
+            "  }"
+            "}";
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, yang_data, LYS_IN_YANG, NULL));
     logbuf_assert("Duplicate identifier \"c\" of data definition/RPC/action/notification statement. /a:ch/c/c");
     logbuf_clean();
@@ -219,7 +214,7 @@
     yang_data = "module a {namespace urn:a;prefix a;container c { list l {key \"k\"; leaf k {type string;}"
             "leaf-list a {type string;}"
             "container a;"
-        "}}}";
+            "}}}";
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, yang_data, LYS_IN_YANG, NULL));
     logbuf_assert("Duplicate identifier \"a\" of data definition/RPC/action/notification statement. /a:c/l/a");
     logbuf_clean();
@@ -227,7 +222,7 @@
     yang_data = "module a {yang-version 1.1;namespace urn:a;prefix a;container c { list l {key \"k\"; leaf k {type string;}"
             "leaf-list a {type string;}"
             "notification a;"
-        "}}}";
+            "}}}";
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, yang_data, LYS_IN_YANG, NULL));
     logbuf_assert("Duplicate identifier \"a\" of data definition/RPC/action/notification statement. /a:c/l/a");
     logbuf_clean();
@@ -235,7 +230,7 @@
     yang_data = "module a {yang-version 1.1;namespace urn:a;prefix a;container c { list l {key \"k\"; leaf k {type string;}"
             "leaf-list a {type string;}"
             "action a;"
-        "}}}";
+            "}}}";
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, yang_data, LYS_IN_YANG, NULL));
     logbuf_assert("Duplicate identifier \"a\" of data definition/RPC/action/notification statement. /a:c/l/a");
     logbuf_clean();
@@ -257,7 +252,7 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {namespace urn:a;prefix a;container c;}", LYS_IN_YANG, &mod));
     assert_non_null(mod->compiled);
-    assert_non_null((cont = (struct lysc_node_container*)mod->compiled->data));
+    assert_non_null((cont = (struct lysc_node_container *)mod->compiled->data));
     assert_int_equal(LYS_CONTAINER, cont->nodetype);
     assert_string_equal("c", cont->name);
     assert_true(cont->flags & LYS_CONFIG_W);
@@ -266,10 +261,10 @@
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {namespace urn:b;prefix b;container c {config false; status deprecated; container child;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Missing explicit \"deprecated\" status that was already specified in parent, inheriting.");
     assert_non_null(mod->compiled);
-    assert_non_null((cont = (struct lysc_node_container*)mod->compiled->data));
+    assert_non_null((cont = (struct lysc_node_container *)mod->compiled->data));
     assert_true(cont->flags & LYS_CONFIG_R);
     assert_true(cont->flags & LYS_STATUS_DEPRC);
-    assert_non_null((cont = (struct lysc_node_container*)cont->child));
+    assert_non_null((cont = (struct lysc_node_container *)cont->child));
     assert_int_equal(LYS_CONTAINER, cont->nodetype);
     assert_true(cont->flags & LYS_CONFIG_R);
     assert_true(cont->flags & LYS_STATUS_DEPRC);
@@ -294,40 +289,40 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {namespace urn:a;prefix a;"
-                                        "typedef mytype {type union {type leafref {path ../target;} type string;}}"
-                                        "leaf-list ll1 {type union {type decimal64 {fraction-digits 2;} type mytype;}}"
-                                        "leaf-list ll2 {type leafref {path ../target;}}"
-                                        "leaf target {type int8;}}",
-                                        LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "typedef mytype {type union {type leafref {path ../target;} type string;}}"
+            "leaf-list ll1 {type union {type decimal64 {fraction-digits 2;} type mytype;}}"
+            "leaf-list ll2 {type leafref {path ../target;}}"
+            "leaf target {type int8;}}",
+            LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_UNION, type->basetype);
-    assert_non_null(((struct lysc_type_union*)type)->types);
-    assert_int_equal(3, LY_ARRAY_COUNT(((struct lysc_type_union*)type)->types));
-    assert_int_equal(LY_TYPE_DEC64, ((struct lysc_type_union*)type)->types[0]->basetype);
-    assert_int_equal(LY_TYPE_LEAFREF, ((struct lysc_type_union*)type)->types[1]->basetype);
-    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_union*)type)->types[2]->basetype);
-    assert_non_null(((struct lysc_type_leafref*)((struct lysc_type_union*)type)->types[1])->realtype);
-    assert_int_equal(LY_TYPE_INT8, ((struct lysc_type_leafref*)((struct lysc_type_union*)type)->types[1])->realtype->basetype);
-    type = ((struct lysc_node_leaf*)mod->compiled->data->next)->type;
+    assert_non_null(((struct lysc_type_union *)type)->types);
+    assert_int_equal(3, LY_ARRAY_COUNT(((struct lysc_type_union *)type)->types));
+    assert_int_equal(LY_TYPE_DEC64, ((struct lysc_type_union *)type)->types[0]->basetype);
+    assert_int_equal(LY_TYPE_LEAFREF, ((struct lysc_type_union *)type)->types[1]->basetype);
+    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_union *)type)->types[2]->basetype);
+    assert_non_null(((struct lysc_type_leafref *)((struct lysc_type_union *)type)->types[1])->realtype);
+    assert_int_equal(LY_TYPE_INT8, ((struct lysc_type_leafref *)((struct lysc_type_union *)type)->types[1])->realtype->basetype);
+    type = ((struct lysc_node_leaf *)mod->compiled->data->next)->type;
     assert_non_null(type);
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
-    assert_non_null(((struct lysc_type_leafref*)type)->realtype);
-    assert_int_equal(LY_TYPE_INT8, ((struct lysc_type_leafref*)type)->realtype->basetype);
+    assert_non_null(((struct lysc_type_leafref *)type)->realtype);
+    assert_int_equal(LY_TYPE_INT8, ((struct lysc_type_leafref *)type)->realtype->basetype);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {namespace urn:b;prefix b;leaf-list ll {type string;}}", LYS_IN_YANG, &mod));
     assert_non_null(mod->compiled);
-    assert_non_null((ll = (struct lysc_node_leaflist*)mod->compiled->data));
+    assert_non_null((ll = (struct lysc_node_leaflist *)mod->compiled->data));
     assert_int_equal(0, ll->min);
     assert_int_equal((uint32_t)-1, ll->max);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module c {yang-version 1.1;namespace urn:c;prefix c;typedef mytype {type int8;default 10;}"
-                                        "leaf-list ll1 {type mytype;default 1; default 1; config false;}"
-                                        "leaf-list ll2 {type mytype; ordered-by user;}}", LYS_IN_YANG, &mod));
+            "leaf-list ll1 {type mytype;default 1; default 1; config false;}"
+            "leaf-list ll2 {type mytype; ordered-by user;}}", LYS_IN_YANG, &mod));
     assert_non_null(mod->compiled);
-    assert_non_null((ll = (struct lysc_node_leaflist*)mod->compiled->data));
+    assert_non_null((ll = (struct lysc_node_leaflist *)mod->compiled->data));
     assert_non_null(ll->dflts);
     assert_int_equal(6, ll->type->refcount); /* 3x type's reference, 3x default value's reference (typedef's default does not reference own type) */
     assert_int_equal(2, LY_ARRAY_COUNT(ll->dflts));
@@ -336,7 +331,7 @@
     assert_string_equal("1", dflt = ll->dflts[1]->realtype->plugin->print(ll->dflts[1], LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
     assert_int_equal(LYS_CONFIG_R | LYS_STATUS_CURR | LYS_ORDBY_SYSTEM | LYS_SET_DFLT | LYS_SET_CONFIG, ll->flags);
-    assert_non_null((ll = (struct lysc_node_leaflist*)mod->compiled->data->next));
+    assert_non_null((ll = (struct lysc_node_leaflist *)mod->compiled->data->next));
     assert_non_null(ll->dflts);
     assert_int_equal(6, ll->type->refcount); /* 3x type's reference, 3x default value's reference */
     assert_int_equal(1, LY_ARRAY_COUNT(ll->dflts));
@@ -346,53 +341,53 @@
 
     /* ordered-by is ignored for state data, RPC/action output parameters and notification content */
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module d {yang-version 1.1;namespace urn:d;prefix d;"
-                                        "leaf-list ll {config false; type string; ordered-by user;}}", LYS_IN_YANG, &mod));
+            "leaf-list ll {config false; type string; ordered-by user;}}", LYS_IN_YANG, &mod));
     /* but warning is present: */
     logbuf_assert("The ordered-by statement is ignored in lists representing state data (/d:ll).");
     assert_non_null(mod->compiled);
-    assert_non_null((ll = (struct lysc_node_leaflist*)mod->compiled->data));
+    assert_non_null((ll = (struct lysc_node_leaflist *)mod->compiled->data));
     assert_int_equal(LYS_CONFIG_R | LYS_STATUS_CURR | LYS_ORDBY_SYSTEM | LYS_SET_CONFIG, ll->flags);
     logbuf_clean();
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module e {yang-version 1.1;namespace urn:e;prefix e;"
-                                    "rpc oper {output {leaf-list ll {type string; ordered-by user;}}}}", LYS_IN_YANG, &mod));
+            "rpc oper {output {leaf-list ll {type string; ordered-by user;}}}}", LYS_IN_YANG, &mod));
     logbuf_assert("The ordered-by statement is ignored in lists representing RPC/action output parameters (/e:oper/output/ll).");
     logbuf_clean();
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module f {yang-version 1.1;namespace urn:f;prefix f;"
-                                    "notification event {leaf-list ll {type string; ordered-by user;}}}", LYS_IN_YANG, &mod));
+            "notification event {leaf-list ll {type string; ordered-by user;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("The ordered-by statement is ignored in lists representing notification content (/f:event/ll).");
 
     /* forward reference in default */
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module g {yang-version 1.1; namespace urn:g;prefix g;"
-                                    "leaf ref {type instance-identifier {require-instance true;} default \"/g:g[.='val']\";}"
-                                        "leaf-list g {type string;}}", LYS_IN_YANG, &mod));
-    assert_non_null(l = (struct lysc_node_leaf*)mod->compiled->data);
+            "leaf ref {type instance-identifier {require-instance true;} default \"/g:g[.='val']\";}"
+            "leaf-list g {type string;}}", LYS_IN_YANG, &mod));
+    assert_non_null(l = (struct lysc_node_leaf *)mod->compiled->data);
     assert_string_equal("ref", l->name);
     assert_non_null(l->dflt);
 
     /* invalid */
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa;leaf-list ll {type empty;}}",
-                                              LYS_IN_YANG, NULL));
+            LYS_IN_YANG, NULL));
     logbuf_assert("Leaf-list of type \"empty\" is allowed only in YANG 1.1 modules. /aa:ll");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module bb {yang-version 1.1;namespace urn:bb;prefix bb;leaf-list ll {type empty; default x;}}", LYS_IN_YANG, NULL));
     logbuf_assert("Invalid default - value does not fit the type (Invalid empty value \"x\".). /bb:ll");
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module cc {yang-version 1.1;namespace urn:cc;prefix cc;"
-                    "leaf-list ll {config false;type string; default one;default two;default one;}}", LYS_IN_YANG, &mod));
+            "leaf-list ll {config false;type string; default one;default two;default one;}}", LYS_IN_YANG, &mod));
     assert_non_null(mod->compiled);
-    assert_non_null((ll = (struct lysc_node_leaflist*)mod->compiled->data));
+    assert_non_null((ll = (struct lysc_node_leaflist *)mod->compiled->data));
     assert_non_null(ll->dflts);
     assert_int_equal(3, LY_ARRAY_COUNT(ll->dflts));
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module dd {yang-version 1.1;namespace urn:dd;prefix dd;"
-                              "leaf-list ll {type string; default one;default two;default one;}}", LYS_IN_YANG, NULL));
+            "leaf-list ll {type string; default one;default two;default one;}}", LYS_IN_YANG, NULL));
     logbuf_assert("Configuration leaf-list has multiple defaults of the same value \"one\". /dd:ll");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ee {yang-version 1.1; namespace urn:ee;prefix ee;"
-                    "leaf ref {type instance-identifier {require-instance true;} default \"/ee:g\";}}", LYS_IN_YANG, NULL));
+            "leaf ref {type instance-identifier {require-instance true;} default \"/ee:g\";}}", LYS_IN_YANG, NULL));
     logbuf_assert("Invalid default - value does not fit the type "
-                  "(Invalid instance-identifier \"/ee:g\" value - semantic error.). /ee:ref");
+            "(Invalid instance-identifier \"/ee:g\" value - semantic error.). /ee:ref");
 
     *state = NULL;
     ly_ctx_destroy(ctx, NULL);
@@ -409,7 +404,7 @@
     struct lysc_node *child;
     struct ly_in *in;
     const char *data =
-        "module a {namespace urn:a;prefix a;feature f;"
+            "module a {namespace urn:a;prefix a;feature f;"
             "list l1 {key \"x y\"; ordered-by user; leaf y{type string;if-feature f;} leaf x {type string; when 1;}}"
             "list l2 {config false;leaf value {type string;}}}";
     const char *feats[] = {"f", NULL};
@@ -419,7 +414,7 @@
     assert_int_equal(LY_SUCCESS, ly_in_new_memory(data, &in));
     assert_int_equal(LY_SUCCESS, lys_parse(ctx, in, LYS_IN_YANG, feats, &mod));
     ly_in_free(in, 0);
-    list = (struct lysc_node_list*)mod->compiled->data;
+    list = (struct lysc_node_list *)mod->compiled->data;
     assert_non_null(list);
     assert_non_null(list->child);
     assert_string_equal("x", list->child->name);
@@ -430,23 +425,23 @@
     assert_int_equal(LYS_CONFIG_W | LYS_STATUS_CURR | LYS_ORDBY_USER, list->flags);
     assert_true(list->child->flags & LYS_KEY);
     assert_true(list->child->next->flags & LYS_KEY);
-    list = (struct lysc_node_list*)mod->compiled->data->next;
+    list = (struct lysc_node_list *)mod->compiled->data->next;
     assert_non_null(list);
     assert_non_null(list->child);
     assert_false(list->child->flags & LYS_KEY);
     assert_int_equal(LYS_CONFIG_R | LYS_STATUS_CURR | LYS_ORDBY_SYSTEM | LYS_SET_CONFIG | LYS_KEYLESS, list->flags);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {namespace urn:b;prefix b;"
-                                        "list l {key a; unique \"a c/b:b\"; unique \"c/e d\";"
-                                        "leaf a {type string; default x;} leaf d {type string;config false;}"
-                                        "container c {leaf b {type string;}leaf e{type string;config false;}}}}",
-                                        LYS_IN_YANG, &mod));
-    list = (struct lysc_node_list*)mod->compiled->data;
+            "list l {key a; unique \"a c/b:b\"; unique \"c/e d\";"
+            "leaf a {type string; default x;} leaf d {type string;config false;}"
+            "container c {leaf b {type string;}leaf e{type string;config false;}}}}",
+            LYS_IN_YANG, &mod));
+    list = (struct lysc_node_list *)mod->compiled->data;
     assert_non_null(list);
     assert_string_equal("l", list->name);
     assert_string_equal("a", list->child->name);
     assert_true(list->child->flags & LYS_KEY);
-    assert_null(((struct lysc_node_leaf*)list->child)->dflt);
+    assert_null(((struct lysc_node_leaf *)list->child)->dflt);
     assert_non_null(list->uniques);
     assert_int_equal(2, LY_ARRAY_COUNT(list->uniques));
     assert_int_equal(2, LY_ARRAY_COUNT(list->uniques[0]));
@@ -461,18 +456,18 @@
     assert_true(list->uniques[1][1]->flags & LYS_UNIQUE);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module c {yang-version 1.1;namespace urn:c;prefix c;"
-                                        "list l {key a;leaf a {type empty;}}}", LYS_IN_YANG, &mod));
-    list = (struct lysc_node_list*)mod->compiled->data;
+            "list l {key a;leaf a {type empty;}}}", LYS_IN_YANG, &mod));
+    list = (struct lysc_node_list *)mod->compiled->data;
     assert_non_null(list);
     assert_string_equal("l", list->name);
     assert_string_equal("a", list->child->name);
     assert_true(list->child->flags & LYS_KEY);
-    assert_int_equal(LY_TYPE_EMPTY, ((struct lysc_node_leaf*)list->child)->type->basetype);
+    assert_int_equal(LY_TYPE_EMPTY, ((struct lysc_node_leaf *)list->child)->type->basetype);
 
     /* keys order */
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module d {yang-version 1.1;namespace urn:d;prefix d;"
-                                        "list l {key \"d b c\";leaf a {type string;} leaf b {type string;} leaf c {type string;} leaf d {type string;}}}", LYS_IN_YANG, &mod));
-    list = (struct lysc_node_list*)mod->compiled->data;
+            "list l {key \"d b c\";leaf a {type string;} leaf b {type string;} leaf c {type string;} leaf d {type string;}}}", LYS_IN_YANG, &mod));
+    list = (struct lysc_node_list *)mod->compiled->data;
     assert_non_null(list);
     assert_string_equal("l", list->name);
     assert_non_null(child = list->child);
@@ -493,27 +488,27 @@
     logbuf_assert("Missing key in list representing configuration data. /aa:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module bb {yang-version 1.1; namespace urn:bb;prefix bb;"
-                              "list l {key x; leaf x {type string; when 1;}}}", LYS_IN_YANG, NULL));
+            "list l {key x; leaf x {type string; when 1;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("List's key must not have any \"when\" statement. /bb:l/x");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module cc {yang-version 1.1;namespace urn:cc;prefix cc;feature f;"
-                              "list l {key x; leaf x {type string; if-feature f;}}}", LYS_IN_YANG, NULL));
+            "list l {key x; leaf x {type string; if-feature f;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Key \"x\" is disabled by its if-features. /cc:l/x");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module dd {namespace urn:dd;prefix dd;"
-                              "list l {key x; leaf x {type string; config false;}}}", LYS_IN_YANG, NULL));
+            "list l {key x; leaf x {type string; config false;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Key of the configuration list must not be status leaf. /dd:l/x");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ee {namespace urn:ee;prefix ee;"
-                              "list l {config false;key x; leaf x {type string; config true;}}}", LYS_IN_YANG, NULL));
+            "list l {config false;key x; leaf x {type string; config true;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Configuration node cannot be child of any state data node. /ee:l/x");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ff {namespace urn:ff;prefix ff;"
-                              "list l {key x; leaf-list x {type string;}}}", LYS_IN_YANG, NULL));
+            "list l {key x; leaf-list x {type string;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("The list's key \"x\" not found. /ff:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module gg {namespace urn:gg;prefix gg;"
-                              "list l {key x; unique y;leaf x {type string;} leaf-list y {type string;}}}", LYS_IN_YANG, NULL));
+            "list l {key x; unique y;leaf x {type string;} leaf-list y {type string;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Unique's descendant-schema-nodeid \"y\" refers to leaf-list node instead of a leaf. /gg:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module hh {namespace urn:hh;prefix hh;"
@@ -521,7 +516,7 @@
     logbuf_assert("Unique statement \"x y\" refers to leaves with different config type. /hh:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ii {namespace urn:ii;prefix ii;"
-                              "list l {key x; unique a:x;leaf x {type string;}}}", LYS_IN_YANG, NULL));
+            "list l {key x; unique a:x;leaf x {type string;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Invalid descendant-schema-nodeid value \"a:x\" - prefix \"a\" not defined in module \"ii\". /ii:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module jj {namespace urn:jj;prefix jj;"
@@ -533,11 +528,11 @@
     logbuf_assert("Invalid descendant-schema-nodeid value \"c^\" - missing \"/\" as node-identifier separator. /kk:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ll {namespace urn:ll;prefix ll;"
-                              "list l {key \"x y x\";leaf x {type string;}leaf y {type string;}}}", LYS_IN_YANG, NULL));
+            "list l {key \"x y x\";leaf x {type string;}leaf y {type string;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Duplicated key identifier \"x\". /ll:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module mm {namespace urn:mm;prefix mm;"
-                              "list l {key x;leaf x {type empty;}}}", LYS_IN_YANG, NULL));
+            "list l {key x;leaf x {type empty;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("List's key cannot be of \"empty\" type until it is in YANG 1.1 module. /mm:l/x");
 
     *state = NULL;
@@ -557,9 +552,9 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {namespace urn:a;prefix a;feature f;"
-                                        "choice ch {default a:b; when \"true()\"; case a {leaf a1 {type string;}leaf a2 {type string;}}"
-                                        "leaf b {type string;}}}", LYS_IN_YANG, &mod));
-    ch = (struct lysc_node_choice*)mod->compiled->data;
+            "choice ch {default a:b; when \"true()\"; case a {leaf a1 {type string;}leaf a2 {type string;}}"
+            "leaf b {type string;}}}", LYS_IN_YANG, &mod));
+    ch = (struct lysc_node_choice *)mod->compiled->data;
     assert_non_null(ch);
     assert_int_equal(LYS_CONFIG_W | LYS_STATUS_CURR, ch->flags);
     assert_int_equal(1, LY_ARRAY_COUNT(ch->when));
@@ -573,7 +568,7 @@
     assert_non_null(cs->child->next);
     assert_string_equal("a2", cs->child->next->name);
     assert_ptr_equal(cs, cs->child->parent);
-    cs = (struct lysc_node_case*)cs->next;
+    cs = (struct lysc_node_case *)cs->next;
     assert_non_null(cs);
     assert_string_equal("b", cs->name);
     assert_int_equal(LYS_STATUS_CURR | LYS_SET_DFLT, cs->flags);
@@ -584,26 +579,26 @@
     assert_ptr_equal(ch->dflt, cs);
 
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa;"
-                              "choice ch {case a {leaf x {type string;}}leaf x {type string;}}}", LYS_IN_YANG, NULL));
+            "choice ch {case a {leaf x {type string;}}leaf x {type string;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Duplicate identifier \"x\" of data definition/RPC/action/notification statement. /aa:ch/x/x");
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, "module aa2 {namespace urn:aa2;prefix aa;"
-                        "choice ch {case a {leaf y {type string;}}case b {leaf y {type string;}}}}", LYS_IN_YANG, NULL));
+            "choice ch {case a {leaf y {type string;}}case b {leaf y {type string;}}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Duplicate identifier \"y\" of data definition/RPC/action/notification statement. /aa2:ch/b/y");
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb;"
-                              "choice ch {case a {leaf x {type string;}}leaf a {type string;}}}", LYS_IN_YANG, NULL));
+            "choice ch {case a {leaf x {type string;}}leaf a {type string;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Duplicate identifier \"a\" of case statement. /bb:ch/a");
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, "module bb2 {namespace urn:bb2;prefix bb;"
-                        "choice ch {case b {leaf x {type string;}}case b {leaf y {type string;}}}}", LYS_IN_YANG, NULL));
+            "choice ch {case b {leaf x {type string;}}case b {leaf y {type string;}}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Duplicate identifier \"b\" of case statement. /bb2:ch/b");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ca {namespace urn:ca;prefix ca;"
-                "choice ch {default c;case a {leaf x {type string;}}case b {leaf y {type string;}}}}", LYS_IN_YANG, NULL));
+            "choice ch {default c;case a {leaf x {type string;}}case b {leaf y {type string;}}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Default case \"c\" not found. /ca:ch");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module cb {namespace urn:cb;prefix cb; import a {prefix a;}"
-                "choice ch {default a:a;case a {leaf x {type string;}}case b {leaf y {type string;}}}}", LYS_IN_YANG, NULL));
+            "choice ch {default a:a;case a {leaf x {type string;}}case b {leaf y {type string;}}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Default case \"a:a\" not found. /cb:ch");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module cc {namespace urn:cc;prefix cc;"
-                              "choice ch {default a;case a {leaf x {mandatory true;type string;}}}}", LYS_IN_YANG, NULL));
+            "choice ch {default a;case a {leaf x {mandatory true;type string;}}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Mandatory node \"x\" under the default case \"a\". /cc:ch");
     /* TODO check with mandatory nodes from augment placed into the case */
 
@@ -623,16 +618,16 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {yang-version 1.1;namespace urn:a;prefix a;"
-                                        "anydata any {config false;mandatory true;}}", LYS_IN_YANG, &mod));
-    any = (struct lysc_node_anydata*)mod->compiled->data;
+            "anydata any {config false;mandatory true;}}", LYS_IN_YANG, &mod));
+    any = (struct lysc_node_anydata *)mod->compiled->data;
     assert_non_null(any);
     assert_int_equal(LYS_ANYDATA, any->nodetype);
     assert_int_equal(LYS_CONFIG_R | LYS_STATUS_CURR | LYS_MAND_TRUE | LYS_SET_CONFIG, any->flags);
 
     logbuf_clean();
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {namespace urn:b;prefix b;"
-                                        "anyxml any;}", LYS_IN_YANG, &mod));
-    any = (struct lysc_node_anydata*)mod->compiled->data;
+            "anyxml any;}", LYS_IN_YANG, &mod));
+    any = (struct lysc_node_anydata *)mod->compiled->data;
     assert_non_null(any);
     assert_int_equal(LYS_ANYXML, any->nodetype);
     assert_int_equal(LYS_CONFIG_W | LYS_STATUS_CURR, any->flags);
@@ -667,9 +662,9 @@
     assert_string_equal("a", rpc->name);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {yang-version 1.1; namespace urn:b;prefix b; container top {"
-                        "action b {input {leaf x {type int8;} leaf y {type int8;}}"
-                        "output {must \"result > 25\"; must \"/top\"; leaf result {type int16;}}}}"
-                        "augment /top/b/output {leaf result2 {type string;}}}", LYS_IN_YANG, &mod));
+            "action b {input {leaf x {type int8;} leaf y {type int8;}}"
+            "output {must \"result > 25\"; must \"/top\"; leaf result {type int16;}}}}"
+            "augment /top/b/output {leaf result2 {type string;}}}", LYS_IN_YANG, &mod));
     rpc = lysc_node_actions(mod->compiled->data);
     assert_non_null(rpc);
     assert_int_equal(1, LY_ARRAY_COUNT(rpc));
@@ -681,11 +676,11 @@
 
     /* invalid */
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa;container top {action x;}}",
-                                              LYS_IN_YANG, NULL));
+            LYS_IN_YANG, NULL));
     logbuf_assert("Invalid keyword \"action\" as a child of \"container\" - the statement is allowed only in YANG 1.1 modules. Line number 1.");
 
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb;leaf x{type string;} rpc x;}",
-                                              LYS_IN_YANG, NULL));
+            LYS_IN_YANG, NULL));
     logbuf_assert("Duplicate identifier \"x\" of data definition/RPC/action/notification statement. /bb:x");
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, "module cc {yang-version 1.1; namespace urn:cc;prefix cc;container c {leaf y {type string;} action y;}}", LYS_IN_YANG, NULL));
     logbuf_assert("Duplicate identifier \"y\" of data definition/RPC/action/notification statement. /cc:c/y");
@@ -696,15 +691,15 @@
     logbuf_assert("Duplicate identifier \"w\" of data definition/RPC/action/notification statement. /ee:w");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ff {yang-version 1.1; namespace urn:ff;prefix ff; rpc test {input {container a {leaf b {type string;}}}}"
-                              "augment /test/input/a {action invalid {input {leaf x {type string;}}}}}", LYS_IN_YANG, NULL));
+            "augment /test/input/a {action invalid {input {leaf x {type string;}}}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Action \"invalid\" is placed inside another RPC/action. /ff:{augment='/test/input/a'}/invalid");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module gg {yang-version 1.1; namespace urn:gg;prefix gg; notification test {container a {leaf b {type string;}}}"
-                              "augment /test/a {action invalid {input {leaf x {type string;}}}}}", LYS_IN_YANG, NULL));
+            "augment /test/a {action invalid {input {leaf x {type string;}}}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Action \"invalid\" is placed inside notification. /gg:{augment='/test/a'}/invalid");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module hh {yang-version 1.1; namespace urn:hh;prefix hh; notification test {container a {uses grp;}}"
-                              "grouping grp {action invalid {input {leaf x {type string;}}}}}", LYS_IN_YANG, NULL));
+            "grouping grp {action invalid {input {leaf x {type string;}}}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Action \"invalid\" is placed inside notification. /hh:test/a/{uses='grp'}/invalid");
 
     *state = NULL;
@@ -723,7 +718,7 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {namespace urn:a;prefix a;"
-                                        "notification a1 {leaf x {type int8;}} notification a2;}", LYS_IN_YANG, &mod));
+            "notification a1 {leaf x {type int8;}} notification a2;}", LYS_IN_YANG, &mod));
     notif = mod->compiled->notifs;
     assert_non_null(notif);
     assert_int_equal(2, LY_ARRAY_COUNT(notif));
@@ -738,7 +733,7 @@
     assert_null(notif[1].data);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {yang-version 1.1; namespace urn:b;prefix b; container top {"
-                        "notification b1 {leaf x {type int8;}} notification b2 {must \"/top\";}}}", LYS_IN_YANG, &mod));
+            "notification b1 {leaf x {type int8;}} notification b2 {must \"/top\";}}}", LYS_IN_YANG, &mod));
     notif = lysc_node_notifs(mod->compiled->data);
     assert_non_null(notif);
     assert_int_equal(2, LY_ARRAY_COUNT(notif));
@@ -755,7 +750,7 @@
 
     /* invalid */
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa;container top {notification x;}}",
-                                              LYS_IN_YANG, NULL));
+            LYS_IN_YANG, NULL));
     logbuf_assert("Invalid keyword \"notification\" as a child of \"container\" - the statement is allowed only in YANG 1.1 modules. Line number 1.");
 
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb;leaf x{type string;} notification x;}", LYS_IN_YANG, NULL));
@@ -769,15 +764,15 @@
     logbuf_assert("Duplicate identifier \"w\" of data definition/RPC/action/notification statement. /ee:w");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ff {yang-version 1.1; namespace urn:ff;prefix ff; rpc test {input {container a {leaf b {type string;}}}}"
-                              "augment /test/input/a {notification invalid {leaf x {type string;}}}}", LYS_IN_YANG, NULL));
+            "augment /test/input/a {notification invalid {leaf x {type string;}}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Notification \"invalid\" is placed inside RPC/action. /ff:{augment='/test/input/a'}/invalid");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module gg {yang-version 1.1; namespace urn:gg;prefix gg; notification test {container a {leaf b {type string;}}}"
-                              "augment /test/a {notification invalid {leaf x {type string;}}}}", LYS_IN_YANG, NULL));
+            "augment /test/a {notification invalid {leaf x {type string;}}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Notification \"invalid\" is placed inside another notification. /gg:{augment='/test/a'}/invalid");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module hh {yang-version 1.1; namespace urn:hh;prefix hh; rpc test {input {container a {uses grp;}}}"
-                              "grouping grp {notification invalid {leaf x {type string;}}}}", LYS_IN_YANG, NULL));
+            "grouping grp {notification invalid {leaf x {type string;}}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Notification \"invalid\" is placed inside RPC/action. /hh:test/input/a/{uses='grp'}/invalid");
 
     *state = NULL;
@@ -800,125 +795,125 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {namespace urn:a;prefix a;leaf l {type int8 {range min..10|max;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_INT8, type->basetype);
-    assert_non_null(((struct lysc_type_num*)type)->range);
-    assert_non_null(((struct lysc_type_num*)type)->range->parts);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
-    assert_int_equal(-128, ((struct lysc_type_num*)type)->range->parts[0].min_64);
-    assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_64);
-    assert_int_equal(127, ((struct lysc_type_num*)type)->range->parts[1].min_64);
-    assert_int_equal(127, ((struct lysc_type_num*)type)->range->parts[1].max_64);
+    assert_non_null(((struct lysc_type_num *)type)->range);
+    assert_non_null(((struct lysc_type_num *)type)->range->parts);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num *)type)->range->parts));
+    assert_int_equal(-128, ((struct lysc_type_num *)type)->range->parts[0].min_64);
+    assert_int_equal(10, ((struct lysc_type_num *)type)->range->parts[0].max_64);
+    assert_int_equal(127, ((struct lysc_type_num *)type)->range->parts[1].min_64);
+    assert_int_equal(127, ((struct lysc_type_num *)type)->range->parts[1].max_64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {namespace urn:b;prefix b;leaf l {type int16 {range min..10|max;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_INT16, type->basetype);
-    assert_non_null(((struct lysc_type_num*)type)->range);
-    assert_non_null(((struct lysc_type_num*)type)->range->parts);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
-    assert_int_equal(-32768, ((struct lysc_type_num*)type)->range->parts[0].min_64);
-    assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_64);
-    assert_int_equal(32767, ((struct lysc_type_num*)type)->range->parts[1].min_64);
-    assert_int_equal(32767, ((struct lysc_type_num*)type)->range->parts[1].max_64);
+    assert_non_null(((struct lysc_type_num *)type)->range);
+    assert_non_null(((struct lysc_type_num *)type)->range->parts);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num *)type)->range->parts));
+    assert_int_equal(-32768, ((struct lysc_type_num *)type)->range->parts[0].min_64);
+    assert_int_equal(10, ((struct lysc_type_num *)type)->range->parts[0].max_64);
+    assert_int_equal(32767, ((struct lysc_type_num *)type)->range->parts[1].min_64);
+    assert_int_equal(32767, ((struct lysc_type_num *)type)->range->parts[1].max_64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module c {namespace urn:c;prefix c;leaf l {type int32 {range min..10|max;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_INT32, type->basetype);
-    assert_non_null(((struct lysc_type_num*)type)->range);
-    assert_non_null(((struct lysc_type_num*)type)->range->parts);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
-    assert_int_equal(INT64_C(-2147483648), ((struct lysc_type_num*)type)->range->parts[0].min_64);
-    assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_64);
-    assert_int_equal(INT64_C(2147483647), ((struct lysc_type_num*)type)->range->parts[1].min_64);
-    assert_int_equal(INT64_C(2147483647), ((struct lysc_type_num*)type)->range->parts[1].max_64);
+    assert_non_null(((struct lysc_type_num *)type)->range);
+    assert_non_null(((struct lysc_type_num *)type)->range->parts);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num *)type)->range->parts));
+    assert_int_equal(INT64_C(-2147483648), ((struct lysc_type_num *)type)->range->parts[0].min_64);
+    assert_int_equal(10, ((struct lysc_type_num *)type)->range->parts[0].max_64);
+    assert_int_equal(INT64_C(2147483647), ((struct lysc_type_num *)type)->range->parts[1].min_64);
+    assert_int_equal(INT64_C(2147483647), ((struct lysc_type_num *)type)->range->parts[1].max_64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module d {namespace urn:d;prefix d;leaf l {type int64 {range min..10|max;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_INT64, type->basetype);
-    assert_non_null(((struct lysc_type_num*)type)->range);
-    assert_non_null(((struct lysc_type_num*)type)->range->parts);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
-    assert_int_equal(INT64_C(-9223372036854775807) - INT64_C(1), ((struct lysc_type_num*)type)->range->parts[0].min_64);
-    assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_64);
-    assert_int_equal(INT64_C(9223372036854775807), ((struct lysc_type_num*)type)->range->parts[1].min_64);
-    assert_int_equal(INT64_C(9223372036854775807), ((struct lysc_type_num*)type)->range->parts[1].max_64);
+    assert_non_null(((struct lysc_type_num *)type)->range);
+    assert_non_null(((struct lysc_type_num *)type)->range->parts);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num *)type)->range->parts));
+    assert_int_equal(INT64_C(-9223372036854775807) - INT64_C(1), ((struct lysc_type_num *)type)->range->parts[0].min_64);
+    assert_int_equal(10, ((struct lysc_type_num *)type)->range->parts[0].max_64);
+    assert_int_equal(INT64_C(9223372036854775807), ((struct lysc_type_num *)type)->range->parts[1].min_64);
+    assert_int_equal(INT64_C(9223372036854775807), ((struct lysc_type_num *)type)->range->parts[1].max_64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module e {namespace urn:e;prefix e;leaf l {type uint8 {range min..10|max;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_UINT8, type->basetype);
-    assert_non_null(((struct lysc_type_num*)type)->range);
-    assert_non_null(((struct lysc_type_num*)type)->range->parts);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
-    assert_int_equal(0, ((struct lysc_type_num*)type)->range->parts[0].min_u64);
-    assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_u64);
-    assert_int_equal(255, ((struct lysc_type_num*)type)->range->parts[1].min_u64);
-    assert_int_equal(255, ((struct lysc_type_num*)type)->range->parts[1].max_u64);
+    assert_non_null(((struct lysc_type_num *)type)->range);
+    assert_non_null(((struct lysc_type_num *)type)->range->parts);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num *)type)->range->parts));
+    assert_int_equal(0, ((struct lysc_type_num *)type)->range->parts[0].min_u64);
+    assert_int_equal(10, ((struct lysc_type_num *)type)->range->parts[0].max_u64);
+    assert_int_equal(255, ((struct lysc_type_num *)type)->range->parts[1].min_u64);
+    assert_int_equal(255, ((struct lysc_type_num *)type)->range->parts[1].max_u64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module f {namespace urn:f;prefix f;leaf l {type uint16 {range min..10|max;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_UINT16, type->basetype);
-    assert_non_null(((struct lysc_type_num*)type)->range);
-    assert_non_null(((struct lysc_type_num*)type)->range->parts);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
-    assert_int_equal(0, ((struct lysc_type_num*)type)->range->parts[0].min_u64);
-    assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_u64);
-    assert_int_equal(65535, ((struct lysc_type_num*)type)->range->parts[1].min_u64);
-    assert_int_equal(65535, ((struct lysc_type_num*)type)->range->parts[1].max_u64);
+    assert_non_null(((struct lysc_type_num *)type)->range);
+    assert_non_null(((struct lysc_type_num *)type)->range->parts);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num *)type)->range->parts));
+    assert_int_equal(0, ((struct lysc_type_num *)type)->range->parts[0].min_u64);
+    assert_int_equal(10, ((struct lysc_type_num *)type)->range->parts[0].max_u64);
+    assert_int_equal(65535, ((struct lysc_type_num *)type)->range->parts[1].min_u64);
+    assert_int_equal(65535, ((struct lysc_type_num *)type)->range->parts[1].max_u64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module g {namespace urn:g;prefix g;leaf l {type uint32 {range min..10|max;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_UINT32, type->basetype);
-    assert_non_null(((struct lysc_type_num*)type)->range);
-    assert_non_null(((struct lysc_type_num*)type)->range->parts);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
-    assert_int_equal(0, ((struct lysc_type_num*)type)->range->parts[0].min_u64);
-    assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_u64);
-    assert_int_equal(UINT64_C(4294967295), ((struct lysc_type_num*)type)->range->parts[1].min_u64);
-    assert_int_equal(UINT64_C(4294967295), ((struct lysc_type_num*)type)->range->parts[1].max_u64);
+    assert_non_null(((struct lysc_type_num *)type)->range);
+    assert_non_null(((struct lysc_type_num *)type)->range->parts);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num *)type)->range->parts));
+    assert_int_equal(0, ((struct lysc_type_num *)type)->range->parts[0].min_u64);
+    assert_int_equal(10, ((struct lysc_type_num *)type)->range->parts[0].max_u64);
+    assert_int_equal(UINT64_C(4294967295), ((struct lysc_type_num *)type)->range->parts[1].min_u64);
+    assert_int_equal(UINT64_C(4294967295), ((struct lysc_type_num *)type)->range->parts[1].max_u64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module h {namespace urn:h;prefix h;leaf l {type uint64 {range min..10|max;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_UINT64, type->basetype);
-    assert_non_null(((struct lysc_type_num*)type)->range);
-    assert_non_null(((struct lysc_type_num*)type)->range->parts);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
-    assert_int_equal(0, ((struct lysc_type_num*)type)->range->parts[0].min_u64);
-    assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_u64);
-    assert_int_equal(UINT64_C(18446744073709551615), ((struct lysc_type_num*)type)->range->parts[1].min_u64);
-    assert_int_equal(UINT64_C(18446744073709551615), ((struct lysc_type_num*)type)->range->parts[1].max_u64);
+    assert_non_null(((struct lysc_type_num *)type)->range);
+    assert_non_null(((struct lysc_type_num *)type)->range->parts);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num *)type)->range->parts));
+    assert_int_equal(0, ((struct lysc_type_num *)type)->range->parts[0].min_u64);
+    assert_int_equal(10, ((struct lysc_type_num *)type)->range->parts[0].max_u64);
+    assert_int_equal(UINT64_C(18446744073709551615), ((struct lysc_type_num *)type)->range->parts[1].min_u64);
+    assert_int_equal(UINT64_C(18446744073709551615), ((struct lysc_type_num *)type)->range->parts[1].max_u64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module i {namespace urn:i;prefix i;typedef mytype {type uint8 {range 10..100;}}"
-                                             "typedef mytype2 {type mytype;} leaf l {type mytype2;}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "typedef mytype2 {type mytype;} leaf l {type mytype2;}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(3, type->refcount);
     assert_int_equal(LY_TYPE_UINT8, type->basetype);
-    assert_non_null(((struct lysc_type_num*)type)->range);
-    assert_non_null(((struct lysc_type_num*)type)->range->parts);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
+    assert_non_null(((struct lysc_type_num *)type)->range);
+    assert_non_null(((struct lysc_type_num *)type)->range->parts);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_num *)type)->range->parts));
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module j {namespace urn:j;prefix j;"
-                    "typedef mytype {type uint8 {range 1..100{description \"one to hundred\";reference A;}}}"
-                    "leaf l {type mytype {range 1..10 {description \"one to ten\";reference B;}}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "typedef mytype {type uint8 {range 1..100{description \"one to hundred\";reference A;}}}"
+            "leaf l {type mytype {range 1..10 {description \"one to ten\";reference B;}}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_UINT8, type->basetype);
-    assert_non_null(((struct lysc_type_num*)type)->range);
-    assert_string_equal("one to ten", ((struct lysc_type_num*)type)->range->dsc);
-    assert_string_equal("B", ((struct lysc_type_num*)type)->range->ref);
-    assert_non_null(((struct lysc_type_num*)type)->range->parts);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
-    assert_int_equal(1, ((struct lysc_type_num*)type)->range->parts[0].min_u64);
-    assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_u64);
+    assert_non_null(((struct lysc_type_num *)type)->range);
+    assert_string_equal("one to ten", ((struct lysc_type_num *)type)->range->dsc);
+    assert_string_equal("B", ((struct lysc_type_num *)type)->range->ref);
+    assert_non_null(((struct lysc_type_num *)type)->range->parts);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_num *)type)->range->parts));
+    assert_int_equal(1, ((struct lysc_type_num *)type)->range->parts[0].min_u64);
+    assert_int_equal(10, ((struct lysc_type_num *)type)->range->parts[0].max_u64);
 
     *state = NULL;
     ly_ctx_destroy(ctx, NULL);
@@ -936,148 +931,148 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {namespace urn:a;prefix a;leaf l {type binary {length min {error-app-tag errortag;error-message error;}}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
-    assert_non_null(((struct lysc_type_bin*)type)->length);
-    assert_non_null(((struct lysc_type_bin*)type)->length->parts);
-    assert_string_equal("errortag", ((struct lysc_type_bin*)type)->length->eapptag);
-    assert_string_equal("error", ((struct lysc_type_bin*)type)->length->emsg);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
-    assert_int_equal(0, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
-    assert_int_equal(0, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
+    assert_non_null(((struct lysc_type_bin *)type)->length);
+    assert_non_null(((struct lysc_type_bin *)type)->length->parts);
+    assert_string_equal("errortag", ((struct lysc_type_bin *)type)->length->eapptag);
+    assert_string_equal("error", ((struct lysc_type_bin *)type)->length->emsg);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin *)type)->length->parts));
+    assert_int_equal(0, ((struct lysc_type_bin *)type)->length->parts[0].min_u64);
+    assert_int_equal(0, ((struct lysc_type_bin *)type)->length->parts[0].max_u64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {namespace urn:b;prefix b;leaf l {type binary {length max;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
-    assert_non_null(((struct lysc_type_bin*)type)->length);
-    assert_non_null(((struct lysc_type_bin*)type)->length->parts);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
-    assert_int_equal(UINT64_C(18446744073709551615), ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
-    assert_int_equal(UINT64_C(18446744073709551615), ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
+    assert_non_null(((struct lysc_type_bin *)type)->length);
+    assert_non_null(((struct lysc_type_bin *)type)->length->parts);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin *)type)->length->parts));
+    assert_int_equal(UINT64_C(18446744073709551615), ((struct lysc_type_bin *)type)->length->parts[0].min_u64);
+    assert_int_equal(UINT64_C(18446744073709551615), ((struct lysc_type_bin *)type)->length->parts[0].max_u64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module c {namespace urn:c;prefix c;leaf l {type binary {length min..max;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
-    assert_non_null(((struct lysc_type_bin*)type)->length);
-    assert_non_null(((struct lysc_type_bin*)type)->length->parts);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
-    assert_int_equal(0, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
-    assert_int_equal(UINT64_C(18446744073709551615), ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
+    assert_non_null(((struct lysc_type_bin *)type)->length);
+    assert_non_null(((struct lysc_type_bin *)type)->length->parts);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin *)type)->length->parts));
+    assert_int_equal(0, ((struct lysc_type_bin *)type)->length->parts[0].min_u64);
+    assert_int_equal(UINT64_C(18446744073709551615), ((struct lysc_type_bin *)type)->length->parts[0].max_u64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module d {namespace urn:d;prefix d;leaf l {type binary {length 5;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
-    assert_non_null(((struct lysc_type_bin*)type)->length);
-    assert_non_null(((struct lysc_type_bin*)type)->length->parts);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
-    assert_int_equal(5, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
-    assert_int_equal(5, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
+    assert_non_null(((struct lysc_type_bin *)type)->length);
+    assert_non_null(((struct lysc_type_bin *)type)->length->parts);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin *)type)->length->parts));
+    assert_int_equal(5, ((struct lysc_type_bin *)type)->length->parts[0].min_u64);
+    assert_int_equal(5, ((struct lysc_type_bin *)type)->length->parts[0].max_u64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module e {namespace urn:e;prefix e;leaf l {type binary {length 1..10;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
-    assert_non_null(((struct lysc_type_bin*)type)->length);
-    assert_non_null(((struct lysc_type_bin*)type)->length->parts);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
-    assert_int_equal(1, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
-    assert_int_equal(10, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
+    assert_non_null(((struct lysc_type_bin *)type)->length);
+    assert_non_null(((struct lysc_type_bin *)type)->length->parts);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin *)type)->length->parts));
+    assert_int_equal(1, ((struct lysc_type_bin *)type)->length->parts[0].min_u64);
+    assert_int_equal(10, ((struct lysc_type_bin *)type)->length->parts[0].max_u64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module f {namespace urn:f;prefix f;leaf l {type binary {length 1..10|20..30;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
-    assert_non_null(((struct lysc_type_bin*)type)->length);
-    assert_non_null(((struct lysc_type_bin*)type)->length->parts);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
-    assert_int_equal(1, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
-    assert_int_equal(10, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
-    assert_int_equal(20, ((struct lysc_type_bin*)type)->length->parts[1].min_u64);
-    assert_int_equal(30, ((struct lysc_type_bin*)type)->length->parts[1].max_u64);
+    assert_non_null(((struct lysc_type_bin *)type)->length);
+    assert_non_null(((struct lysc_type_bin *)type)->length->parts);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_bin *)type)->length->parts));
+    assert_int_equal(1, ((struct lysc_type_bin *)type)->length->parts[0].min_u64);
+    assert_int_equal(10, ((struct lysc_type_bin *)type)->length->parts[0].max_u64);
+    assert_int_equal(20, ((struct lysc_type_bin *)type)->length->parts[1].min_u64);
+    assert_int_equal(30, ((struct lysc_type_bin *)type)->length->parts[1].max_u64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module g {namespace urn:g;prefix g;leaf l {type binary {length \"16 | 32\";}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
-    assert_non_null(((struct lysc_type_bin*)type)->length);
-    assert_non_null(((struct lysc_type_bin*)type)->length->parts);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
-    assert_int_equal(16, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
-    assert_int_equal(16, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
-    assert_int_equal(32, ((struct lysc_type_bin*)type)->length->parts[1].min_u64);
-    assert_int_equal(32, ((struct lysc_type_bin*)type)->length->parts[1].max_u64);
+    assert_non_null(((struct lysc_type_bin *)type)->length);
+    assert_non_null(((struct lysc_type_bin *)type)->length->parts);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_bin *)type)->length->parts));
+    assert_int_equal(16, ((struct lysc_type_bin *)type)->length->parts[0].min_u64);
+    assert_int_equal(16, ((struct lysc_type_bin *)type)->length->parts[0].max_u64);
+    assert_int_equal(32, ((struct lysc_type_bin *)type)->length->parts[1].min_u64);
+    assert_int_equal(32, ((struct lysc_type_bin *)type)->length->parts[1].max_u64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module h {namespace urn:h;prefix h;typedef mytype {type binary {length 10;}}"
-                                             "leaf l {type mytype {length \"10\";}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf l {type mytype {length \"10\";}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
-    assert_non_null(((struct lysc_type_bin*)type)->length);
-    assert_non_null(((struct lysc_type_bin*)type)->length->parts);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
-    assert_int_equal(10, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
-    assert_int_equal(10, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
+    assert_non_null(((struct lysc_type_bin *)type)->length);
+    assert_non_null(((struct lysc_type_bin *)type)->length->parts);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin *)type)->length->parts));
+    assert_int_equal(10, ((struct lysc_type_bin *)type)->length->parts[0].min_u64);
+    assert_int_equal(10, ((struct lysc_type_bin *)type)->length->parts[0].max_u64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module i {namespace urn:i;prefix i;typedef mytype {type binary {length 10..100;}}"
-                                             "leaf l {type mytype {length \"50\";}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf l {type mytype {length \"50\";}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
-    assert_non_null(((struct lysc_type_bin*)type)->length);
-    assert_non_null(((struct lysc_type_bin*)type)->length->parts);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
-    assert_int_equal(50, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
-    assert_int_equal(50, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
+    assert_non_null(((struct lysc_type_bin *)type)->length);
+    assert_non_null(((struct lysc_type_bin *)type)->length->parts);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin *)type)->length->parts));
+    assert_int_equal(50, ((struct lysc_type_bin *)type)->length->parts[0].min_u64);
+    assert_int_equal(50, ((struct lysc_type_bin *)type)->length->parts[0].max_u64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module j {namespace urn:j;prefix j;typedef mytype {type binary {length 10..100;}}"
-                                             "leaf l {type mytype {length \"10..30|60..100\";}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf l {type mytype {length \"10..30|60..100\";}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
-    assert_non_null(((struct lysc_type_bin*)type)->length);
-    assert_non_null(((struct lysc_type_bin*)type)->length->parts);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
-    assert_int_equal(10, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
-    assert_int_equal(30, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
-    assert_int_equal(60, ((struct lysc_type_bin*)type)->length->parts[1].min_u64);
-    assert_int_equal(100, ((struct lysc_type_bin*)type)->length->parts[1].max_u64);
+    assert_non_null(((struct lysc_type_bin *)type)->length);
+    assert_non_null(((struct lysc_type_bin *)type)->length->parts);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_bin *)type)->length->parts));
+    assert_int_equal(10, ((struct lysc_type_bin *)type)->length->parts[0].min_u64);
+    assert_int_equal(30, ((struct lysc_type_bin *)type)->length->parts[0].max_u64);
+    assert_int_equal(60, ((struct lysc_type_bin *)type)->length->parts[1].min_u64);
+    assert_int_equal(100, ((struct lysc_type_bin *)type)->length->parts[1].max_u64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module k {namespace urn:k;prefix k;typedef mytype {type binary {length 10..100;}}"
-                                    "leaf l {type mytype {length \"10..80\";}}leaf ll {type mytype;}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf l {type mytype {length \"10..80\";}}leaf ll {type mytype;}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(1, type->refcount);
-    assert_non_null(((struct lysc_type_bin*)type)->length);
-    assert_non_null(((struct lysc_type_bin*)type)->length->parts);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
-    assert_int_equal(10, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
-    assert_int_equal(80, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
-    type = ((struct lysc_node_leaf*)mod->compiled->data->next)->type;
+    assert_non_null(((struct lysc_type_bin *)type)->length);
+    assert_non_null(((struct lysc_type_bin *)type)->length->parts);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin *)type)->length->parts));
+    assert_int_equal(10, ((struct lysc_type_bin *)type)->length->parts[0].min_u64);
+    assert_int_equal(80, ((struct lysc_type_bin *)type)->length->parts[0].max_u64);
+    type = ((struct lysc_node_leaf *)mod->compiled->data->next)->type;
     assert_non_null(type);
     assert_int_equal(2, type->refcount);
-    assert_non_null(((struct lysc_type_bin*)type)->length);
-    assert_non_null(((struct lysc_type_bin*)type)->length->parts);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
-    assert_int_equal(10, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
-    assert_int_equal(100, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
+    assert_non_null(((struct lysc_type_bin *)type)->length);
+    assert_non_null(((struct lysc_type_bin *)type)->length->parts);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin *)type)->length->parts));
+    assert_int_equal(10, ((struct lysc_type_bin *)type)->length->parts[0].min_u64);
+    assert_int_equal(100, ((struct lysc_type_bin *)type)->length->parts[0].max_u64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module l {namespace urn:l;prefix l;typedef mytype {type string {length 10..100;}}"
             "typedef mytype2 {type mytype {pattern '[0-9]*';}} leaf l {type mytype2 {pattern '[0-4]*';}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_STRING, type->basetype);
     assert_int_equal(1, type->refcount);
-    assert_non_null(((struct lysc_type_str*)type)->length);
-    assert_non_null(((struct lysc_type_str*)type)->length->parts);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_str*)type)->length->parts));
-    assert_int_equal(10, ((struct lysc_type_str*)type)->length->parts[0].min_u64);
-    assert_int_equal(100, ((struct lysc_type_str*)type)->length->parts[0].max_u64);
+    assert_non_null(((struct lysc_type_str *)type)->length);
+    assert_non_null(((struct lysc_type_str *)type)->length->parts);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_str *)type)->length->parts));
+    assert_int_equal(10, ((struct lysc_type_str *)type)->length->parts[0].min_u64);
+    assert_int_equal(100, ((struct lysc_type_str *)type)->length->parts[0].max_u64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module m {namespace urn:m;prefix m;typedef mytype {type string {length 10;}}"
-                                             "leaf l {type mytype {length min..max;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf l {type mytype {length min..max;}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_STRING, type->basetype);
     assert_int_equal(1, type->refcount);
-    assert_non_null(((struct lysc_type_str*)type)->length);
-    assert_non_null(((struct lysc_type_str*)type)->length->parts);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_str*)type)->length->parts));
-    assert_int_equal(10, ((struct lysc_type_str*)type)->length->parts[0].min_u64);
-    assert_int_equal(10, ((struct lysc_type_str*)type)->length->parts[0].max_u64);
+    assert_non_null(((struct lysc_type_str *)type)->length);
+    assert_non_null(((struct lysc_type_str *)type)->length->parts);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_str *)type)->length->parts));
+    assert_int_equal(10, ((struct lysc_type_str *)type)->length->parts[0].min_u64);
+    assert_int_equal(10, ((struct lysc_type_str *)type)->length->parts[0].max_u64);
 
     /* invalid values */
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa;leaf l {type binary {length -10;}}}", LYS_IN_YANG, NULL));
@@ -1106,25 +1101,25 @@
     logbuf_assert("Invalid length restriction - values are not in ascending order (15). /kl:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ll {namespace urn:ll;prefix ll;typedef mytype {type binary {length 10;}}"
-                                   "leaf l {type mytype {length 11;}}}", LYS_IN_YANG, NULL));
+            "leaf l {type mytype {length 11;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Invalid length restriction - the derived restriction (11) is not equally or more limiting. /ll:l");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module mm {namespace urn:mm;prefix mm;typedef mytype {type binary {length 10..100;}}"
-                                   "leaf l {type mytype {length 1..11;}}}", LYS_IN_YANG, NULL));
+            "leaf l {type mytype {length 1..11;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Invalid length restriction - the derived restriction (1..11) is not equally or more limiting. /mm:l");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module nn {namespace urn:nn;prefix nn;typedef mytype {type binary {length 10..100;}}"
-                                   "leaf l {type mytype {length 20..110;}}}", LYS_IN_YANG, NULL));
+            "leaf l {type mytype {length 20..110;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Invalid length restriction - the derived restriction (20..110) is not equally or more limiting. /nn:l");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module oo {namespace urn:oo;prefix oo;typedef mytype {type binary {length 10..100;}}"
-                                   "leaf l {type mytype {length 20..30|110..120;}}}", LYS_IN_YANG, NULL));
+            "leaf l {type mytype {length 20..30|110..120;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Invalid length restriction - the derived restriction (20..30|110..120) is not equally or more limiting. /oo:l");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module pp {namespace urn:pp;prefix pp;typedef mytype {type binary {length 10..11;}}"
-                                             "leaf l {type mytype {length 15;}}}", LYS_IN_YANG, NULL));
+            "leaf l {type mytype {length 15;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Invalid length restriction - the derived restriction (15) is not equally or more limiting. /pp:l");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module qq {namespace urn:qq;prefix qq;typedef mytype {type binary {length 10..20|30..40;}}"
-                                             "leaf l {type mytype {length 15..35;}}}", LYS_IN_YANG, NULL));
+            "leaf l {type mytype {length 15..35;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Invalid length restriction - the derived restriction (15..35) is not equally or more limiting. /qq:l");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module rr {namespace urn:rr;prefix rr;typedef mytype {type binary {length 10;}}"
-                                             "leaf l {type mytype {length 10..35;}}}", LYS_IN_YANG, NULL));
+            "leaf l {type mytype {length 10..35;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Invalid length restriction - the derived restriction (10..35) is not equally or more limiting. /rr:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ss {namespace urn:ss;prefix ss;leaf l {type binary {pattern '[0-9]*';}}}", LYS_IN_YANG, NULL));
@@ -1146,53 +1141,53 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {yang-version 1.1; namespace urn:a;prefix a;leaf l {type string {"
-                                        "pattern .* {error-app-tag errortag;error-message error;}"
-                                        "pattern [0-9].*[0-9] {modifier invert-match;}}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "pattern .* {error-app-tag errortag;error-message error;}"
+            "pattern [0-9].*[0-9] {modifier invert-match;}}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
-    assert_non_null(((struct lysc_type_str*)type)->patterns);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_str*)type)->patterns));
-    assert_string_equal("errortag", ((struct lysc_type_str*)type)->patterns[0]->eapptag);
-    assert_string_equal("error", ((struct lysc_type_str*)type)->patterns[0]->emsg);
-    assert_string_equal(".*", ((struct lysc_type_str*)type)->patterns[0]->expr);
-    assert_int_equal(0, ((struct lysc_type_str*)type)->patterns[0]->inverted);
-    assert_null(((struct lysc_type_str*)type)->patterns[1]->eapptag);
-    assert_null(((struct lysc_type_str*)type)->patterns[1]->emsg);
-    assert_string_equal("[0-9].*[0-9]", ((struct lysc_type_str*)type)->patterns[1]->expr);
-    assert_int_equal(1, ((struct lysc_type_str*)type)->patterns[1]->inverted);
+    assert_non_null(((struct lysc_type_str *)type)->patterns);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_str *)type)->patterns));
+    assert_string_equal("errortag", ((struct lysc_type_str *)type)->patterns[0]->eapptag);
+    assert_string_equal("error", ((struct lysc_type_str *)type)->patterns[0]->emsg);
+    assert_string_equal(".*", ((struct lysc_type_str *)type)->patterns[0]->expr);
+    assert_int_equal(0, ((struct lysc_type_str *)type)->patterns[0]->inverted);
+    assert_null(((struct lysc_type_str *)type)->patterns[1]->eapptag);
+    assert_null(((struct lysc_type_str *)type)->patterns[1]->emsg);
+    assert_string_equal("[0-9].*[0-9]", ((struct lysc_type_str *)type)->patterns[1]->expr);
+    assert_int_equal(1, ((struct lysc_type_str *)type)->patterns[1]->inverted);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {namespace urn:b;prefix b;typedef mytype {type string {pattern '[0-9]*';}}"
-                                             "typedef mytype2 {type mytype {length 10;}} leaf l {type mytype2 {pattern '[0-4]*';}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "typedef mytype2 {type mytype {length 10;}} leaf l {type mytype2 {pattern '[0-4]*';}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_STRING, type->basetype);
     assert_int_equal(1, type->refcount);
-    assert_non_null(((struct lysc_type_str*)type)->patterns);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_str*)type)->patterns));
-    assert_string_equal("[0-9]*", ((struct lysc_type_str*)type)->patterns[0]->expr);
-    assert_int_equal(3, ((struct lysc_type_str*)type)->patterns[0]->refcount);
-    assert_string_equal("[0-4]*", ((struct lysc_type_str*)type)->patterns[1]->expr);
-    assert_int_equal(1, ((struct lysc_type_str*)type)->patterns[1]->refcount);
+    assert_non_null(((struct lysc_type_str *)type)->patterns);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_str *)type)->patterns));
+    assert_string_equal("[0-9]*", ((struct lysc_type_str *)type)->patterns[0]->expr);
+    assert_int_equal(3, ((struct lysc_type_str *)type)->patterns[0]->refcount);
+    assert_string_equal("[0-4]*", ((struct lysc_type_str *)type)->patterns[1]->expr);
+    assert_int_equal(1, ((struct lysc_type_str *)type)->patterns[1]->refcount);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module c {namespace urn:c;prefix c;typedef mytype {type string {pattern '[0-9]*';}}"
-                                             "leaf l {type mytype {length 10;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf l {type mytype {length 10;}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_STRING, type->basetype);
     assert_int_equal(1, type->refcount);
-    assert_non_null(((struct lysc_type_str*)type)->patterns);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_str*)type)->patterns));
-    assert_string_equal("[0-9]*", ((struct lysc_type_str*)type)->patterns[0]->expr);
-    assert_int_equal(2, ((struct lysc_type_str*)type)->patterns[0]->refcount);
+    assert_non_null(((struct lysc_type_str *)type)->patterns);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_str *)type)->patterns));
+    assert_string_equal("[0-9]*", ((struct lysc_type_str *)type)->patterns[0]->expr);
+    assert_int_equal(2, ((struct lysc_type_str *)type)->patterns[0]->refcount);
 
     /* test substitutions */
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module d {namespace urn:d;prefix d;leaf l {type string {"
-                                        "pattern '^\\p{IsLatinExtended-A}$';}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "pattern '^\\p{IsLatinExtended-A}$';}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
-    assert_non_null(((struct lysc_type_str*)type)->patterns);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_str*)type)->patterns));
-    assert_string_equal("^\\p{IsLatinExtended-A}$", ((struct lysc_type_str*)type)->patterns[0]->expr);
+    assert_non_null(((struct lysc_type_str *)type)->patterns);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_str *)type)->patterns));
+    assert_string_equal("^\\p{IsLatinExtended-A}$", ((struct lysc_type_str *)type)->patterns[0]->expr);
     /* TODO check some data "^Å™$" */
 
     *state = NULL;
@@ -1211,29 +1206,29 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {yang-version 1.1; namespace urn:a;prefix a;feature f; leaf l {type enumeration {"
-                                        "enum automin; enum min {value -2147483648;}enum one {if-feature f; value 1;}"
-                                        "enum two; enum seven {value 7;}enum eight;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "enum automin; enum min {value -2147483648;}enum one {if-feature f; value 1;}"
+            "enum two; enum seven {value 7;}enum eight;}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_ENUM, type->basetype);
-    assert_non_null(((struct lysc_type_enum*)type)->enums);
-    assert_int_equal(5, LY_ARRAY_COUNT(((struct lysc_type_enum*)type)->enums));
-    assert_string_equal("automin", ((struct lysc_type_enum*)type)->enums[0].name);
-    assert_int_equal(0, ((struct lysc_type_enum*)type)->enums[0].value);
-    assert_string_equal("min", ((struct lysc_type_enum*)type)->enums[1].name);
-    assert_int_equal(-2147483648, ((struct lysc_type_enum*)type)->enums[1].value);
-    assert_string_equal("two", ((struct lysc_type_enum*)type)->enums[2].name);
-    assert_int_equal(2, ((struct lysc_type_enum*)type)->enums[2].value);
-    assert_string_equal("seven", ((struct lysc_type_enum*)type)->enums[3].name);
-    assert_int_equal(7, ((struct lysc_type_enum*)type)->enums[3].value);
-    assert_string_equal("eight", ((struct lysc_type_enum*)type)->enums[4].name);
-    assert_int_equal(8, ((struct lysc_type_enum*)type)->enums[4].value);
+    assert_non_null(((struct lysc_type_enum *)type)->enums);
+    assert_int_equal(5, LY_ARRAY_COUNT(((struct lysc_type_enum *)type)->enums));
+    assert_string_equal("automin", ((struct lysc_type_enum *)type)->enums[0].name);
+    assert_int_equal(0, ((struct lysc_type_enum *)type)->enums[0].value);
+    assert_string_equal("min", ((struct lysc_type_enum *)type)->enums[1].name);
+    assert_int_equal(-2147483648, ((struct lysc_type_enum *)type)->enums[1].value);
+    assert_string_equal("two", ((struct lysc_type_enum *)type)->enums[2].name);
+    assert_int_equal(2, ((struct lysc_type_enum *)type)->enums[2].value);
+    assert_string_equal("seven", ((struct lysc_type_enum *)type)->enums[3].name);
+    assert_int_equal(7, ((struct lysc_type_enum *)type)->enums[3].value);
+    assert_string_equal("eight", ((struct lysc_type_enum *)type)->enums[4].name);
+    assert_int_equal(8, ((struct lysc_type_enum *)type)->enums[4].value);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {yang-version 1.1; namespace urn:b;prefix b;feature f; typedef mytype {type enumeration {"
-                                        "enum 11; enum min {value -2147483648;}enum x$&;"
-                                        "enum two; enum seven {value 7;}enum eight;}} leaf l { type mytype {enum seven;enum eight;}}}",
-                                        LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "enum 11; enum min {value -2147483648;}enum x$&;"
+            "enum two; enum seven {value 7;}enum eight;}} leaf l { type mytype {enum seven;enum eight;}}}",
+            LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_ENUM, type->basetype);
     assert_non_null(((struct lysc_type_enum*)type)->enums);
@@ -1275,57 +1270,56 @@
     assert_string_equal("second", ((struct lysc_type_enum*)type)->enums[1].name);
     assert_int_equal(1, ((struct lysc_type_enum*)type)->enums[1].value);
 
-
     /* invalid cases */
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; feature f; leaf l {type enumeration {"
-                                   "enum one {if-feature f;}}}}", LYS_IN_YANG, &mod));
+            "enum one {if-feature f;}}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid keyword \"if-feature\" as a child of \"enum\" - the statement is allowed only in YANG 1.1 modules. Line number 1.");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type enumeration {"
-                                   "enum one {value -2147483649;}}}}", LYS_IN_YANG, &mod));
+            "enum one {value -2147483649;}}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid value \"-2147483649\" of \"value\". Line number 1.");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type enumeration {"
-                                   "enum one {value 2147483648;}}}}", LYS_IN_YANG, &mod));
+            "enum one {value 2147483648;}}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid value \"2147483648\" of \"value\". Line number 1.");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type enumeration {"
-                                   "enum one; enum one;}}}", LYS_IN_YANG, &mod));
+            "enum one; enum one;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Duplicate identifier \"one\" of enum statement. Line number 1.");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type enumeration {"
-                                   "enum '';}}}", LYS_IN_YANG, &mod));
+            "enum '';}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Enum name must not be zero-length. Line number 1.");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type enumeration {"
-                                   "enum ' x';}}}", LYS_IN_YANG, &mod));
+            "enum ' x';}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Enum name must not have any leading or trailing whitespaces (\" x\"). Line number 1.");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type enumeration {"
-                                   "enum 'x ';}}}", LYS_IN_YANG, &mod));
+            "enum 'x ';}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Enum name must not have any leading or trailing whitespaces (\"x \"). Line number 1.");
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type enumeration {"
-                                  "enum 'inva\nlid';}}}", LYS_IN_YANG, &mod));
+            "enum 'inva\nlid';}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Control characters in enum name should be avoided (\"inva\nlid\", character number 5).");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb; leaf l {type enumeration;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Missing enum substatement for enumeration type. /bb:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module cc {yang-version 1.1;namespace urn:cc;prefix cc;typedef mytype {type enumeration {enum one;}}"
-                                             "leaf l {type mytype {enum two;}}}", LYS_IN_YANG, &mod));
+            "leaf l {type mytype {enum two;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid enumeration - derived type adds new item \"two\". /cc:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module dd {yang-version 1.1;namespace urn:dd;prefix dd;typedef mytype {type enumeration {enum one;}}"
-                                             "leaf l {type mytype {enum one {value 1;}}}}", LYS_IN_YANG, &mod));
+            "leaf l {type mytype {enum one {value 1;}}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid enumeration - value of the item \"one\" has changed from 0 to 1 in the derived type. /dd:l");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ee {namespace urn:ee;prefix ee;leaf l {type enumeration {enum x {value 2147483647;}enum y;}}}",
-                                        LYS_IN_YANG, &mod));
+            LYS_IN_YANG, &mod));
     logbuf_assert("Invalid enumeration - it is not possible to auto-assign enum value for \"y\" since the highest value is already 2147483647. /ee:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ff {namespace urn:ff;prefix ff;leaf l {type enumeration {enum x {value 1;}enum y {value 1;}}}}",
-                                        LYS_IN_YANG, &mod));
+            LYS_IN_YANG, &mod));
     logbuf_assert("Invalid enumeration - value 1 collide in items \"y\" and \"x\". /ff:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module gg {namespace urn:gg;prefix gg;typedef mytype {type enumeration;}"
-                                             "leaf l {type mytype {enum one;}}}", LYS_IN_YANG, &mod));
+            "leaf l {type mytype {enum one;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Missing enum substatement for enumeration type mytype. /gg:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module hh {namespace urn:hh;prefix hh; typedef mytype {type enumeration {enum one;}}"
-                                        "leaf l {type mytype {enum one;}}}", LYS_IN_YANG, &mod));
+            "leaf l {type mytype {enum one;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Enumeration type can be subtyped only in YANG 1.1 modules. /hh:l");
 
     *state = NULL;
@@ -1363,50 +1357,49 @@
     assert_int_equal(8, ((struct lysc_type_bits*)type)->bits[4].position);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {yang-version 1.1;namespace urn:b;prefix b;feature f; typedef mytype {type bits {"
-                                        "bit automin; bit one;bit two; bit seven {position 7;}bit eight;}} leaf l { type mytype {bit eight;bit seven;bit automin;}}}",
-                                        LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "bit automin; bit one;bit two; bit seven {position 7;}bit eight;}} leaf l { type mytype {bit eight;bit seven;bit automin;}}}",
+            LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_BITS, type->basetype);
-    assert_non_null(((struct lysc_type_bits*)type)->bits);
-    assert_int_equal(3, LY_ARRAY_COUNT(((struct lysc_type_bits*)type)->bits));
-    assert_string_equal("automin", ((struct lysc_type_bits*)type)->bits[0].name);
-    assert_int_equal(0, ((struct lysc_type_bits*)type)->bits[0].position);
-    assert_string_equal("seven", ((struct lysc_type_bits*)type)->bits[1].name);
-    assert_int_equal(7, ((struct lysc_type_bits*)type)->bits[1].position);
-    assert_string_equal("eight", ((struct lysc_type_bits*)type)->bits[2].name);
-    assert_int_equal(8, ((struct lysc_type_bits*)type)->bits[2].position);
-
+    assert_non_null(((struct lysc_type_bits *)type)->bits);
+    assert_int_equal(3, LY_ARRAY_COUNT(((struct lysc_type_bits *)type)->bits));
+    assert_string_equal("automin", ((struct lysc_type_bits *)type)->bits[0].name);
+    assert_int_equal(0, ((struct lysc_type_bits *)type)->bits[0].position);
+    assert_string_equal("seven", ((struct lysc_type_bits *)type)->bits[1].name);
+    assert_int_equal(7, ((struct lysc_type_bits *)type)->bits[1].position);
+    assert_string_equal("eight", ((struct lysc_type_bits *)type)->bits[2].name);
+    assert_int_equal(8, ((struct lysc_type_bits *)type)->bits[2].position);
 
     /* invalid cases */
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; feature f; leaf l {type bits {"
-                                   "bit one {if-feature f;}}}}", LYS_IN_YANG, &mod));
+            "bit one {if-feature f;}}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid keyword \"if-feature\" as a child of \"bit\" - the statement is allowed only in YANG 1.1 modules. Line number 1.");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type bits {"
-                                   "bit one {position -1;}}}}", LYS_IN_YANG, &mod));
+            "bit one {position -1;}}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid value \"-1\" of \"position\". Line number 1.");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type bits {"
-                                   "bit one {position 4294967296;}}}}", LYS_IN_YANG, &mod));
+            "bit one {position 4294967296;}}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid value \"4294967296\" of \"position\". Line number 1.");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type bits {"
-                                   "bit one; bit one;}}}", LYS_IN_YANG, &mod));
+            "bit one; bit one;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Duplicate identifier \"one\" of bit statement. Line number 1.");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type bits {"
-                                   "bit '11';}}}", LYS_IN_YANG, &mod));
+            "bit '11';}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid identifier first character '1' (0x0031). Line number 1.");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type bits {"
-                                   "bit 'x1$1';}}}", LYS_IN_YANG, &mod));
+            "bit 'x1$1';}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid identifier character '$' (0x0024). Line number 1.");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb; leaf l {type bits;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Missing bit substatement for bits type. /bb:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module cc {yang-version 1.1;namespace urn:cc;prefix cc;typedef mytype {type bits {bit one;}}"
-                                             "leaf l {type mytype {bit two;}}}", LYS_IN_YANG, &mod));
+            "leaf l {type mytype {bit two;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid bits - derived type adds new item \"two\". /cc:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module dd {yang-version 1.1;namespace urn:dd;prefix dd;typedef mytype {type bits {bit one;}}"
-                                             "leaf l {type mytype {bit one {position 1;}}}}", LYS_IN_YANG, &mod));
+            "leaf l {type mytype {bit one {position 1;}}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid bits - position of the item \"one\" has changed from 0 to 1 in the derived type. /dd:l");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ee {namespace urn:ee;prefix ee;leaf l {type bits {bit x {position 4294967295;}bit y;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid bits - it is not possible to auto-assign bit position for \"y\" since the highest value is already 4294967295. /ee:l");
@@ -1415,11 +1408,11 @@
     logbuf_assert("Invalid bits - position 1 collide in items \"y\" and \"x\". /ff:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module gg {namespace urn:gg;prefix gg;typedef mytype {type bits;}"
-                                             "leaf l {type mytype {bit one;}}}", LYS_IN_YANG, &mod));
+            "leaf l {type mytype {bit one;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Missing bit substatement for bits type mytype. /gg:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module hh {namespace urn:hh;prefix hh; typedef mytype {type bits {bit one;}}"
-                                        "leaf l {type mytype {bit one;}}}", LYS_IN_YANG, &mod));
+            "leaf l {type mytype {bit one;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Bits type can be subtyped only in YANG 1.1 modules. /hh:l");
 
     *state = NULL;
@@ -1438,43 +1431,43 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {namespace urn:a;prefix a;leaf l {type decimal64 {"
-                                        "fraction-digits 2;range min..max;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "fraction-digits 2;range min..max;}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_DEC64, type->basetype);
-    assert_int_equal(2, ((struct lysc_type_dec*)type)->fraction_digits);
-    assert_non_null(((struct lysc_type_dec*)type)->range);
-    assert_non_null(((struct lysc_type_dec*)type)->range->parts);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_dec*)type)->range->parts));
-    assert_int_equal(INT64_C(-9223372036854775807) - INT64_C(1), ((struct lysc_type_dec*)type)->range->parts[0].min_64);
-    assert_int_equal(INT64_C(9223372036854775807), ((struct lysc_type_dec*)type)->range->parts[0].max_64);
+    assert_int_equal(2, ((struct lysc_type_dec *)type)->fraction_digits);
+    assert_non_null(((struct lysc_type_dec *)type)->range);
+    assert_non_null(((struct lysc_type_dec *)type)->range->parts);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_dec *)type)->range->parts));
+    assert_int_equal(INT64_C(-9223372036854775807) - INT64_C(1), ((struct lysc_type_dec *)type)->range->parts[0].min_64);
+    assert_int_equal(INT64_C(9223372036854775807), ((struct lysc_type_dec *)type)->range->parts[0].max_64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {namespace urn:b;prefix b;typedef mytype {type decimal64 {"
-                                        "fraction-digits 2;range '3.14 | 5.1 | 10';}}leaf l {type mytype;}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "fraction-digits 2;range '3.14 | 5.1 | 10';}}leaf l {type mytype;}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_DEC64, type->basetype);
-    assert_int_equal(2, ((struct lysc_type_dec*)type)->fraction_digits);
-    assert_non_null(((struct lysc_type_dec*)type)->range);
-    assert_non_null(((struct lysc_type_dec*)type)->range->parts);
-    assert_int_equal(3, LY_ARRAY_COUNT(((struct lysc_type_dec*)type)->range->parts));
-    assert_int_equal(314, ((struct lysc_type_dec*)type)->range->parts[0].min_64);
-    assert_int_equal(314, ((struct lysc_type_dec*)type)->range->parts[0].max_64);
-    assert_int_equal(510, ((struct lysc_type_dec*)type)->range->parts[1].min_64);
-    assert_int_equal(510, ((struct lysc_type_dec*)type)->range->parts[1].max_64);
-    assert_int_equal(1000, ((struct lysc_type_dec*)type)->range->parts[2].min_64);
-    assert_int_equal(1000, ((struct lysc_type_dec*)type)->range->parts[2].max_64);
+    assert_int_equal(2, ((struct lysc_type_dec *)type)->fraction_digits);
+    assert_non_null(((struct lysc_type_dec *)type)->range);
+    assert_non_null(((struct lysc_type_dec *)type)->range->parts);
+    assert_int_equal(3, LY_ARRAY_COUNT(((struct lysc_type_dec *)type)->range->parts));
+    assert_int_equal(314, ((struct lysc_type_dec *)type)->range->parts[0].min_64);
+    assert_int_equal(314, ((struct lysc_type_dec *)type)->range->parts[0].max_64);
+    assert_int_equal(510, ((struct lysc_type_dec *)type)->range->parts[1].min_64);
+    assert_int_equal(510, ((struct lysc_type_dec *)type)->range->parts[1].max_64);
+    assert_int_equal(1000, ((struct lysc_type_dec *)type)->range->parts[2].min_64);
+    assert_int_equal(1000, ((struct lysc_type_dec *)type)->range->parts[2].max_64);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module c {namespace urn:c;prefix c;typedef mytype {type decimal64 {"
-                                        "fraction-digits 2;range '1 .. 65535';}}leaf l {type mytype;}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "fraction-digits 2;range '1 .. 65535';}}leaf l {type mytype;}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_int_equal(LY_TYPE_DEC64, type->basetype);
-    assert_int_equal(2, ((struct lysc_type_dec*)type)->fraction_digits);
-    assert_non_null(((struct lysc_type_dec*)type)->range);
-    assert_non_null(((struct lysc_type_dec*)type)->range->parts);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_dec*)type)->range->parts));
-    assert_int_equal(100, ((struct lysc_type_dec*)type)->range->parts[0].min_64);
-    assert_int_equal(6553500, ((struct lysc_type_dec*)type)->range->parts[0].max_64);
+    assert_int_equal(2, ((struct lysc_type_dec *)type)->fraction_digits);
+    assert_non_null(((struct lysc_type_dec *)type)->range);
+    assert_non_null(((struct lysc_type_dec *)type)->range->parts);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_dec *)type)->range->parts));
+    assert_int_equal(100, ((struct lysc_type_dec *)type)->range->parts[0].min_64);
+    assert_int_equal(6553500, ((struct lysc_type_dec *)type)->range->parts[0].max_64);
 
     /* invalid cases */
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type decimal64 {fraction-digits 0;}}}", LYS_IN_YANG, &mod));
@@ -1491,26 +1484,26 @@
     logbuf_assert("Missing fraction-digits substatement for decimal64 type mytype. /ab:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb; leaf l {type decimal64 {fraction-digits 2;"
-                                        "range '3.142';}}}", LYS_IN_YANG, &mod));
+            "range '3.142';}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Range boundary \"3.142\" of decimal64 type exceeds defined number (2) of fraction digits. /bb:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module cc {namespace urn:cc;prefix cc; leaf l {type decimal64 {fraction-digits 2;"
-                                        "range '4 | 3.14';}}}", LYS_IN_YANG, &mod));
+            "range '4 | 3.14';}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid range restriction - values are not in ascending order (3.14). /cc:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module dd {namespace urn:dd;prefix dd; typedef mytype {type decimal64 {fraction-digits 2;}}"
-                                        "leaf l {type mytype {fraction-digits 3;}}}", LYS_IN_YANG, &mod));
+            "leaf l {type mytype {fraction-digits 3;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid fraction-digits substatement for type not directly derived from decimal64 built-in type. /dd:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module de {namespace urn:de;prefix de; typedef mytype {type decimal64 {fraction-digits 2;}}"
-                                        "typedef mytype2 {type mytype {fraction-digits 3;}}leaf l {type mytype2;}}", LYS_IN_YANG, &mod));
+            "typedef mytype2 {type mytype {fraction-digits 3;}}leaf l {type mytype2;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid fraction-digits substatement for type \"mytype2\" not directly derived from decimal64 built-in type. /de:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ee {namespace urn:c;prefix c;typedef mytype {type decimal64 {"
-                              "fraction-digits 18;range '-10 .. 0';}}leaf l {type mytype;}}", LYS_IN_YANG, &mod));
+            "fraction-digits 18;range '-10 .. 0';}}leaf l {type mytype;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid range restriction - invalid value \"-10000000000000000000\". /ee:l");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ee {namespace urn:c;prefix c;typedef mytype {type decimal64 {"
-                              "fraction-digits 18;range '0 .. 10';}}leaf l {type mytype;}}", LYS_IN_YANG, &mod));
+            "fraction-digits 18;range '0 .. 10';}}leaf l {type mytype;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid range restriction - invalid value \"10000000000000000000\". /ee:l");
 
     *state = NULL;
@@ -1529,22 +1522,22 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {namespace urn:a;prefix a;typedef mytype {type instance-identifier {require-instance false;}}"
-                                        "leaf l1 {type instance-identifier {require-instance true;}}"
-                                        "leaf l2 {type mytype;} leaf l3 {type instance-identifier;}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf l1 {type instance-identifier {require-instance true;}}"
+            "leaf l2 {type mytype;} leaf l3 {type instance-identifier;}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_INST, type->basetype);
-    assert_int_equal(1, ((struct lysc_type_instanceid*)type)->require_instance);
+    assert_int_equal(1, ((struct lysc_type_instanceid *)type)->require_instance);
 
-    type = ((struct lysc_node_leaf*)mod->compiled->data->next)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data->next)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_INST, type->basetype);
-    assert_int_equal(0, ((struct lysc_type_instanceid*)type)->require_instance);
+    assert_int_equal(0, ((struct lysc_type_instanceid *)type)->require_instance);
 
-    type = ((struct lysc_node_leaf*)mod->compiled->data->next->next)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data->next->next)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_INST, type->basetype);
-    assert_int_equal(1, ((struct lysc_type_instanceid*)type)->require_instance);
+    assert_int_equal(1, ((struct lysc_type_instanceid *)type)->require_instance);
 
     /* invalid cases */
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type instance-identifier {require-instance yes;}}}", LYS_IN_YANG, &mod));
@@ -1569,51 +1562,51 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {yang-version 1.1;namespace urn:a;prefix a;identity i; identity j; identity k {base i;}"
-                                        "typedef mytype {type identityref {base i;}}"
-                                        "leaf l1 {type mytype;} leaf l2 {type identityref {base a:k; base j;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "typedef mytype {type identityref {base i;}}"
+            "leaf l1 {type mytype;} leaf l2 {type identityref {base a:k; base j;}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_IDENT, type->basetype);
-    assert_non_null(((struct lysc_type_identityref*)type)->bases);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_identityref*)type)->bases));
-    assert_string_equal("i", ((struct lysc_type_identityref*)type)->bases[0]->name);
+    assert_non_null(((struct lysc_type_identityref *)type)->bases);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_identityref *)type)->bases));
+    assert_string_equal("i", ((struct lysc_type_identityref *)type)->bases[0]->name);
 
-    type = ((struct lysc_node_leaf*)mod->compiled->data->next)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data->next)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_IDENT, type->basetype);
-    assert_non_null(((struct lysc_type_identityref*)type)->bases);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_identityref*)type)->bases));
-    assert_string_equal("k", ((struct lysc_type_identityref*)type)->bases[0]->name);
-    assert_string_equal("j", ((struct lysc_type_identityref*)type)->bases[1]->name);
+    assert_non_null(((struct lysc_type_identityref *)type)->bases);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_identityref *)type)->bases));
+    assert_string_equal("k", ((struct lysc_type_identityref *)type)->bases[0]->name);
+    assert_string_equal("j", ((struct lysc_type_identityref *)type)->bases[1]->name);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {yang-version 1.1;namespace urn:b;prefix b;import a {prefix a;}"
-                                        "leaf l {type identityref {base a:k; base a:j;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf l {type identityref {base a:k; base a:j;}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_IDENT, type->basetype);
-    assert_non_null(((struct lysc_type_identityref*)type)->bases);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_identityref*)type)->bases));
-    assert_string_equal("k", ((struct lysc_type_identityref*)type)->bases[0]->name);
-    assert_string_equal("j", ((struct lysc_type_identityref*)type)->bases[1]->name);
+    assert_non_null(((struct lysc_type_identityref *)type)->bases);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_identityref *)type)->bases));
+    assert_string_equal("k", ((struct lysc_type_identityref *)type)->bases[0]->name);
+    assert_string_equal("j", ((struct lysc_type_identityref *)type)->bases[1]->name);
 
     /* invalid cases */
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; leaf l {type identityref;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Missing base substatement for identityref type. /aa:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb; typedef mytype {type identityref;}"
-                                        "leaf l {type mytype;}}", LYS_IN_YANG, &mod));
+            "leaf l {type mytype;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Missing base substatement for identityref type mytype. /bb:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module cc {namespace urn:cc;prefix cc; identity i; typedef mytype {type identityref {base i;}}"
-                                        "leaf l {type mytype {base i;}}}", LYS_IN_YANG, &mod));
+            "leaf l {type mytype {base i;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid base substatement for the type not directly derived from identityref built-in type. /cc:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module dd {namespace urn:dd;prefix dd; identity i; typedef mytype {type identityref {base i;}}"
-                                        "typedef mytype2 {type mytype {base i;}}leaf l {type mytype2;}}", LYS_IN_YANG, &mod));
+            "typedef mytype2 {type mytype {base i;}}leaf l {type mytype2;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid base substatement for the type \"mytype2\" not directly derived from identityref built-in type. /dd:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ee {namespace urn:ee;prefix ee; identity i; identity j;"
-                                        "leaf l {type identityref {base i;base j;}}}", LYS_IN_YANG, &mod));
+            "leaf l {type identityref {base i;base j;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Multiple bases in identityref type are allowed only in YANG 1.1 modules. /ee:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ff {namespace urn:ff;prefix ff; identity i;leaf l {type identityref {base j;}}}", LYS_IN_YANG, &mod));
@@ -1673,71 +1666,71 @@
 
     /* complete leafref paths */
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {yang-version 1.1;namespace urn:a;prefix a;"
-                                        "leaf ref1 {type leafref {path /a:target1;}} leaf ref2 {type leafref {path /a/target2; require-instance false;}}"
-                                        "leaf target1 {type string;}container a {leaf target2 {type uint8;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf ref1 {type leafref {path /a:target1;}} leaf ref2 {type leafref {path /a/target2; require-instance false;}}"
+            "leaf target1 {type string;}container a {leaf target2 {type uint8;}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
-    assert_string_equal("/a:target1", ((struct lysc_type_leafref*)type)->path->expr);
-    assert_ptr_equal(mod, ly_resolve_prefix(ctx, "a", 1, LY_PREF_SCHEMA_RESOLVED, ((struct lysc_type_leafref*)type)->prefixes));
-    assert_non_null(((struct lysc_type_leafref*)type)->realtype);
-    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref*)type)->realtype->basetype);
-    assert_int_equal(1, ((struct lysc_type_leafref*)type)->require_instance);
-    type = ((struct lysc_node_leaf*)mod->compiled->data->next)->type;
+    assert_string_equal("/a:target1", ((struct lysc_type_leafref *)type)->path->expr);
+    assert_ptr_equal(mod, ly_resolve_prefix(ctx, "a", 1, LY_PREF_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes));
+    assert_non_null(((struct lysc_type_leafref *)type)->realtype);
+    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref *)type)->realtype->basetype);
+    assert_int_equal(1, ((struct lysc_type_leafref *)type)->require_instance);
+    type = ((struct lysc_node_leaf *)mod->compiled->data->next)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
-    assert_string_equal("/a/target2", ((struct lysc_type_leafref*)type)->path->expr);
-    assert_int_equal(0, LY_ARRAY_COUNT(((struct lysc_type_leafref*)type)->prefixes));
-    assert_non_null(((struct lysc_type_leafref*)type)->realtype);
-    assert_int_equal(LY_TYPE_UINT8, ((struct lysc_type_leafref*)type)->realtype->basetype);
-    assert_int_equal(0, ((struct lysc_type_leafref*)type)->require_instance);
+    assert_string_equal("/a/target2", ((struct lysc_type_leafref *)type)->path->expr);
+    assert_int_equal(0, LY_ARRAY_COUNT(((struct lysc_type_leafref *)type)->prefixes));
+    assert_non_null(((struct lysc_type_leafref *)type)->realtype);
+    assert_int_equal(LY_TYPE_UINT8, ((struct lysc_type_leafref *)type)->realtype->basetype);
+    assert_int_equal(0, ((struct lysc_type_leafref *)type)->require_instance);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {namespace urn:b;prefix b; typedef mytype {type leafref {path /b:target;}}"
-                                        "typedef mytype2 {type mytype;} typedef mytype3 {type leafref {path /target;}} leaf ref {type mytype2;}"
-                                        "leaf target {type leafref {path ../realtarget;}} leaf realtarget {type string;}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "typedef mytype2 {type mytype;} typedef mytype3 {type leafref {path /target;}} leaf ref {type mytype2;}"
+            "leaf target {type leafref {path ../realtarget;}} leaf realtarget {type string;}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
-    assert_string_equal("/b:target", ((struct lysc_type_leafref* )type)->path->expr);
-    assert_ptr_equal(mod, ly_resolve_prefix(ctx, "b", 1, LY_PREF_SCHEMA_RESOLVED, ((struct lysc_type_leafref*)type)->prefixes));
-    assert_non_null(((struct lysc_type_leafref*)type)->realtype);
-    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref*)type)->realtype->basetype);
-    assert_int_equal(1, ((struct lysc_type_leafref* )type)->require_instance);
+    assert_string_equal("/b:target", ((struct lysc_type_leafref *)type)->path->expr);
+    assert_ptr_equal(mod, ly_resolve_prefix(ctx, "b", 1, LY_PREF_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes));
+    assert_non_null(((struct lysc_type_leafref *)type)->realtype);
+    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref *)type)->realtype->basetype);
+    assert_int_equal(1, ((struct lysc_type_leafref *)type)->require_instance);
 
     /* prefixes are reversed to check using correct context of the path! */
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module c {yang-version 1.1;namespace urn:c;prefix b; import b {prefix c;}"
-                                        "typedef mytype3 {type c:mytype {require-instance false;}}"
-                                        "leaf ref1 {type b:mytype3;}leaf ref2 {type c:mytype2;}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "typedef mytype3 {type c:mytype {require-instance false;}}"
+            "leaf ref1 {type b:mytype3;}leaf ref2 {type c:mytype2;}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
-    assert_string_equal("/b:target", ((struct lysc_type_leafref* )type)->path->expr);
-    assert_ptr_not_equal(mod, ly_resolve_prefix(ctx, "b", 1, LY_PREF_SCHEMA_RESOLVED, ((struct lysc_type_leafref*)type)->prefixes));
-    assert_non_null(((struct lysc_type_leafref*)type)->realtype);
-    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref*)type)->realtype->basetype);
-    assert_int_equal(0, ((struct lysc_type_leafref* )type)->require_instance);
-    type = ((struct lysc_node_leaf*)mod->compiled->data->next)->type;
+    assert_string_equal("/b:target", ((struct lysc_type_leafref *)type)->path->expr);
+    assert_ptr_not_equal(mod, ly_resolve_prefix(ctx, "b", 1, LY_PREF_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes));
+    assert_non_null(((struct lysc_type_leafref *)type)->realtype);
+    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref *)type)->realtype->basetype);
+    assert_int_equal(0, ((struct lysc_type_leafref *)type)->require_instance);
+    type = ((struct lysc_node_leaf *)mod->compiled->data->next)->type;
     assert_non_null(type);
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
-    assert_string_equal("/b:target", ((struct lysc_type_leafref* )type)->path->expr);
-    assert_ptr_not_equal(mod, ly_resolve_prefix(ctx, "b", 1, LY_PREF_SCHEMA_RESOLVED, ((struct lysc_type_leafref*)type)->prefixes));
-    assert_int_equal(1, ((struct lysc_type_leafref* )type)->require_instance);
+    assert_string_equal("/b:target", ((struct lysc_type_leafref *)type)->path->expr);
+    assert_ptr_not_equal(mod, ly_resolve_prefix(ctx, "b", 1, LY_PREF_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes));
+    assert_int_equal(1, ((struct lysc_type_leafref *)type)->require_instance);
 
     /* non-prefixed nodes in path are supposed to be from the module where the leafref type is instantiated */
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module d {namespace urn:d;prefix d; import b {prefix b;}"
-                                        "leaf ref {type b:mytype3;}leaf target {type int8;}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf ref {type b:mytype3;}leaf target {type int8;}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
-    assert_string_equal("/target", ((struct lysc_type_leafref* )type)->path->expr);
-    assert_int_equal(0, LY_ARRAY_COUNT(((struct lysc_type_leafref*)type)->prefixes));
-    assert_non_null(((struct lysc_type_leafref*)type)->realtype);
-    assert_int_equal(LY_TYPE_INT8, ((struct lysc_type_leafref*)type)->realtype->basetype);
-    assert_int_equal(1, ((struct lysc_type_leafref* )type)->require_instance);
+    assert_string_equal("/target", ((struct lysc_type_leafref *)type)->path->expr);
+    assert_int_equal(0, LY_ARRAY_COUNT(((struct lysc_type_leafref *)type)->prefixes));
+    assert_non_null(((struct lysc_type_leafref *)type)->realtype);
+    assert_int_equal(LY_TYPE_INT8, ((struct lysc_type_leafref *)type)->realtype->basetype);
+    assert_int_equal(1, ((struct lysc_type_leafref *)type)->require_instance);
 
     /* conditional leafrefs */
     /*assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module e {yang-version 1.1;namespace urn:e;prefix e;feature f1; feature f2;"
@@ -1753,42 +1746,42 @@
     assert_int_equal(LY_TYPE_BOOL, ((struct lysc_type_leafref*)type)->realtype->basetype);*/
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module f {namespace urn:f;prefix f;"
-                                        "list interface{key name;leaf name{type string;}list address {key ip;leaf ip {type string;}}}"
-                                        "container default-address{leaf ifname{type leafref{ path \"../../interface/name\";}}"
-                                          "leaf address {type leafref{ path \"../../interface[  name = current()/../ifname ]/address/ip\";}}}}",
-                                        LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)(*lysc_node_children_p(mod->compiled->data->prev, 0))->prev)->type;
+            "list interface{key name;leaf name{type string;}list address {key ip;leaf ip {type string;}}}"
+            "container default-address{leaf ifname{type leafref{ path \"../../interface/name\";}}"
+            "leaf address {type leafref{ path \"../../interface[  name = current()/../ifname ]/address/ip\";}}}}",
+            LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)(*lysc_node_children_p(mod->compiled->data->prev, 0))->prev)->type;
     assert_non_null(type);
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
     assert_string_equal("../../interface[  name = current()/../ifname ]/address/ip",
-                        ((struct lysc_type_leafref* )type)->path->expr);
-    assert_int_equal(0, LY_ARRAY_COUNT(((struct lysc_type_leafref*)type)->prefixes));
-    assert_non_null(((struct lysc_type_leafref*)type)->realtype);
-    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref*)type)->realtype->basetype);
+            ((struct lysc_type_leafref *)type)->path->expr);
+    assert_int_equal(0, LY_ARRAY_COUNT(((struct lysc_type_leafref *)type)->prefixes));
+    assert_non_null(((struct lysc_type_leafref *)type)->realtype);
+    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref *)type)->realtype->basetype);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module g {namespace urn:g;prefix g;"
-                                        "leaf source {type leafref {path \"/endpoint-parent[id=current()/../field]/endpoint/name\";}}"
-                                        "leaf field {type int32;}list endpoint-parent {key id;leaf id {type int32;}"
-                                        "list endpoint {key name;leaf name {type string;}}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf source {type leafref {path \"/endpoint-parent[id=current()/../field]/endpoint/name\";}}"
+            "leaf field {type int32;}list endpoint-parent {key id;leaf id {type int32;}"
+            "list endpoint {key name;leaf name {type string;}}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
-    assert_string_equal("/endpoint-parent[id=current()/../field]/endpoint/name", ((struct lysc_type_leafref* )type)->path->expr);
-    assert_int_equal(0, LY_ARRAY_COUNT(((struct lysc_type_leafref*)type)->prefixes));
-    assert_non_null(((struct lysc_type_leafref*)type)->realtype);
-    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref*)type)->realtype->basetype);
+    assert_string_equal("/endpoint-parent[id=current()/../field]/endpoint/name", ((struct lysc_type_leafref *)type)->path->expr);
+    assert_int_equal(0, LY_ARRAY_COUNT(((struct lysc_type_leafref *)type)->prefixes));
+    assert_non_null(((struct lysc_type_leafref *)type)->realtype);
+    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref *)type)->realtype->basetype);
 
     /* leafref to imported (not yet implemented) module */
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "module h {namespace urn:h;prefix h; leaf h  {type uint16;}}");
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module i {namespace urn:i;prefix i;import h {prefix h;}"
-                                        "leaf i {type leafref {path /h:h;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf i {type leafref {path /h:h;}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
-    assert_non_null(((struct lysc_type_leafref*)type)->realtype);
-    assert_int_equal(LY_TYPE_UINT16, ((struct lysc_type_leafref*)type)->realtype->basetype);
+    assert_non_null(((struct lysc_type_leafref *)type)->realtype);
+    assert_int_equal(LY_TYPE_UINT16, ((struct lysc_type_leafref *)type)->realtype->basetype);
     assert_non_null(mod = ly_ctx_get_module_implemented(ctx, "h"));
     assert_int_equal(1, mod->implemented);
     assert_non_null(mod->compiled->data);
@@ -1796,13 +1789,13 @@
 
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "module j {namespace urn:j;prefix j; leaf j  {type string;}}");
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module k {namespace urn:k;prefix k;import j {prefix j;}"
-                                        "leaf i {type leafref {path \"/ilist[name = current()/../j:j]/value\";}}"
-                                        "list ilist {key name; leaf name {type string;} leaf value {type uint16;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf i {type leafref {path \"/ilist[name = current()/../j:j]/value\";}}"
+            "list ilist {key name; leaf name {type string;} leaf value {type uint16;}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
-    assert_non_null(((struct lysc_type_leafref*)type)->realtype);
-    assert_int_equal(LY_TYPE_UINT16, ((struct lysc_type_leafref*)type)->realtype->basetype);
+    assert_non_null(((struct lysc_type_leafref *)type)->realtype);
+    assert_int_equal(LY_TYPE_UINT16, ((struct lysc_type_leafref *)type)->realtype->basetype);
     assert_non_null(mod = ly_ctx_get_module_implemented(ctx, "j"));
     assert_int_equal(1, mod->implemented);
     assert_non_null(mod->compiled->data);
@@ -1810,182 +1803,182 @@
 
     /* leafref with a default value */
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module l {namespace urn:l;prefix l;"
-                                        "leaf source {type leafref {path \"../target\";}default true;}"
-                                        "leaf target {type boolean;}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf source {type leafref {path \"../target\";}default true;}"
+            "leaf target {type boolean;}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
-    assert_string_equal("../target", ((struct lysc_type_leafref* )type)->path->expr);
-    assert_non_null(((struct lysc_type_leafref*)type)->realtype);
-    assert_int_equal(LY_TYPE_BOOL, ((struct lysc_type_leafref*)type)->realtype->basetype);
-    assert_non_null(((struct lysc_node_leaf*)mod->compiled->data)->dflt);
-    assert_int_equal(LY_TYPE_BOOL, ((struct lysc_node_leaf*)mod->compiled->data)->dflt->realtype->basetype);
-    assert_int_equal(1, ((struct lysc_node_leaf*)mod->compiled->data)->dflt->boolean);
+    assert_string_equal("../target", ((struct lysc_type_leafref *)type)->path->expr);
+    assert_non_null(((struct lysc_type_leafref *)type)->realtype);
+    assert_int_equal(LY_TYPE_BOOL, ((struct lysc_type_leafref *)type)->realtype->basetype);
+    assert_non_null(((struct lysc_node_leaf *)mod->compiled->data)->dflt);
+    assert_int_equal(LY_TYPE_BOOL, ((struct lysc_node_leaf *)mod->compiled->data)->dflt->realtype->basetype);
+    assert_int_equal(1, ((struct lysc_node_leaf *)mod->compiled->data)->dflt->boolean);
 
     /* invalid paths */
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa;container a {leaf target2 {type uint8;}}"
-                                        "leaf ref1 {type leafref {path ../a/invalid;}}}", LYS_IN_YANG, &mod));
+            "leaf ref1 {type leafref {path ../a/invalid;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Not found node \"invalid\" in path. /aa:ref1");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb;container a {leaf target2 {type uint8;}}"
-                                        "leaf ref1 {type leafref {path ../../toohigh;}}}", LYS_IN_YANG, &mod));
+            "leaf ref1 {type leafref {path ../../toohigh;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Too many parent references in path. /bb:ref1");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module cc {namespace urn:cc;prefix cc;container a {leaf target2 {type uint8;}}"
-                                        "leaf ref1 {type leafref {path /a:invalid;}}}", LYS_IN_YANG, &mod));
+            "leaf ref1 {type leafref {path /a:invalid;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("No module connected with the prefix \"a\" found (prefix format schema stored mapping). /cc:ref1");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module dd {namespace urn:dd;prefix dd;leaf target1 {type string;}"
-                                        "container a {leaf target2 {type uint8;}} leaf ref1 {type leafref {"
-                                        "path '/a[target2 = current()/../target1]/target2';}}}", LYS_IN_YANG, &mod));
+            "container a {leaf target2 {type uint8;}} leaf ref1 {type leafref {"
+            "path '/a[target2 = current()/../target1]/target2';}}}", LYS_IN_YANG, &mod));
     logbuf_assert("List predicate defined for container \"a\" in path. /dd:ref1");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ee {namespace urn:ee;prefix ee;container a {leaf target2 {type uint8;}}"
-                                        "leaf ref1 {type leafref {path /a!invalid;}}}", LYS_IN_YANG, &mod));
+            "leaf ref1 {type leafref {path /a!invalid;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid character 0x21 ('!'), perhaps \"a\" is supposed to be a function call.");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ff {namespace urn:ff;prefix ff;container a {leaf target2 {type uint8;}}"
-                                        "leaf ref1 {type leafref {path /a;}}}", LYS_IN_YANG, &mod));
+            "leaf ref1 {type leafref {path /a;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid leafref path \"/a\" - target node is container instead of leaf or leaf-list. /ff:ref1");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module gg {namespace urn:gg;prefix gg;container a {leaf target2 {type uint8;"
-                                        "status deprecated;}} leaf ref1 {type leafref {path /a/target2;}}}", LYS_IN_YANG, &mod));
+            "status deprecated;}} leaf ref1 {type leafref {path /a/target2;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("A current definition \"ref1\" is not allowed to reference deprecated definition \"target2\". /gg:ref1");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module hh {namespace urn:hh;prefix hh;"
-                                        "leaf ref1 {type leafref;}}", LYS_IN_YANG, &mod));
+            "leaf ref1 {type leafref;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Missing path substatement for leafref type. /hh:ref1");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ii {namespace urn:ii;prefix ii;typedef mytype {type leafref;}"
-                                        "leaf ref1 {type mytype;}}", LYS_IN_YANG, &mod));
+            "leaf ref1 {type mytype;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Missing path substatement for leafref type mytype. /ii:ref1");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module jj {namespace urn:jj;prefix jj;feature f;"
-                                        "leaf ref {type leafref {path /target;}}leaf target {if-feature f;type string;}}", LYS_IN_YANG, &mod));
+            "leaf ref {type leafref {path /target;}}leaf target {if-feature f;type string;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Not found node \"target\" in path. /jj:ref");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module kk {namespace urn:kk;prefix kk;"
-                                        "leaf ref {type leafref {path /target;}}leaf target {type string;config false;}}", LYS_IN_YANG, &mod));
+            "leaf ref {type leafref {path /target;}}leaf target {type string;config false;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid leafref path \"/target\" - target is supposed to represent configuration data (as the leafref does), but it does not. /kk:ref");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ll {namespace urn:ll;prefix ll;"
-                                        "leaf ref {type leafref {path /target; require-instance true;}}leaf target {type string;}}", LYS_IN_YANG, &mod));
+            "leaf ref {type leafref {path /target; require-instance true;}}leaf target {type string;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Leafref type can be restricted by require-instance statement only in YANG 1.1 modules. /ll:ref");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module mm {namespace urn:mm;prefix mm;typedef mytype {type leafref {path /target;require-instance false;}}"
-                                        "leaf ref {type mytype;}leaf target {type string;}}", LYS_IN_YANG, &mod));
+            "leaf ref {type mytype;}leaf target {type string;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Leafref type \"mytype\" can be restricted by require-instance statement only in YANG 1.1 modules. /mm:ref");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module nn {namespace urn:nn;prefix nn;"
-                                        "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
-                                        "leaf ifname{type leafref{ path \"../interface/name\";}}"
-                                        "leaf address {type leafref{ path \"/interface[name is current()/../ifname]/ip\";}}}",
-                                        LYS_IN_YANG, &mod));
+            "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
+            "leaf ifname{type leafref{ path \"../interface/name\";}}"
+            "leaf address {type leafref{ path \"/interface[name is current()/../ifname]/ip\";}}}",
+            LYS_IN_YANG, &mod));
     logbuf_assert("Invalid character 0x69 ('i'), perhaps \"name\" is supposed to be a function call.");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module oo {namespace urn:oo;prefix oo;"
-                                        "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
-                                        "leaf ifname{type leafref{ path \"../interface/name\";}}"
-                                        "leaf address {type leafref{ path \"/interface[name=current()/../ifname/ip\";}}}",
-                                        LYS_IN_YANG, &mod));
+            "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
+            "leaf ifname{type leafref{ path \"../interface/name\";}}"
+            "leaf address {type leafref{ path \"/interface[name=current()/../ifname/ip\";}}}",
+            LYS_IN_YANG, &mod));
     logbuf_assert("Unexpected XPath expression end.");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module pp {namespace urn:pp;prefix pp;"
-                                        "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
-                                        "leaf ifname{type leafref{ path \"../interface/name\";}}"
-                                        "leaf address {type leafref{ path \"/interface[x:name=current()/../ifname]/ip\";}}}",
-                                        LYS_IN_YANG, &mod));
+            "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
+            "leaf ifname{type leafref{ path \"../interface/name\";}}"
+            "leaf address {type leafref{ path \"/interface[x:name=current()/../ifname]/ip\";}}}",
+            LYS_IN_YANG, &mod));
     logbuf_assert("No module connected with the prefix \"x\" found (prefix format schema stored mapping). /pp:address");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module qq {namespace urn:qq;prefix qq;"
-                                        "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
-                                        "leaf ifname{type leafref{ path \"../interface/name\";}}"
-                                        "leaf address {type leafref{ path \"/interface[id=current()/../ifname]/ip\";}}}",
-                                        LYS_IN_YANG, &mod));
+            "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
+            "leaf ifname{type leafref{ path \"../interface/name\";}}"
+            "leaf address {type leafref{ path \"/interface[id=current()/../ifname]/ip\";}}}",
+            LYS_IN_YANG, &mod));
     logbuf_assert("Not found node \"id\" in path. /qq:address");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module rr {namespace urn:rr;prefix rr;"
-                                        "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
-                                        "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
-                                        "leaf address {type leafref{ path \"/interface[name=current() /  .. / ifname][name=current()/../test]/ip\";}}}",
-                                        LYS_IN_YANG, &mod));
+            "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
+            "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
+            "leaf address {type leafref{ path \"/interface[name=current() /  .. / ifname][name=current()/../test]/ip\";}}}",
+            LYS_IN_YANG, &mod));
     logbuf_assert("Duplicate predicate key \"name\" in path.");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ss {namespace urn:ss;prefix ss;"
-                                        "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
-                                        "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
-                                        "leaf address {type leafref{ path \"/interface[name = ../ifname]/ip\";}}}",
-                                        LYS_IN_YANG, &mod));
+            "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
+            "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
+            "leaf address {type leafref{ path \"/interface[name = ../ifname]/ip\";}}}",
+            LYS_IN_YANG, &mod));
     logbuf_assert("Unexpected XPath token \"..\" (\"../ifname]/ip\"), expected \"FunctionName\".");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module tt {namespace urn:tt;prefix tt;"
-                                        "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
-                                        "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
-                                        "leaf address {type leafref{ path \"/interface[name = current()../ifname]/ip\";}}}",
-                                        LYS_IN_YANG, &mod));
+            "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
+            "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
+            "leaf address {type leafref{ path \"/interface[name = current()../ifname]/ip\";}}}",
+            LYS_IN_YANG, &mod));
     logbuf_assert("Unexpected XPath token \"..\" (\"../ifname]/ip\"), expected \"]\".");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module uu {namespace urn:uu;prefix uu;"
-                                        "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
-                                        "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
-                                        "leaf address {type leafref{ path \"/interface[name = current()/..ifname]/ip\";}}}",
-                                        LYS_IN_YANG, &mod));
+            "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
+            "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
+            "leaf address {type leafref{ path \"/interface[name = current()/..ifname]/ip\";}}}",
+            LYS_IN_YANG, &mod));
     logbuf_assert("Invalid character number 31 of expression '/interface[name = current()/..ifname]/ip'.");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module vv {namespace urn:vv;prefix vv;"
-                                        "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
-                                        "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
-                                        "leaf address {type leafref{ path \"/interface[name = current()/ifname]/ip\";}}}",
-                                        LYS_IN_YANG, &mod));
+            "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
+            "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
+            "leaf address {type leafref{ path \"/interface[name = current()/ifname]/ip\";}}}",
+            LYS_IN_YANG, &mod));
     logbuf_assert("Unexpected XPath token \"NameTest\" (\"ifname]/ip\"), expected \"..\".");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ww {namespace urn:ww;prefix ww;"
-                                        "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
-                                        "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
-                                        "leaf address {type leafref{ path \"/interface[name = current()/../]/ip\";}}}",
-                                        LYS_IN_YANG, &mod));
+            "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
+            "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
+            "leaf address {type leafref{ path \"/interface[name = current()/../]/ip\";}}}",
+            LYS_IN_YANG, &mod));
     logbuf_assert("Unexpected XPath token \"]\" (\"]/ip\").");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module xx {namespace urn:xx;prefix xx;"
-                                        "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
-                                        "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
-                                        "leaf address {type leafref{ path \"/interface[name = current()/../$node]/ip\";}}}",
-                                        LYS_IN_YANG, &mod));
+            "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
+            "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
+            "leaf address {type leafref{ path \"/interface[name = current()/../$node]/ip\";}}}",
+            LYS_IN_YANG, &mod));
     logbuf_assert("Invalid character 0x24 ('$'), perhaps \"\" is supposed to be a function call.");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module yy {namespace urn:yy;prefix yy;"
-                                        "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
-                                        "leaf ifname{type leafref{ path \"../interface/name\";}}"
-                                        "leaf address {type leafref{ path \"/interface[name=current()/../x:ifname]/ip\";}}}",
-                                        LYS_IN_YANG, &mod));
+            "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
+            "leaf ifname{type leafref{ path \"../interface/name\";}}"
+            "leaf address {type leafref{ path \"/interface[name=current()/../x:ifname]/ip\";}}}",
+            LYS_IN_YANG, &mod));
     logbuf_assert("No module connected with the prefix \"x\" found (prefix format schema stored mapping). /yy:address");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module zz {namespace urn:zz;prefix zz;"
-                                        "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
-                                        "leaf ifname{type leafref{ path \"../interface/name\";}}"
-                                        "leaf address {type leafref{ path \"/interface[name=current()/../xxx]/ip\";}}}",
-                                        LYS_IN_YANG, &mod));
+            "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
+            "leaf ifname{type leafref{ path \"../interface/name\";}}"
+            "leaf address {type leafref{ path \"/interface[name=current()/../xxx]/ip\";}}}",
+            LYS_IN_YANG, &mod));
     logbuf_assert("Not found node \"xxx\" in path. /zz:address");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module zza {namespace urn:zza;prefix zza;"
-                                        "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
-                                        "leaf ifname{type leafref{ path \"../interface/name\";}}container c;"
-                                        "leaf address {type leafref{ path \"/interface[name=current()/../c]/ip\";}}}",
-                                        LYS_IN_YANG, &mod));
+            "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
+            "leaf ifname{type leafref{ path \"../interface/name\";}}container c;"
+            "leaf address {type leafref{ path \"/interface[name=current()/../c]/ip\";}}}",
+            LYS_IN_YANG, &mod));
     logbuf_assert("Leaf expected instead of container \"c\" in leafref predicate in path. /zza:address");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module zzb {namespace urn:zzb;prefix zzb;"
-                                        "list interface{key name;leaf name{type string;}leaf ip {type string;}container c;}"
-                                        "leaf ifname{type leafref{ path \"../interface/name\";}}"
-                                        "leaf address {type leafref{ path \"/interface[c=current()/../ifname]/ip\";}}}",
-                                        LYS_IN_YANG, &mod));
+            "list interface{key name;leaf name{type string;}leaf ip {type string;}container c;}"
+            "leaf ifname{type leafref{ path \"../interface/name\";}}"
+            "leaf address {type leafref{ path \"/interface[c=current()/../ifname]/ip\";}}}",
+            LYS_IN_YANG, &mod));
     logbuf_assert("Key expected instead of container \"c\" in path. /zzb:address");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module zzc {namespace urn:zzc;prefix zzc;"
-                                        "leaf source {type leafref {path \"../target\";}default true;}}", LYS_IN_YANG, &mod));
+            "leaf source {type leafref {path \"../target\";}default true;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Not found node \"target\" in path. /zzc:source");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module zzd {namespace urn:zzd;prefix zzd;"
-                                        "leaf source {type leafref {path \"../target\";}default true;}"
-                                        "leaf target {type uint8;}}", LYS_IN_YANG, &mod));
+            "leaf source {type leafref {path \"../target\";}default true;}"
+            "leaf target {type uint8;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid default - value does not fit the type (Invalid uint8 value \"true\".). /zzd:source");
 
     /* circular chain */
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aaa {namespace urn:aaa;prefix aaa;"
-                                        "leaf ref1 {type leafref {path /ref2;}}"
-                                        "leaf ref2 {type leafref {path /ref3;}}"
-                                        "leaf ref3 {type leafref {path /ref4;}}"
-                                        "leaf ref4 {type leafref {path /ref1;}}}", LYS_IN_YANG, &mod));
+            "leaf ref1 {type leafref {path /ref2;}}"
+            "leaf ref2 {type leafref {path /ref3;}}"
+            "leaf ref3 {type leafref {path /ref4;}}"
+            "leaf ref4 {type leafref {path /ref1;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid leafref path \"/ref1\" - circular chain of leafrefs detected. /aaa:ref4");
 
     *state = NULL;
@@ -2003,11 +1996,11 @@
 
     /* invalid */
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa;"
-                                        "leaf l {type empty; default x;}}", LYS_IN_YANG, NULL));
+            "leaf l {type empty; default x;}}", LYS_IN_YANG, NULL));
     logbuf_assert("Invalid default - value does not fit the type (Invalid empty value \"x\".). /aa:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb;typedef mytype {type empty; default x;}"
-                                        "leaf l {type mytype;}}", LYS_IN_YANG, NULL));
+            "leaf l {type mytype;}}", LYS_IN_YANG, NULL));
     logbuf_assert("Invalid type \"mytype\" - \"empty\" type must not have a default value (x). /bb:l");
 
     *state = NULL;
@@ -2026,68 +2019,68 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {yang-version 1.1;namespace urn:a;prefix a; typedef mybasetype {type string;}"
-                                        "typedef mytype {type union {type int8; type mybasetype;}}"
-                                        "leaf l {type mytype;}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "typedef mytype {type union {type int8; type mybasetype;}}"
+            "leaf l {type mytype;}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(2, type->refcount);
     assert_int_equal(LY_TYPE_UNION, type->basetype);
-    assert_non_null(((struct lysc_type_union*)type)->types);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_union*)type)->types));
-    assert_int_equal(LY_TYPE_INT8, ((struct lysc_type_union*)type)->types[0]->basetype);
-    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_union*)type)->types[1]->basetype);
+    assert_non_null(((struct lysc_type_union *)type)->types);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_union *)type)->types));
+    assert_int_equal(LY_TYPE_INT8, ((struct lysc_type_union *)type)->types[0]->basetype);
+    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_union *)type)->types[1]->basetype);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {yang-version 1.1;namespace urn:b;prefix b; typedef mybasetype {type string;}"
-                                        "typedef mytype {type union {type int8; type mybasetype;}}"
-                                        "leaf l {type union {type decimal64 {fraction-digits 2;} type mytype;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "typedef mytype {type union {type int8; type mybasetype;}}"
+            "leaf l {type union {type decimal64 {fraction-digits 2;} type mytype;}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_UNION, type->basetype);
-    assert_non_null(((struct lysc_type_union*)type)->types);
-    assert_int_equal(3, LY_ARRAY_COUNT(((struct lysc_type_union*)type)->types));
-    assert_int_equal(LY_TYPE_DEC64, ((struct lysc_type_union*)type)->types[0]->basetype);
-    assert_int_equal(LY_TYPE_INT8, ((struct lysc_type_union*)type)->types[1]->basetype);
-    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_union*)type)->types[2]->basetype);
+    assert_non_null(((struct lysc_type_union *)type)->types);
+    assert_int_equal(3, LY_ARRAY_COUNT(((struct lysc_type_union *)type)->types));
+    assert_int_equal(LY_TYPE_DEC64, ((struct lysc_type_union *)type)->types[0]->basetype);
+    assert_int_equal(LY_TYPE_INT8, ((struct lysc_type_union *)type)->types[1]->basetype);
+    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_union *)type)->types[2]->basetype);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module c {yang-version 1.1;namespace urn:c;prefix c; typedef mybasetype {type string;}"
-                                        "typedef mytype {type union {type leafref {path ../target;} type mybasetype;}}"
-                                        "leaf l {type union {type decimal64 {fraction-digits 2;} type mytype;}}"
-                                        "leaf target {type leafref {path ../realtarget;}} leaf realtarget {type int8;}}",
-                                        LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "typedef mytype {type union {type leafref {path ../target;} type mybasetype;}}"
+            "leaf l {type union {type decimal64 {fraction-digits 2;} type mytype;}}"
+            "leaf target {type leafref {path ../realtarget;}} leaf realtarget {type int8;}}",
+            LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_UNION, type->basetype);
-    assert_non_null(((struct lysc_type_union*)type)->types);
-    assert_int_equal(3, LY_ARRAY_COUNT(((struct lysc_type_union*)type)->types));
-    assert_int_equal(LY_TYPE_DEC64, ((struct lysc_type_union*)type)->types[0]->basetype);
-    assert_int_equal(LY_TYPE_LEAFREF, ((struct lysc_type_union*)type)->types[1]->basetype);
-    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_union*)type)->types[2]->basetype);
-    assert_non_null(((struct lysc_type_leafref*)((struct lysc_type_union*)type)->types[1])->realtype);
-    assert_int_equal(LY_TYPE_INT8, ((struct lysc_type_leafref*)((struct lysc_type_union*)type)->types[1])->realtype->basetype);
+    assert_non_null(((struct lysc_type_union *)type)->types);
+    assert_int_equal(3, LY_ARRAY_COUNT(((struct lysc_type_union *)type)->types));
+    assert_int_equal(LY_TYPE_DEC64, ((struct lysc_type_union *)type)->types[0]->basetype);
+    assert_int_equal(LY_TYPE_LEAFREF, ((struct lysc_type_union *)type)->types[1]->basetype);
+    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_union *)type)->types[2]->basetype);
+    assert_non_null(((struct lysc_type_leafref *)((struct lysc_type_union *)type)->types[1])->realtype);
+    assert_int_equal(LY_TYPE_INT8, ((struct lysc_type_leafref *)((struct lysc_type_union *)type)->types[1])->realtype->basetype);
 
     /* invalid unions */
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa;typedef mytype {type union;}"
-                                        "leaf l {type mytype;}}", LYS_IN_YANG, &mod));
+            "leaf l {type mytype;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Missing type substatement for union type mytype. /aa:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb;leaf l {type union;}}", LYS_IN_YANG, &mod));
-   logbuf_assert("Missing type substatement for union type. /bb:l");
+    logbuf_assert("Missing type substatement for union type. /bb:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module cc {namespace urn:cc;prefix cc;typedef mytype {type union{type int8; type string;}}"
-                                        "leaf l {type mytype {type string;}}}", LYS_IN_YANG, &mod));
+            "leaf l {type mytype {type string;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid type substatement for the type not directly derived from union built-in type. /cc:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module dd {namespace urn:dd;prefix dd;typedef mytype {type union{type int8; type string;}}"
-                                        "typedef mytype2 {type mytype {type string;}}leaf l {type mytype2;}}", LYS_IN_YANG, &mod));
+            "typedef mytype2 {type mytype {type string;}}leaf l {type mytype2;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid type substatement for the type \"mytype2\" not directly derived from union built-in type. /dd:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ee {namespace urn:ee;prefix ee;typedef mytype {type union{type mytype; type string;}}"
-                                        "leaf l {type mytype;}}", LYS_IN_YANG, &mod));
+            "leaf l {type mytype;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid \"mytype\" type reference - circular chain of types detected. /ee:l");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ef {namespace urn:ef;prefix ef;typedef mytype {type mytype2;}"
-                                        "typedef mytype2 {type mytype;} leaf l {type mytype;}}", LYS_IN_YANG, &mod));
+            "typedef mytype2 {type mytype;} leaf l {type mytype;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid \"mytype\" type reference - circular chain of types detected. /ef:l");
 
     *state = NULL;
@@ -2109,79 +2102,79 @@
 
     /* default is not inherited from union's types */
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {namespace urn:a;prefix a; typedef mybasetype {type string;default hello;units xxx;}"
-                                        "leaf l {type union {type decimal64 {fraction-digits 2;} type mybasetype;}}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf l {type union {type decimal64 {fraction-digits 2;} type mybasetype;}}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(1, type->refcount);
     assert_int_equal(LY_TYPE_UNION, type->basetype);
-    assert_non_null(((struct lysc_type_union*)type)->types);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_union*)type)->types));
-    assert_int_equal(LY_TYPE_DEC64, ((struct lysc_type_union*)type)->types[0]->basetype);
-    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_union*)type)->types[1]->basetype);
-    assert_null(((struct lysc_node_leaf*)mod->compiled->data)->dflt);
-    assert_null(((struct lysc_node_leaf*)mod->compiled->data)->units);
+    assert_non_null(((struct lysc_type_union *)type)->types);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_union *)type)->types));
+    assert_int_equal(LY_TYPE_DEC64, ((struct lysc_type_union *)type)->types[0]->basetype);
+    assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_union *)type)->types[1]->basetype);
+    assert_null(((struct lysc_node_leaf *)mod->compiled->data)->dflt);
+    assert_null(((struct lysc_node_leaf *)mod->compiled->data)->units);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {namespace urn:b;prefix b; typedef mybasetype {type string;default hello;units xxx;}"
-                                        "leaf l {type mybasetype;}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf l {type mybasetype;}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(3, type->refcount); /* 2x type reference, 1x default value's reference (typedf's default does not reference own type)*/
     assert_int_equal(LY_TYPE_STRING, type->basetype);
-    assert_non_null(leaf = (struct lysc_node_leaf*)mod->compiled->data);
+    assert_non_null(leaf = (struct lysc_node_leaf *)mod->compiled->data);
     assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
     assert_string_equal("xxx", leaf->units);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module c {namespace urn:c;prefix c; typedef mybasetype {type string;default hello;units xxx;}"
-                                        "leaf l {type mybasetype; default goodbye;units yyy;}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf l {type mybasetype; default goodbye;units yyy;}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(3, type->refcount); /* 2x type reference, 1x default value's reference */
     assert_int_equal(LY_TYPE_STRING, type->basetype);
-    leaf = (struct lysc_node_leaf*)mod->compiled->data;
+    leaf = (struct lysc_node_leaf *)mod->compiled->data;
     assert_string_equal("goodbye", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
     assert_string_equal("yyy", leaf->units);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module d {namespace urn:d;prefix d; typedef mybasetype {type string;default hello;units xxx;}"
-                                        "typedef mytype {type mybasetype;}leaf l1 {type mytype; default goodbye;units yyy;}"
-                                        "leaf l2 {type mytype;}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "typedef mytype {type mybasetype;}leaf l1 {type mytype; default goodbye;units yyy;}"
+            "leaf l2 {type mytype;}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(6, type->refcount); /* 4x type reference, 2x default value's reference (1 shared compiled type of typedefs which default does not reference own type) */
     assert_int_equal(LY_TYPE_STRING, type->basetype);
-    leaf = (struct lysc_node_leaf*)mod->compiled->data;
+    leaf = (struct lysc_node_leaf *)mod->compiled->data;
     assert_string_equal("goodbye", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
     assert_string_equal("yyy", leaf->units);
-    type = ((struct lysc_node_leaf*)mod->compiled->data->next)->type;
+    type = ((struct lysc_node_leaf *)mod->compiled->data->next)->type;
     assert_non_null(type);
     assert_int_equal(6, type->refcount); /* 4x type reference, 2x default value's reference (1 shared compiled type of typedefs which default does not reference own type) */
     assert_int_equal(LY_TYPE_STRING, type->basetype);
-    leaf = (struct lysc_node_leaf*)mod->compiled->data->next;
+    leaf = (struct lysc_node_leaf *)mod->compiled->data->next;
     assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
     assert_string_equal("xxx", leaf->units);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module e {namespace urn:e;prefix e; typedef mybasetype {type string;}"
-                                        "typedef mytype {type mybasetype; default hello;units xxx;}leaf l {type mytype;}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "typedef mytype {type mybasetype; default hello;units xxx;}leaf l {type mytype;}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(4, type->refcount); /* 3x type reference, 1x default value's reference (typedef's default does not reference own type) */
     assert_int_equal(LY_TYPE_STRING, type->basetype);
-    leaf = (struct lysc_node_leaf*)mod->compiled->data;
+    leaf = (struct lysc_node_leaf *)mod->compiled->data;
     assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
     assert_string_equal("xxx", leaf->units);
 
     /* mandatory leaf does not takes default value from type */
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module f {namespace urn:f;prefix f;typedef mytype {type string; default hello;units xxx;}"
-                                        "leaf l {type mytype; mandatory true;}}", LYS_IN_YANG, &mod));
-    type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
+            "leaf l {type mytype; mandatory true;}}", LYS_IN_YANG, &mod));
+    type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
     assert_non_null(type);
     assert_int_equal(LY_TYPE_STRING, type->basetype);
-    assert_null(((struct lysc_node_leaf*)mod->compiled->data)->dflt);
-    assert_string_equal("xxx", ((struct lysc_node_leaf*)mod->compiled->data)->units);
+    assert_null(((struct lysc_node_leaf *)mod->compiled->data)->dflt);
+    assert_string_equal("xxx", ((struct lysc_node_leaf *)mod->compiled->data)->units);
 
     *state = NULL;
     ly_ctx_destroy(ctx, NULL);
@@ -2197,20 +2190,20 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa;"
-                            "container c {status deprecated; leaf l {status current; type string;}}}", LYS_IN_YANG, NULL));
+            "container c {status deprecated; leaf l {status current; type string;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("A \"current\" status is in conflict with the parent's \"deprecated\" status. /aa:c/l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb;"
-                            "container c {status obsolete; leaf l {status current; type string;}}}", LYS_IN_YANG, NULL));
+            "container c {status obsolete; leaf l {status current; type string;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("A \"current\" status is in conflict with the parent's \"obsolete\" status. /bb:c/l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module cc {namespace urn:cc;prefix cc;"
-                            "container c {status obsolete; leaf l {status deprecated; type string;}}}", LYS_IN_YANG, NULL));
+            "container c {status obsolete; leaf l {status deprecated; type string;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("A \"deprecated\" status is in conflict with the parent's \"obsolete\" status. /cc:c/l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module cc {namespace urn:dd;prefix d;"
-                            "container c {leaf l {status obsolete; type string;}}"
-                            "container d {leaf m {when \"../../c/l\"; type string;}}}", LYS_IN_YANG, NULL));
+            "container c {leaf l {status obsolete; type string;}}"
+            "container d {leaf m {when \"../../c/l\"; type string;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("A current definition \"m\" is not allowed to reference obsolete definition \"l\". /cc:d/m");
 
     *state = NULL;
@@ -2228,27 +2221,25 @@
 
     /* result ok, but a warning about not used locally scoped grouping printed */
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {namespace urn:a;prefix a; grouping grp1 {leaf a1 {type string;}}"
-                        "container a {leaf x {type string;} grouping grp2 {leaf a2 {type string;}}}}", LYS_IN_YANG, NULL));
+            "container a {leaf x {type string;} grouping grp2 {leaf a2 {type string;}}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Locally scoped grouping \"grp2\" not used.");
     logbuf_clean();
 
     /* result ok - when statement or leafref target must be checked only at the place where the grouping is really instantiated */
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {namespace urn:b;prefix b; grouping grp {"
-                                  "leaf ref {type leafref {path \"../name\";}}"
-                                  "leaf cond {type string; when \"../name = 'specialone'\";}}}", LYS_IN_YANG, NULL));
+            "leaf ref {type leafref {path \"../name\";}}"
+            "leaf cond {type string; when \"../name = 'specialone'\";}}}", LYS_IN_YANG, NULL));
     logbuf_assert("");
 
-
     /* invalid - error in a non-instantiated grouping */
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa;"
-                                        "grouping grp {leaf x {type leafref;}}}", LYS_IN_YANG, NULL));
+            "grouping grp {leaf x {type leafref;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Missing path substatement for leafref type. /aa:{grouping='grp'}/x");
     logbuf_clean();
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa;"
-                                        "container a {grouping grp {leaf x {type leafref;}}}}", LYS_IN_YANG, NULL));
+            "container a {grouping grp {leaf x {type leafref;}}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Missing path substatement for leafref type. /aa:a/{grouping='grp'}/x");
 
-
     *state = NULL;
     ly_ctx_destroy(ctx, NULL);
 }
@@ -2268,13 +2259,13 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "module grp {namespace urn:grp;prefix g; typedef mytype {type string;} feature f;"
-                              "grouping grp {leaf x {type mytype;} leaf y {type string; if-feature f;}}}");
+            "grouping grp {leaf x {type mytype;} leaf y {type string; if-feature f;}}}");
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module a {namespace urn:a;prefix a;import grp {prefix g;}"
-                                        "grouping grp_a_top {leaf a1 {type int8;}}"
-                                        "container a {uses grp_a; uses grp_a_top; uses g:grp; grouping grp_a {leaf a2 {type uint8;}}}}", LYS_IN_YANG, &mod));
+            "grouping grp_a_top {leaf a1 {type int8;}}"
+            "container a {uses grp_a; uses grp_a_top; uses g:grp; grouping grp_a {leaf a2 {type uint8;}}}}", LYS_IN_YANG, &mod));
     assert_non_null((parent = mod->compiled->data));
     assert_int_equal(LYS_CONTAINER, parent->nodetype);
-    assert_non_null((child = ((struct lysc_node_container*)parent)->child));
+    assert_non_null((child = ((struct lysc_node_container *)parent)->child));
     assert_string_equal("a2", child->name);
     assert_ptr_equal(mod, child->module);
     assert_non_null((child = child->next));
@@ -2305,8 +2296,8 @@
 
     logbuf_clean();
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module c {namespace urn:ii;prefix ii;"
-                                        "grouping grp {leaf l {type string;}leaf k {type string; status obsolete;}}"
-                                        "uses grp {status deprecated;}}", LYS_IN_YANG, &mod));
+            "grouping grp {leaf l {type string;}leaf k {type string; status obsolete;}}"
+            "uses grp {status deprecated;}}", LYS_IN_YANG, &mod));
     assert_int_equal(LYS_LEAF, mod->compiled->data->nodetype);
     assert_string_equal("l", mod->compiled->data->name);
     assert_true(LYS_STATUS_DEPRC & mod->compiled->data->flags);
@@ -2316,7 +2307,7 @@
     logbuf_assert(""); /* no warning about inheriting deprecated flag from uses */
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module d {namespace urn:d;prefix d; grouping grp {container g;}"
-                                        "container top {uses grp {augment g {leaf x {type int8;}}}}}", LYS_IN_YANG, &mod));
+            "container top {uses grp {augment g {leaf x {type int8;}}}}}", LYS_IN_YANG, &mod));
     assert_non_null(mod->compiled->data);
     assert_non_null(child = lysc_node_children(mod->compiled->data, 0));
     assert_string_equal("g", child->name);
@@ -2324,9 +2315,9 @@
     assert_string_equal("x", child->name);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module e {yang-version 1.1;namespace urn:e;prefix e; grouping grp {action g { description \"super g\";}}"
-                                        "container top {action e; uses grp {refine g {description \"ultra g\";}}}}", LYS_IN_YANG, &mod));
+            "container top {action e; uses grp {refine g {description \"ultra g\";}}}}", LYS_IN_YANG, &mod));
     assert_non_null(mod->compiled->data);
-    cont = (const struct lysc_node_container*)mod->compiled->data;
+    cont = (const struct lysc_node_container *)mod->compiled->data;
     assert_non_null(cont->actions);
     assert_int_equal(2, LY_ARRAY_COUNT(cont->actions));
     assert_string_equal("e", cont->actions[1].name);
@@ -2334,9 +2325,9 @@
     assert_string_equal("ultra g", cont->actions[0].dsc);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module f {yang-version 1.1;namespace urn:f;prefix f; grouping grp {notification g { description \"super g\";}}"
-                                        "container top {notification f; uses grp {refine g {description \"ultra g\";}}}}", LYS_IN_YANG, &mod));
+            "container top {notification f; uses grp {refine g {description \"ultra g\";}}}}", LYS_IN_YANG, &mod));
     assert_non_null(mod->compiled->data);
-    cont = (const struct lysc_node_container*)mod->compiled->data;
+    cont = (const struct lysc_node_container *)mod->compiled->data;
     assert_non_null(cont->notifs);
     assert_int_equal(2, LY_ARRAY_COUNT(cont->notifs));
     assert_string_equal("f", cont->notifs[1].name);
@@ -2349,9 +2340,9 @@
 
     /* choice in uses */
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module h {yang-version 1.1;namespace urn:h;prefix h; grouping grp {choice gch {case gc1 { leaf y { type string;}} case gc2 {leaf z {type string;}}}}"
-                                        "choice ch {case one { leaf x {type string;}} case two { uses grp;}}}", LYS_IN_YANG, &mod));
+            "choice ch {case one { leaf x {type string;}} case two { uses grp;}}}", LYS_IN_YANG, &mod));
     assert_non_null(mod->compiled->data);
-    choice = (const struct lysc_node_choice*)mod->compiled->data;
+    choice = (const struct lysc_node_choice *)mod->compiled->data;
     assert_string_equal("ch", choice->name);
     cs = choice->cases;
     assert_non_null(cs);
@@ -2367,8 +2358,8 @@
 
     /* top-level uses with augment and refine */
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module i {namespace urn:i;prefix i; grouping grp {container g;}"
-                                        "uses grp {augment g {leaf x {type int8;}} refine g {description \"dsc\";}}}",
-                                        LYS_IN_YANG, &mod));
+            "uses grp {augment g {leaf x {type int8;}} refine g {description \"dsc\";}}}",
+            LYS_IN_YANG, &mod));
     assert_non_null(mod->compiled->data);
     child = mod->compiled->data;
     assert_string_equal("g", child->name);
@@ -2382,48 +2373,47 @@
     logbuf_assert("Grouping \"missinggrp\" referenced by a uses statement not found. /aa:{uses='missinggrp'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb;uses grp;"
-                                        "grouping grp {leaf a{type string;}uses grp1;}"
-                                        "grouping grp1 {leaf b {type string;}uses grp2;}"
-                                        "grouping grp2 {leaf c {type string;}uses grp;}}", LYS_IN_YANG, &mod));
+            "grouping grp {leaf a{type string;}uses grp1;}"
+            "grouping grp1 {leaf b {type string;}uses grp2;}"
+            "grouping grp2 {leaf c {type string;}uses grp;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Grouping \"grp\" references itself through a uses statement. /bb:{uses='grp'}/{uses='grp1'}/{uses='grp2'}/{uses='grp'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module cc {namespace urn:cc;prefix cc;uses a:missingprefix;}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid prefix used for grouping reference. /cc:{uses='a:missingprefix'}");
 
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, "module dd {namespace urn:dd;prefix dd;grouping grp{leaf a{type string;}}"
-                                        "leaf a {type string;}uses grp;}", LYS_IN_YANG, &mod));
+            "leaf a {type string;}uses grp;}", LYS_IN_YANG, &mod));
     logbuf_assert("Duplicate identifier \"a\" of data definition/RPC/action/notification statement. /dd:{uses='grp'}/dd:a");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ee {namespace urn:ee;prefix ee;grouping grp {leaf l {type string; status deprecated;}}"
-                                        "uses grp {status obsolete;}}", LYS_IN_YANG, &mod));
+            "uses grp {status obsolete;}}", LYS_IN_YANG, &mod));
     logbuf_assert("A \"deprecated\" status is in conflict with the parent's \"obsolete\" status. /ee:{uses='grp'}/ee:l");
 
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, "module ff {namespace urn:ff;prefix ff;grouping grp {leaf l {type string;}}"
-                                        "leaf l {type int8;}uses grp;}", LYS_IN_YANG, &mod));
+            "leaf l {type int8;}uses grp;}", LYS_IN_YANG, &mod));
     logbuf_assert("Duplicate identifier \"l\" of data definition/RPC/action/notification statement. /ff:{uses='grp'}/ff:l");
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, "module fg {namespace urn:fg;prefix fg;grouping grp {leaf m {type string;}}"
-                                        "uses grp;leaf m {type int8;}}", LYS_IN_YANG, &mod));
+            "uses grp;leaf m {type int8;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Duplicate identifier \"m\" of data definition/RPC/action/notification statement. /fg:m");
 
-
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module gg {namespace urn:gg;prefix gg; grouping grp {container g;}"
-                              "leaf g {type string;}"
-                              "container top {uses grp {augment /g {leaf x {type int8;}}}}}", LYS_IN_YANG, &mod));
+            "leaf g {type string;}"
+            "container top {uses grp {augment /g {leaf x {type int8;}}}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid descendant-schema-nodeid value \"/g\" - name test expected instead of \"/\". /gg:top/{uses='grp'}/{augment='/g'}");
 
     assert_int_equal(LY_ENOTFOUND, lys_parse_mem(ctx, "module hh {yang-version 1.1;namespace urn:hh;prefix hh;"
-                                        "grouping grp {notification g { description \"super g\";}}"
-                                        "container top {notification h; uses grp {refine h {description \"ultra h\";}}}}", LYS_IN_YANG, &mod));
+            "grouping grp {notification g { description \"super g\";}}"
+            "container top {notification h; uses grp {refine h {description \"ultra h\";}}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Refine(s) target node \"h\" in grouping \"grp\" was not found. /hh:top/{uses='grp'}");
 
     assert_int_equal(LY_ENOTFOUND, lys_parse_mem(ctx, "module ii {yang-version 1.1;namespace urn:ii;prefix ii;"
-                                        "grouping grp {action g { description \"super g\";}}"
-                                        "container top {action i; uses grp {refine i {description \"ultra i\";}}}}", LYS_IN_YANG, &mod));
+            "grouping grp {action g { description \"super g\";}}"
+            "container top {action i; uses grp {refine i {description \"ultra i\";}}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Refine(s) target node \"i\" in grouping \"grp\" was not found. /ii:top/{uses='grp'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module jj {yang-version 1.1;namespace urn:jj;prefix jj;"
-                              "grouping grp {leaf j { when \"1\"; type invalid;}}"
-                              "container top {uses grp;}}", LYS_IN_YANG, &mod));
+            "grouping grp {leaf j { when \"1\"; type invalid;}}"
+            "container top {uses grp;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Referenced type \"invalid\" not found. /jj:top/{uses='grp'}/j");
 
     *state = NULL;
@@ -2447,23 +2437,23 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     data = "module grp {yang-version 1.1;namespace urn:grp;prefix g; feature f;typedef mytype {type string; default cheers!;}"
-                                       "grouping grp {container c {leaf l {type mytype; default goodbye;}"
-                                       "leaf-list ll {type mytype; default goodbye; max-elements 6;}"
-                                       "choice ch {default ca; leaf ca {type int8;}leaf cb{type uint8;}}"
-                                       "leaf x {type mytype; mandatory true; must 1;}"
-                                       "anydata a {mandatory false; if-feature f; description original; reference original;}"
-                                       "container c {config false; leaf l {type string;}}}}}";
+            "grouping grp {container c {leaf l {type mytype; default goodbye;}"
+            "leaf-list ll {type mytype; default goodbye; max-elements 6;}"
+            "choice ch {default ca; leaf ca {type int8;}leaf cb{type uint8;}}"
+            "leaf x {type mytype; mandatory true; must 1;}"
+            "anydata a {mandatory false; if-feature f; description original; reference original;}"
+            "container c {config false; leaf l {type string;}}}}}";
     assert_int_equal(LY_SUCCESS, ly_in_new_memory(data, &in));
     assert_int_equal(LY_SUCCESS, lys_parse(ctx, in, LYS_IN_YANG, feats1, NULL));
 
     data = "module a {yang-version 1.1;namespace urn:a;prefix a;import grp {prefix g;}feature fa;"
-                                        "uses g:grp {refine c/l {default hello; config false;}"
-                                        "refine c/ll {default hello;default world;}"
-                                        "refine c/ch {default cb;config true; if-feature fa;}"
-                                        "refine c/x {mandatory false; must ../ll;description refined; reference refined;}"
-                                        "refine c/a {mandatory true; must 1; description refined; reference refined;}"
-                                        "refine c/ll {max-elements 5;}"
-                                        "refine c/c {config true;presence indispensable;}}}";
+            "uses g:grp {refine c/l {default hello; config false;}"
+            "refine c/ll {default hello;default world;}"
+            "refine c/ch {default cb;config true; if-feature fa;}"
+            "refine c/x {mandatory false; must ../ll;description refined; reference refined;}"
+            "refine c/a {mandatory true; must 1; description refined; reference refined;}"
+            "refine c/ll {max-elements 5;}"
+            "refine c/c {config true;presence indispensable;}}}";
     ly_in_memory(in, data);
     assert_int_equal(LY_SUCCESS, lys_parse(ctx, in, LYS_IN_YANG, feats2, &mod));
     ly_in_free(in, 0);
@@ -2471,13 +2461,13 @@
     assert_non_null((parent = mod->compiled->data));
     assert_int_equal(LYS_CONTAINER, parent->nodetype);
     assert_string_equal("c", parent->name);
-    assert_non_null((leaf = (struct lysc_node_leaf*)((struct lysc_node_container*)parent)->child));
+    assert_non_null((leaf = (struct lysc_node_leaf *)((struct lysc_node_container *)parent)->child));
     assert_int_equal(LYS_LEAF, leaf->nodetype);
     assert_string_equal("l", leaf->name);
     assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
     assert_int_equal(LYS_CONFIG_R, leaf->flags & LYS_CONFIG_MASK);
-    assert_non_null(llist = (struct lysc_node_leaflist*)leaf->next);
+    assert_non_null(llist = (struct lysc_node_leaflist *)leaf->next);
     assert_int_equal(LYS_LEAFLIST, llist->nodetype);
     assert_string_equal("ll", llist->name);
     assert_int_equal(2, LY_ARRAY_COUNT(llist->dflts));
@@ -2489,10 +2479,10 @@
     assert_non_null(child = llist->next);
     assert_int_equal(LYS_CHOICE, child->nodetype);
     assert_string_equal("ch", child->name);
-    assert_string_equal("cb", ((struct lysc_node_choice*)child)->dflt->name);
-    assert_true(LYS_SET_DFLT & ((struct lysc_node_choice*)child)->dflt->flags);
-    assert_false(LYS_SET_DFLT & ((struct lysc_node_choice*)child)->cases[0].flags);
-    assert_non_null(leaf = (struct lysc_node_leaf*)child->next);
+    assert_string_equal("cb", ((struct lysc_node_choice *)child)->dflt->name);
+    assert_true(LYS_SET_DFLT & ((struct lysc_node_choice *)child)->dflt->flags);
+    assert_false(LYS_SET_DFLT & ((struct lysc_node_choice *)child)->cases[0].flags);
+    assert_non_null(leaf = (struct lysc_node_leaf *)child->next);
     assert_int_equal(LYS_LEAF, leaf->nodetype);
     assert_string_equal("x", leaf->name);
     assert_false(LYS_MAND_TRUE & leaf->flags);
@@ -2506,8 +2496,8 @@
     assert_int_equal(LYS_ANYDATA, child->nodetype);
     assert_string_equal("a", child->name);
     assert_true(LYS_MAND_TRUE & child->flags);
-    assert_non_null(((struct lysc_node_anydata*)child)->musts);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_node_anydata*)child)->musts));
+    assert_non_null(((struct lysc_node_anydata *)child)->musts);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_node_anydata *)child)->musts));
     assert_string_equal("refined", child->dsc);
     assert_string_equal("refined", child->ref);
     assert_non_null(child = child->next);
@@ -2515,11 +2505,11 @@
     assert_string_equal("c", child->name);
     assert_true(LYS_PRESENCE & child->flags);
     assert_true(LYS_CONFIG_W & child->flags);
-    assert_true(LYS_CONFIG_W & ((struct lysc_node_container*)child)->child->flags);
+    assert_true(LYS_CONFIG_W & ((struct lysc_node_container *)child)->child->flags);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {yang-version 1.1;namespace urn:b;prefix b;import grp {prefix g;}"
-                                        "uses g:grp {status deprecated; refine c/x {default hello; mandatory false;}}}", LYS_IN_YANG, &mod));
-    assert_non_null((leaf = (struct lysc_node_leaf*)((struct lysc_node_container*)mod->compiled->data)->child->prev->prev->prev));
+            "uses g:grp {status deprecated; refine c/x {default hello; mandatory false;}}}", LYS_IN_YANG, &mod));
+    assert_non_null((leaf = (struct lysc_node_leaf *)((struct lysc_node_container *)mod->compiled->data)->child->prev->prev->prev));
     assert_int_equal(LYS_LEAF, leaf->nodetype);
     assert_string_equal("x", leaf->name);
     assert_false(LYS_MAND_TRUE & leaf->flags);
@@ -2528,64 +2518,64 @@
 
     /* invalid */
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa;import grp {prefix g;}"
-                                        "uses g:grp {refine c {default hello;}}}", LYS_IN_YANG, &mod));
+            "uses g:grp {refine c {default hello;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid refine of container node - it is not possible to replace \"default\" property. /aa:{uses='g:grp'}/aa:c/{refine='c'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb;import grp {prefix g;}"
-                                        "uses g:grp {refine c/l {default hello; default world;}}}", LYS_IN_YANG, &mod));
+            "uses g:grp {refine c/l {default hello; default world;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid refine of leaf with too many (2) default properties. /bb:{uses='g:grp'}/bb:c/l/{refine='c/l'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module cc {namespace urn:cc;prefix cc;import grp {prefix g;}"
-                                        "uses g:grp {refine c/ll {default hello; default world;}}}", LYS_IN_YANG, &mod));
+            "uses g:grp {refine c/ll {default hello; default world;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid refine of default in leaf-list - the default statement is allowed only in YANG 1.1 modules. /cc:{uses='g:grp'}/cc:c/ll/{refine='c/ll'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module dd {namespace urn:dd;prefix dd;import grp {prefix g;}"
-                                        "uses g:grp {refine c/ll {mandatory true;}}}", LYS_IN_YANG, &mod));
+            "uses g:grp {refine c/ll {mandatory true;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid refine of leaf-list node - it is not possible to replace \"mandatory\" property. /dd:{uses='g:grp'}/dd:c/ll/{refine='c/ll'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ee {namespace urn:ee;prefix ee;import grp {prefix g;}"
-                                        "uses g:grp {refine c/l {mandatory true;}}}", LYS_IN_YANG, &mod));
-    //logbuf_assert("Invalid refine of mandatory - leaf already has \"default\" statement. /ee:{uses='g:grp'}/{refine='c/l'}");
+            "uses g:grp {refine c/l {mandatory true;}}}", LYS_IN_YANG, &mod));
+    // logbuf_assert("Invalid refine of mandatory - leaf already has \"default\" statement. /ee:{uses='g:grp'}/{refine='c/l'}");
     logbuf_assert("Compilation of a deviated and/or refined node failed. /ee:{uses='g:grp'}/ee:c/l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ef {namespace urn:ef;prefix ef;import grp {prefix g;}"
-                                        "uses g:grp {refine c/ch {mandatory true;}}}", LYS_IN_YANG, &mod));
-    //logbuf_assert("Invalid refine of mandatory - choice already has \"default\" statement. /ef:{uses='g:grp'}/{refine='c/ch'}");
+            "uses g:grp {refine c/ch {mandatory true;}}}", LYS_IN_YANG, &mod));
+    // logbuf_assert("Invalid refine of mandatory - choice already has \"default\" statement. /ef:{uses='g:grp'}/{refine='c/ch'}");
     logbuf_assert("Compilation of a deviated and/or refined node failed. /ef:{uses='g:grp'}/ef:c/ch");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ff {namespace urn:ff;prefix ff;import grp {prefix g;}"
-                                        "uses g:grp {refine c/ch/ca/ca {mandatory true;}}}", LYS_IN_YANG, &mod));
+            "uses g:grp {refine c/ch/ca/ca {mandatory true;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Mandatory node \"ca\" under the default case \"ca\". /ff:{uses='g:grp'}/ff:c/ch");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module gg {namespace urn:gg;prefix gg;import grp {prefix g;}"
-                                        "uses g:grp {refine c/x {default hello;}}}", LYS_IN_YANG, &mod));
-    //logbuf_assert("Invalid refine of default - the node is mandatory. /gg:{uses='g:grp'}/{refine='c/x'}");
+            "uses g:grp {refine c/x {default hello;}}}", LYS_IN_YANG, &mod));
+    // logbuf_assert("Invalid refine of default - the node is mandatory. /gg:{uses='g:grp'}/{refine='c/x'}");
     logbuf_assert("Compilation of a deviated and/or refined node failed. /gg:{uses='g:grp'}/gg:c/x");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module hh {namespace urn:hh;prefix hh;import grp {prefix g;}"
-                                        "uses g:grp {refine c/c/l {config true;}}}", LYS_IN_YANG, &mod));
-    //logbuf_assert("Invalid refine of config - configuration node cannot be child of any state data node. /hh:{uses='g:grp'}/{refine='c/c/l'}");
+            "uses g:grp {refine c/c/l {config true;}}}", LYS_IN_YANG, &mod));
+    // logbuf_assert("Invalid refine of config - configuration node cannot be child of any state data node. /hh:{uses='g:grp'}/{refine='c/c/l'}");
     logbuf_assert("Compilation of a deviated and/or refined node failed. /hh:{uses='g:grp'}/hh:c/c/l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ii {namespace urn:ii;prefix ii;grouping grp {leaf l {type string; status deprecated;}}"
-                                        "uses grp {status obsolete;}}", LYS_IN_YANG, &mod));
+            "uses grp {status obsolete;}}", LYS_IN_YANG, &mod));
     logbuf_assert("A \"deprecated\" status is in conflict with the parent's \"obsolete\" status. /ii:{uses='grp'}/ii:l");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module jj {namespace urn:jj;prefix jj;import grp {prefix g;}"
-                                        "uses g:grp {refine c/x {presence nonsence;}}}", LYS_IN_YANG, &mod));
+            "uses g:grp {refine c/x {presence nonsence;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid refine of leaf node - it is not possible to replace \"presence\" property. /jj:{uses='g:grp'}/jj:c/x/{refine='c/x'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module kk {namespace urn:kk;prefix kk;import grp {prefix g;}"
-                                        "uses g:grp {refine c/ch {must 1;}}}", LYS_IN_YANG, &mod));
+            "uses g:grp {refine c/ch {must 1;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid refine of choice node - it is not possible to add \"must\" property. /kk:{uses='g:grp'}/kk:c/ch/{refine='c/ch'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ll {namespace urn:ll;prefix ll;import grp {prefix g;}"
-                                        "uses g:grp {refine c/x {min-elements 1;}}}", LYS_IN_YANG, &mod));
+            "uses g:grp {refine c/x {min-elements 1;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid refine of leaf node - it is not possible to replace \"min-elements\" property. /ll:{uses='g:grp'}/ll:c/x/{refine='c/x'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module mm {namespace urn:mm;prefix mm;import grp {prefix g;}"
-                                        "uses g:grp {refine c/ll {min-elements 10;}}}", LYS_IN_YANG, &mod));
-    //logbuf_assert("Invalid refine of min-elements statement - \"min-elements\" is bigger than \"max-elements\". /mm:{uses='g:grp'}/{refine='c/ll'}");
+            "uses g:grp {refine c/ll {min-elements 10;}}}", LYS_IN_YANG, &mod));
+    // logbuf_assert("Invalid refine of min-elements statement - \"min-elements\" is bigger than \"max-elements\". /mm:{uses='g:grp'}/{refine='c/ll'}");
     logbuf_assert("Compilation of a deviated and/or refined node failed. /mm:{uses='g:grp'}/mm:c/ll");
 
     *state = NULL;
@@ -2609,13 +2599,13 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "module a {namespace urn:a;prefix a; typedef atype {type string;}"
-                              "container top {leaf a {type string;}}}");
+            "container top {leaf a {type string;}}}");
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {namespace urn:b;prefix b;import a {prefix a;}"
-                                  "leaf b {type a:atype;}}", LYS_IN_YANG, &mod));
+            "leaf b {type a:atype;}}", LYS_IN_YANG, &mod));
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "module c {namespace urn:c;prefix c; import a {prefix a;}"
-                              "augment /a:top { container c {leaf c {type a:atype;}}}}");
+            "augment /a:top { container c {leaf c {type a:atype;}}}}");
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module d {namespace urn:d;prefix d;import a {prefix a;} import c {prefix c;}"
-                                  "augment /a:top/c:c { leaf d {type a:atype;} leaf c {type string;}}}", LYS_IN_YANG, &mod));
+            "augment /a:top/c:c { leaf d {type a:atype;} leaf c {type string;}}}", LYS_IN_YANG, &mod));
     assert_non_null((mod = ly_ctx_get_module_implemented(ctx, "a")));
     assert_non_null(ly_ctx_get_module_implemented(ctx, "b"));
     assert_non_null(ly_ctx_get_module_implemented(ctx, "c"));
@@ -2634,9 +2624,9 @@
     assert_string_equal(node->name, "c");
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module e {namespace urn:e;prefix e;choice ch {leaf a {type string;}}"
-                    "augment /ch/c {when 1; leaf lc2 {type uint16;}}"
-                    "augment /ch { when 1; leaf b {type int8;} case c {leaf lc1 {type uint8;}}}}", LYS_IN_YANG, &mod));
-    assert_non_null((ch = (const struct lysc_node_choice*)mod->compiled->data));
+            "augment /ch/c {when 1; leaf lc2 {type uint16;}}"
+            "augment /ch { when 1; leaf b {type int8;} case c {leaf lc1 {type uint8;}}}}", LYS_IN_YANG, &mod));
+    assert_non_null((ch = (const struct lysc_node_choice *)mod->compiled->data));
     assert_null(mod->compiled->data->next);
     assert_string_equal("ch", ch->name);
 
@@ -2645,50 +2635,50 @@
     assert_non_null(c->when);
     assert_string_equal("b", c->child->name);
 
-    assert_non_null(c = (const struct lysc_node_case*)c->next);
+    assert_non_null(c = (const struct lysc_node_case *)c->next);
     assert_string_equal("c", c->name);
     assert_non_null(c->when);
-    assert_string_equal("lc2", ((const struct lysc_node_case*)c)->child->name);
-    assert_non_null(((const struct lysc_node_case*)c)->child->when);
-    assert_string_equal("lc1", ((const struct lysc_node_case*)c)->child->next->name);
-    assert_null(((const struct lysc_node_case*)c)->child->next->when);
+    assert_string_equal("lc2", ((const struct lysc_node_case *)c)->child->name);
+    assert_non_null(((const struct lysc_node_case *)c)->child->when);
+    assert_string_equal("lc1", ((const struct lysc_node_case *)c)->child->next->name);
+    assert_null(((const struct lysc_node_case *)c)->child->next->when);
 
-    assert_non_null(c = (const struct lysc_node_case*)c->next);
+    assert_non_null(c = (const struct lysc_node_case *)c->next);
     assert_string_equal("a", c->name);
     assert_null(c->when);
     assert_string_equal("a", c->child->name);
     assert_null(c->next);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module f {namespace urn:f;prefix f;grouping g {leaf a {type string;}}"
-                                         "container c;"
-                                         "augment /c {uses g;}}", LYS_IN_YANG, &mod));
+            "container c;"
+            "augment /c {uses g;}}", LYS_IN_YANG, &mod));
     assert_non_null(node = lysc_node_children(mod->compiled->data, 0));
     assert_string_equal(node->name, "a");
 
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "submodule gsub {belongs-to g {prefix g;}"
-                                  "augment /c {container sub;}}");
+            "augment /c {container sub;}}");
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module g {namespace urn:g;prefix g;include gsub; container c;"
-                                        "augment /c/sub {leaf main {type string;}}}", LYS_IN_YANG, &mod));
+            "augment /c/sub {leaf main {type string;}}}", LYS_IN_YANG, &mod));
     assert_non_null(mod->compiled->data);
     assert_string_equal("c", mod->compiled->data->name);
-    assert_non_null(node = ((struct lysc_node_container*)mod->compiled->data)->child);
+    assert_non_null(node = ((struct lysc_node_container *)mod->compiled->data)->child);
     assert_string_equal("sub", node->name);
-    assert_non_null(node = ((struct lysc_node_container*)node)->child);
+    assert_non_null(node = ((struct lysc_node_container *)node)->child);
     assert_string_equal("main", node->name);
 
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "module himp {namespace urn:hi;prefix hi;container top; rpc func;}");
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module h {namespace urn:h;prefix h;import himp {prefix hi;}container top;"
-                                        "augment /hi:top {container p {presence XXX; leaf x {mandatory true;type string;}}}"
-                                        "augment /hi:top {list ll {key x;leaf x {type string;}leaf y {mandatory true; type string;}}}"
-                                        "augment /hi:top {leaf l {type string; mandatory true; config false;}}"
-                                        "augment /top {leaf l {type string; mandatory true;}}}", LYS_IN_YANG, &mod));
+            "augment /hi:top {container p {presence XXX; leaf x {mandatory true;type string;}}}"
+            "augment /hi:top {list ll {key x;leaf x {type string;}leaf y {mandatory true; type string;}}}"
+            "augment /hi:top {leaf l {type string; mandatory true; config false;}}"
+            "augment /top {leaf l {type string; mandatory true;}}}", LYS_IN_YANG, &mod));
     assert_non_null(node = mod->compiled->data);
-    assert_non_null(node = ((struct lysc_node_container*)node)->child);
+    assert_non_null(node = ((struct lysc_node_container *)node)->child);
     assert_string_equal("l", node->name);
     assert_true(node->flags & LYS_MAND_TRUE);
     assert_non_null(mod = ly_ctx_get_module_implemented(ctx, "himp"));
     assert_non_null(node = mod->compiled->data);
-    assert_non_null(node = ((struct lysc_node_container*)node)->child);
+    assert_non_null(node = ((struct lysc_node_container *)node)->child);
     assert_string_equal("p", node->name);
     assert_non_null(node = node->next);
     assert_string_equal("ll", node->name);
@@ -2697,8 +2687,8 @@
     assert_true(node->flags & LYS_CONFIG_R);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module i {namespace urn:i;prefix i;import himp {prefix hi;}"
-                                        "augment /hi:func/hi:input {leaf x {type string;}}"
-                                        "augment /hi:func/hi:output {leaf y {type string;}}}", LYS_IN_YANG, NULL));
+            "augment /hi:func/hi:input {leaf x {type string;}}"
+            "augment /hi:func/hi:output {leaf y {type string;}}}", LYS_IN_YANG, NULL));
     assert_non_null(mod = ly_ctx_get_module_implemented(ctx, "himp"));
     assert_non_null(rpc = mod->compiled->rpcs);
     assert_int_equal(1, LY_ARRAY_COUNT(rpc));
@@ -2710,48 +2700,48 @@
     assert_null(rpc->output.data->next);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module j {namespace urn:j;prefix j;yang-version 1.1; container root;"
-                                        "grouping grp {notification grp-notif;}"
-                                        "augment /root {uses grp;}}", LYS_IN_YANG, &mod));
-    assert_non_null(cont = (const struct lysc_node_container*)mod->compiled->data);
+            "grouping grp {notification grp-notif;}"
+            "augment /root {uses grp;}}", LYS_IN_YANG, &mod));
+    assert_non_null(cont = (const struct lysc_node_container *)mod->compiled->data);
     assert_null(cont->child);
     assert_non_null(notif = cont->notifs);
     assert_int_equal(1, LY_ARRAY_COUNT(notif));
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; container c {leaf a {type string;}}"
-                                        "augment /x/ {leaf a {type int8;}}}", LYS_IN_YANG, &mod));
+            "augment /x/ {leaf a {type int8;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid absolute-schema-nodeid value \"/x/\" - unexpected end of expression. /aa:{augment='/x/'}");
 
     assert_int_equal(LY_ENOTFOUND, lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; container c {leaf a {type string;}}"
-                                        "augment /x {leaf a {type int8;}}}", LYS_IN_YANG, &mod));
+            "augment /x {leaf a {type int8;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Augment target node \"/x\" from module \"aa\" was not found.");
 
     assert_int_equal(LY_EEXIST, lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb; container c {leaf a {type string;}}"
-                                        "augment /c {leaf a {type int8;}}}", LYS_IN_YANG, &mod));
+            "augment /c {leaf a {type int8;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Duplicate identifier \"a\" of data definition/RPC/action/notification statement. /bb:c/a");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module cc {namespace urn:cc;prefix cc; container c {leaf a {type string;}}"
-                                        "augment /c/a {leaf a {type int8;}}}", LYS_IN_YANG, &mod));
+            "augment /c/a {leaf a {type int8;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Augment's absolute-schema-nodeid \"/c/a\" refers to a leaf node which is not an allowed augment's target. /cc:{augment='/c/a'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module dd {namespace urn:dd;prefix dd; container c {leaf a {type string;}}"
-                                        "augment /c {case b {leaf d {type int8;}}}}", LYS_IN_YANG, &mod));
+            "augment /c {case b {leaf d {type int8;}}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid augment of container node which is not allowed to contain case node \"b\". /dd:{augment='/c'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ee {namespace urn:ee;prefix ee; import himp {prefix hi;}"
-                                        "augment /hi:top {container c {leaf d {mandatory true; type int8;}}}}", LYS_IN_YANG, &mod));
+            "augment /hi:top {container c {leaf d {mandatory true; type int8;}}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid augment adding mandatory node \"c\" without making it conditional via when statement. /ee:{augment='/hi:top'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ff {namespace urn:ff;prefix ff; container top;"
-                                        "augment ../top {leaf x {type int8;}}}", LYS_IN_YANG, &mod));
+            "augment ../top {leaf x {type int8;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid absolute-schema-nodeid value \"../top\" - \"/\" expected instead of \"..\". /ff:{augment='../top'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module gg {namespace urn:gg;prefix gg; rpc func;"
-                                        "augment /func {leaf x {type int8;}}}", LYS_IN_YANG, &mod));
+            "augment /func {leaf x {type int8;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Augment's absolute-schema-nodeid \"/func\" refers to a RPC node which is not an allowed augment's target. /gg:{augment='/func'}");
 
     assert_int_equal(LY_ENOTFOUND, lys_parse_mem(ctx, "module hh {namespace urn:i;prefix i;import himp {prefix hi;}"
-                                        "augment /hi:func/input {leaf x {type string;}}"
-                                        "augment /hi:func/output {leaf y {type string;}}}", LYS_IN_YANG, NULL));
+            "augment /hi:func/input {leaf x {type string;}}"
+            "augment /hi:func/output {leaf y {type string;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Invalid absolute-schema-nodeid value \"/hi:func/input\" - target node not found. /hh:{augment='/hi:func/input'}");
 
     *state = NULL;
@@ -2775,21 +2765,21 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "module a {namespace urn:a;prefix a;"
-                              "container top {leaf a {type string;} leaf b {type string;} leaf c {type string;}}"
-                              "choice ch {default c; case b {leaf b{type string;}} case a {leaf a{type string;} leaf x {type string;}}"
-                              " case c {leaf c{type string;}}}"
-                              "rpc func1 { input { leaf x {type int8;}} output {leaf y {type int8;}}}"
-                              "rpc func2;}");
+            "container top {leaf a {type string;} leaf b {type string;} leaf c {type string;}}"
+            "choice ch {default c; case b {leaf b{type string;}} case a {leaf a{type string;} leaf x {type string;}}"
+            " case c {leaf c{type string;}}}"
+            "rpc func1 { input { leaf x {type int8;}} output {leaf y {type int8;}}}"
+            "rpc func2;}");
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module b {namespace urn:b;prefix b;import a {prefix a;}"
-                                  "deviation /a:top/a:b {deviate not-supported;}"
-                                  "deviation /a:ch/a:a/a:x {deviate not-supported;}"
-                                  "deviation /a:ch/a:c {deviate not-supported;}"
-                                  "deviation /a:ch/a:b {deviate not-supported;}"
-                                  "deviation /a:ch/a:a/a:a {deviate not-supported;}"
-                                  "deviation /a:ch {deviate replace {default a;}}"
-                                  "deviation /a:func1/a:input {deviate not-supported;}"
-                                  "deviation /a:func1/a:output {deviate not-supported;}"
-                                  "deviation /a:func2 {deviate not-supported;}}", LYS_IN_YANG, NULL));
+            "deviation /a:top/a:b {deviate not-supported;}"
+            "deviation /a:ch/a:a/a:x {deviate not-supported;}"
+            "deviation /a:ch/a:c {deviate not-supported;}"
+            "deviation /a:ch/a:b {deviate not-supported;}"
+            "deviation /a:ch/a:a/a:a {deviate not-supported;}"
+            "deviation /a:ch {deviate replace {default a;}}"
+            "deviation /a:func1/a:input {deviate not-supported;}"
+            "deviation /a:func1/a:output {deviate not-supported;}"
+            "deviation /a:func2 {deviate not-supported;}}", LYS_IN_YANG, NULL));
     assert_non_null((mod = ly_ctx_get_module_implemented(ctx, "a")));
     assert_non_null(node = mod->compiled->data);
     assert_string_equal(node->name, "top");
@@ -2800,93 +2790,93 @@
     assert_null(node = node->next);
     assert_non_null(node = mod->compiled->data->next);
     assert_string_equal("ch", node->name);
-    assert_non_null(((struct lysc_node_choice*)node)->dflt);
-    assert_non_null(((struct lysc_node_choice*)node)->cases);
-    assert_null(((struct lysc_node_choice*)node)->cases->next);
+    assert_non_null(((struct lysc_node_choice *)node)->dflt);
+    assert_non_null(((struct lysc_node_choice *)node)->cases);
+    assert_null(((struct lysc_node_choice *)node)->cases->next);
     assert_int_equal(1, LY_ARRAY_COUNT(mod->compiled->rpcs));
     assert_null(mod->compiled->rpcs[0].input.data);
     assert_null(mod->compiled->rpcs[0].output.data);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module c {namespace urn:c;prefix c; typedef mytype {type string; units kilometers;}"
-                                        "leaf c1 {type mytype;} leaf c2 {type mytype; units meters;} leaf c3 {type mytype; units meters;}"
-                                        "deviation /c1 {deviate add {units meters;}}"
-                                        "deviation /c2 {deviate delete {units meters;}}"
-                                        "deviation /c3 {deviate replace {units centimeters;}}}", LYS_IN_YANG, &mod));
+            "leaf c1 {type mytype;} leaf c2 {type mytype; units meters;} leaf c3 {type mytype; units meters;}"
+            "deviation /c1 {deviate add {units meters;}}"
+            "deviation /c2 {deviate delete {units meters;}}"
+            "deviation /c3 {deviate replace {units centimeters;}}}", LYS_IN_YANG, &mod));
     assert_non_null(node = mod->compiled->data);
     assert_string_equal("c1", node->name);
-    assert_string_equal("meters", ((struct lysc_node_leaf*)node)->units);
+    assert_string_equal("meters", ((struct lysc_node_leaf *)node)->units);
     assert_non_null(node = node->next);
     assert_string_equal("c2", node->name);
-    assert_string_equal("kilometers", ((struct lysc_node_leaf*)node)->units);
+    assert_string_equal("kilometers", ((struct lysc_node_leaf *)node)->units);
     assert_non_null(node = node->next);
     assert_string_equal("c3", node->name);
-    assert_string_equal("centimeters", ((struct lysc_node_leaf*)node)->units);
+    assert_string_equal("centimeters", ((struct lysc_node_leaf *)node)->units);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module d {namespace urn:d;prefix d; leaf c1 {type string; must 1;}"
-                                        "container c2 {presence yes; must 1; must 2;} leaf c3 {type string; must 1; must 3;}"
-                                        "deviation /c1 {deviate add {must 3;}}"
-                                        "deviation /c2 {deviate delete {must 2;}}"
-                                        "deviation /c3 {deviate delete {must 3; must 1;}}}", LYS_IN_YANG, &mod));
+            "container c2 {presence yes; must 1; must 2;} leaf c3 {type string; must 1; must 3;}"
+            "deviation /c1 {deviate add {must 3;}}"
+            "deviation /c2 {deviate delete {must 2;}}"
+            "deviation /c3 {deviate delete {must 3; must 1;}}}", LYS_IN_YANG, &mod));
     assert_non_null(node = mod->compiled->data);
     assert_string_equal("c1", node->name);
-    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_node_leaf*)node)->musts));
-    assert_string_equal("3", ((struct lysc_node_leaf*)node)->musts[1].cond->expr);
+    assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_node_leaf *)node)->musts));
+    assert_string_equal("3", ((struct lysc_node_leaf *)node)->musts[1].cond->expr);
     assert_non_null(node = node->next);
     assert_string_equal("c2", node->name);
-    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_node_container*)node)->musts));
-    assert_string_equal("1", ((struct lysc_node_container*)node)->musts[0].cond->expr);
+    assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_node_container *)node)->musts));
+    assert_string_equal("1", ((struct lysc_node_container *)node)->musts[0].cond->expr);
     assert_non_null(node = node->next);
     assert_string_equal("c3", node->name);
-    assert_null(((struct lysc_node_leaf*)node)->musts);
+    assert_null(((struct lysc_node_leaf *)node)->musts);
 
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "module e {yang-version 1.1; namespace urn:e;prefix e; typedef mytype {type string; default nothing;}"
-                              "choice a {default aa;leaf aa {type string;} leaf ab {type string;} leaf ac {type string; mandatory true;}}"
-                              "choice b {default ba;leaf ba {type string;} leaf bb {type string;}}"
-                              "leaf c {default hello; type string;}"
-                              "leaf-list d {default hello; default world; type string;}"
-                              "leaf c2 {type mytype;} leaf-list d2 {type mytype;}}");
+            "choice a {default aa;leaf aa {type string;} leaf ab {type string;} leaf ac {type string; mandatory true;}}"
+            "choice b {default ba;leaf ba {type string;} leaf bb {type string;}}"
+            "leaf c {default hello; type string;}"
+            "leaf-list d {default hello; default world; type string;}"
+            "leaf c2 {type mytype;} leaf-list d2 {type mytype;}}");
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module f {yang-version 1.1; namespace urn:f;prefix f;import e {prefix x;}"
-                                  "deviation /x:a {deviate delete {default aa;}}"
-                                  "deviation /x:b {deviate delete {default ba;}}"
-                                  "deviation /x:c {deviate delete {default hello;}}"
-                                  "deviation /x:d {deviate delete {default world;}}}", LYS_IN_YANG, NULL));
+            "deviation /x:a {deviate delete {default aa;}}"
+            "deviation /x:b {deviate delete {default ba;}}"
+            "deviation /x:c {deviate delete {default hello;}}"
+            "deviation /x:d {deviate delete {default world;}}}", LYS_IN_YANG, NULL));
     assert_non_null((mod = ly_ctx_get_module_implemented(ctx, "e")));
     assert_non_null(node = mod->compiled->data);
-    assert_null(((struct lysc_node_choice*)node)->dflt);
+    assert_null(((struct lysc_node_choice *)node)->dflt);
     assert_non_null(node = node->next);
-    assert_null(((struct lysc_node_choice*)node)->dflt);
-    assert_non_null(leaf = (struct lysc_node_leaf*)node->next);
+    assert_null(((struct lysc_node_choice *)node)->dflt);
+    assert_non_null(leaf = (struct lysc_node_leaf *)node->next);
     assert_null(leaf->dflt);
-    assert_non_null(llist = (struct lysc_node_leaflist*)leaf->next);
+    assert_non_null(llist = (struct lysc_node_leaflist *)leaf->next);
     assert_int_equal(1, LY_ARRAY_COUNT(llist->dflts));
     assert_string_equal("hello", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
-    assert_non_null(leaf = (struct lysc_node_leaf*)llist->next);
+    assert_non_null(leaf = (struct lysc_node_leaf *)llist->next);
     assert_string_equal("nothing", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
     assert_int_equal(5, leaf->dflt->realtype->refcount); /* 3x type reference, 2x default value reference (typedef's default does not reference own type) */
-    assert_non_null(llist = (struct lysc_node_leaflist*)leaf->next);
+    assert_non_null(llist = (struct lysc_node_leaflist *)leaf->next);
     assert_int_equal(1, LY_ARRAY_COUNT(llist->dflts));
     assert_string_equal("nothing", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module g {yang-version 1.1; namespace urn:g;prefix g;import e {prefix x;}"
-                                  "deviation /x:b {deviate add {default x:ba;}}"
-                                  "deviation /x:c {deviate add {default bye;}}"
-                                  "deviation /x:d {deviate add {default all; default people;}}"
-                                  "deviation /x:c2 {deviate add {default hi; must 1;}}"
-                                  "deviation /x:d2 {deviate add {default hi; default all;}}}", LYS_IN_YANG, NULL));
+            "deviation /x:b {deviate add {default x:ba;}}"
+            "deviation /x:c {deviate add {default bye;}}"
+            "deviation /x:d {deviate add {default all; default people;}}"
+            "deviation /x:c2 {deviate add {default hi; must 1;}}"
+            "deviation /x:d2 {deviate add {default hi; default all;}}}", LYS_IN_YANG, NULL));
     assert_non_null((mod = ly_ctx_get_module_implemented(ctx, "e")));
     assert_non_null(node = mod->compiled->data);
-    assert_null(((struct lysc_node_choice*)node)->dflt);
+    assert_null(((struct lysc_node_choice *)node)->dflt);
     assert_non_null(node = node->next);
-    assert_non_null(((struct lysc_node_choice*)node)->dflt);
-    assert_string_equal("ba", ((struct lysc_node_choice*)node)->dflt->name);
-    assert_non_null(leaf = (struct lysc_node_leaf*)node->next);
+    assert_non_null(((struct lysc_node_choice *)node)->dflt);
+    assert_string_equal("ba", ((struct lysc_node_choice *)node)->dflt->name);
+    assert_non_null(leaf = (struct lysc_node_leaf *)node->next);
     assert_non_null(leaf->dflt);
     assert_string_equal("bye", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
-    assert_non_null(llist = (struct lysc_node_leaflist*)leaf->next);
+    assert_non_null(llist = (struct lysc_node_leaflist *)leaf->next);
     assert_int_equal(3, LY_ARRAY_COUNT(llist->dflts));
     assert_string_equal("hello", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
@@ -2894,7 +2884,7 @@
     assert_int_equal(0, dynamic);
     assert_string_equal("people", llist->dflts[2]->realtype->plugin->print(llist->dflts[2], LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
-    assert_non_null(leaf = (struct lysc_node_leaf*)llist->next);
+    assert_non_null(leaf = (struct lysc_node_leaf *)llist->next);
     assert_non_null(leaf->dflt);
     assert_string_equal("hi", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
@@ -2902,7 +2892,7 @@
     - previous type's default values were replaced by node's default values where d2 now has 2 default values */
     assert_int_equal(1, LY_ARRAY_COUNT(leaf->musts));
     assert_int_equal(0, LY_ARRAY_COUNT(leaf->musts[0].prefixes));
-    assert_non_null(llist = (struct lysc_node_leaflist*)leaf->next);
+    assert_non_null(llist = (struct lysc_node_leaflist *)leaf->next);
     assert_int_equal(2, LY_ARRAY_COUNT(llist->dflts));
     assert_string_equal("hi", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
@@ -2910,30 +2900,30 @@
     assert_int_equal(0, dynamic);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module h {yang-version 1.1; namespace urn:h;prefix h;import e {prefix x;}"
-                                  "deviation /x:b {deviate replace {default x:ba;}}"
-                                  "deviation /x:c {deviate replace {default hello;}}}", LYS_IN_YANG, NULL));
+            "deviation /x:b {deviate replace {default x:ba;}}"
+            "deviation /x:c {deviate replace {default hello;}}}", LYS_IN_YANG, NULL));
     assert_non_null((mod = ly_ctx_get_module_implemented(ctx, "e")));
     assert_non_null(node = mod->compiled->data);
-    assert_null(((struct lysc_node_choice*)node)->dflt);
+    assert_null(((struct lysc_node_choice *)node)->dflt);
     assert_non_null(node = node->next);
-    assert_non_null(((struct lysc_node_choice*)node)->dflt);
-    assert_string_equal("ba", ((struct lysc_node_choice*)node)->dflt->name);
-    assert_non_null(leaf = (struct lysc_node_leaf*)node->next);
+    assert_non_null(((struct lysc_node_choice *)node)->dflt);
+    assert_string_equal("ba", ((struct lysc_node_choice *)node)->dflt->name);
+    assert_non_null(leaf = (struct lysc_node_leaf *)node->next);
     assert_non_null(leaf->dflt);
     assert_string_equal("hello", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
 
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "module i {namespace urn:i;prefix i;"
-                              "list l1 {key a; leaf a {type string;} leaf b {type string;} leaf c {type string;}}"
-                              "list l2 {key a; unique \"b c\"; unique \"d\"; leaf a {type string;} leaf b {type string;}"
-                              "         leaf c {type string;} leaf d {type string;}}}");
+            "list l1 {key a; leaf a {type string;} leaf b {type string;} leaf c {type string;}}"
+            "list l2 {key a; unique \"b c\"; unique \"d\"; leaf a {type string;} leaf b {type string;}"
+            "         leaf c {type string;} leaf d {type string;}}}");
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module j {namespace urn:j;prefix j;import i {prefix i;}"
-                                  "augment /i:l1 {leaf j_c {type string;}}"
-                                  "deviation /i:l1 {deviate add {unique \"i:b j_c\"; }}"
-                                  "deviation /i:l1 {deviate add {unique \"i:c\";}}"
-                                  "deviation /i:l2 {deviate delete {unique \"d\"; unique \"b c\";}}}", LYS_IN_YANG, NULL));
+            "augment /i:l1 {leaf j_c {type string;}}"
+            "deviation /i:l1 {deviate add {unique \"i:b j_c\"; }}"
+            "deviation /i:l1 {deviate add {unique \"i:c\";}}"
+            "deviation /i:l2 {deviate delete {unique \"d\"; unique \"b c\";}}}", LYS_IN_YANG, NULL));
     assert_non_null((mod = ly_ctx_get_module_implemented(ctx, "i")));
-    assert_non_null(list = (struct lysc_node_list*)mod->compiled->data);
+    assert_non_null(list = (struct lysc_node_list *)mod->compiled->data);
     assert_string_equal("l1", list->name);
     assert_int_equal(2, LY_ARRAY_COUNT(list->uniques));
     assert_int_equal(2, LY_ARRAY_COUNT(list->uniques[0]));
@@ -2941,14 +2931,14 @@
     assert_string_equal("j_c", list->uniques[0][1]->name);
     assert_int_equal(1, LY_ARRAY_COUNT(list->uniques[1]));
     assert_string_equal("c", list->uniques[1][0]->name);
-    assert_non_null(list = (struct lysc_node_list*)list->next);
+    assert_non_null(list = (struct lysc_node_list *)list->next);
     assert_string_equal("l2", list->name);
     assert_null(list->uniques);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module k {namespace urn:k;prefix k; leaf a {type string;}"
-                                        "container top {leaf x {type string;} leaf y {type string; config false;}}"
-                                        "deviation /a {deviate add {config false; }}"
-                                        "deviation /top {deviate add {config false;}}}", LYS_IN_YANG, &mod));
+            "container top {leaf x {type string;} leaf y {type string; config false;}}"
+            "deviation /a {deviate add {config false; }}"
+            "deviation /top {deviate add {config false;}}}", LYS_IN_YANG, &mod));
     assert_non_null(node = mod->compiled->data);
     assert_string_equal("a", node->name);
     assert_true(node->flags & LYS_CONFIG_R);
@@ -2963,9 +2953,9 @@
     assert_true(node->flags & LYS_CONFIG_R);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module l {namespace urn:l;prefix l; leaf a {config false; type string;}"
-                                        "container top {config false; leaf x {type string;}}"
-                                        "deviation /a {deviate replace {config true;}}"
-                                        "deviation /top {deviate replace {config true;}}}", LYS_IN_YANG, &mod));
+            "container top {config false; leaf x {type string;}}"
+            "deviation /a {deviate replace {config true;}}"
+            "deviation /top {deviate replace {config true;}}}", LYS_IN_YANG, &mod));
     assert_non_null(node = mod->compiled->data);
     assert_string_equal("a", node->name);
     assert_true(node->flags & LYS_CONFIG_W);
@@ -2977,10 +2967,10 @@
     assert_true(node->flags & LYS_CONFIG_W);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module m {namespace urn:m;prefix m;"
-                                        "container a {leaf a {type string;}}"
-                                        "container b {leaf b {mandatory true; type string;}}"
-                                        "deviation /a/a {deviate add {mandatory true;}}"
-                                        "deviation /b/b {deviate replace {mandatory false;}}}", LYS_IN_YANG, &mod));
+            "container a {leaf a {type string;}}"
+            "container b {leaf b {mandatory true; type string;}}"
+            "deviation /a/a {deviate add {mandatory true;}}"
+            "deviation /b/b {deviate replace {mandatory false;}}}", LYS_IN_YANG, &mod));
     assert_non_null(node = mod->compiled->data);
     assert_string_equal("a", node->name);
     assert_true((node->flags & LYS_MAND_MASK) == LYS_MAND_TRUE);
@@ -2991,56 +2981,56 @@
     assert_true((lysc_node_children(node, 0)->flags & LYS_MAND_MASK) == LYS_MAND_FALSE);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module n {yang-version 1.1; namespace urn:n;prefix n;"
-                                        "leaf a {default test; type string;}"
-                                        "leaf b {mandatory true; type string;}"
-                                        "deviation /a {deviate add {mandatory true;} deviate delete {default test;}}"
-                                        "deviation /b {deviate add {default test;} deviate replace {mandatory false;}}}", LYS_IN_YANG, &mod));
+            "leaf a {default test; type string;}"
+            "leaf b {mandatory true; type string;}"
+            "deviation /a {deviate add {mandatory true;} deviate delete {default test;}}"
+            "deviation /b {deviate add {default test;} deviate replace {mandatory false;}}}", LYS_IN_YANG, &mod));
     assert_non_null(node = mod->compiled->data);
     assert_string_equal("a", node->name);
-    assert_null(((struct lysc_node_leaf*)node)->dflt);
+    assert_null(((struct lysc_node_leaf *)node)->dflt);
     assert_true((node->flags & LYS_MAND_MASK) == LYS_MAND_TRUE);
     assert_non_null(node = node->next);
     assert_string_equal("b", node->name);
-    assert_non_null(((struct lysc_node_leaf*)node)->dflt);
+    assert_non_null(((struct lysc_node_leaf *)node)->dflt);
     assert_true((node->flags & LYS_MAND_MASK) == LYS_MAND_FALSE);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module o {namespace urn:o;prefix o;"
-                                        "leaf-list a {type string;}"
-                                        "list b {config false;}"
-                                        "leaf-list c {min-elements 1; max-elements 10; type string;}"
-                                        "list d {min-elements 10; max-elements 100; config false;}"
-                                        "deviation /a {deviate add {min-elements 1; max-elements 10;}}"
-                                        "deviation /b {deviate add {min-elements 10; max-elements 100;}}"
-                                        "deviation /c {deviate replace {min-elements 10; max-elements 100;}}"
-                                        "deviation /d {deviate replace {min-elements 1; max-elements 10;}}}", LYS_IN_YANG, &mod));
+            "leaf-list a {type string;}"
+            "list b {config false;}"
+            "leaf-list c {min-elements 1; max-elements 10; type string;}"
+            "list d {min-elements 10; max-elements 100; config false;}"
+            "deviation /a {deviate add {min-elements 1; max-elements 10;}}"
+            "deviation /b {deviate add {min-elements 10; max-elements 100;}}"
+            "deviation /c {deviate replace {min-elements 10; max-elements 100;}}"
+            "deviation /d {deviate replace {min-elements 1; max-elements 10;}}}", LYS_IN_YANG, &mod));
     assert_non_null(node = mod->compiled->data);
     assert_string_equal("a", node->name);
-    assert_int_equal(1, ((struct lysc_node_leaflist*)node)->min);
-    assert_int_equal(10, ((struct lysc_node_leaflist*)node)->max);
+    assert_int_equal(1, ((struct lysc_node_leaflist *)node)->min);
+    assert_int_equal(10, ((struct lysc_node_leaflist *)node)->max);
     assert_non_null(node = node->next);
     assert_string_equal("b", node->name);
-    assert_int_equal(10, ((struct lysc_node_list*)node)->min);
-    assert_int_equal(100, ((struct lysc_node_list*)node)->max);
+    assert_int_equal(10, ((struct lysc_node_list *)node)->min);
+    assert_int_equal(100, ((struct lysc_node_list *)node)->max);
     assert_non_null(node = node->next);
     assert_string_equal("c", node->name);
-    assert_int_equal(10, ((struct lysc_node_leaflist*)node)->min);
-    assert_int_equal(100, ((struct lysc_node_leaflist*)node)->max);
+    assert_int_equal(10, ((struct lysc_node_leaflist *)node)->min);
+    assert_int_equal(100, ((struct lysc_node_leaflist *)node)->max);
     assert_non_null(node = node->next);
     assert_string_equal("d", node->name);
-    assert_int_equal(1, ((struct lysc_node_list*)node)->min);
-    assert_int_equal(10, ((struct lysc_node_list*)node)->max);
+    assert_int_equal(1, ((struct lysc_node_list *)node)->min);
+    assert_int_equal(10, ((struct lysc_node_list *)node)->max);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module p {yang-version 1.1; namespace urn:p;prefix p; typedef mytype {type int8; default 1;}"
-                                        "leaf a {type string; default 10;} leaf-list b {type string;}"
-                                        "deviation /a {deviate replace {type mytype;}}"
-                                        "deviation /b {deviate replace {type mytype;}}}", LYS_IN_YANG, &mod));
-    assert_non_null(leaf = (struct lysc_node_leaf*)mod->compiled->data);
+            "leaf a {type string; default 10;} leaf-list b {type string;}"
+            "deviation /a {deviate replace {type mytype;}}"
+            "deviation /b {deviate replace {type mytype;}}}", LYS_IN_YANG, &mod));
+    assert_non_null(leaf = (struct lysc_node_leaf *)mod->compiled->data);
     assert_string_equal("a", leaf->name);
     assert_int_equal(LY_TYPE_INT8, leaf->type->basetype);
     assert_string_equal("10", leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, NULL, &dynamic));
     assert_int_equal(0, dynamic);
     assert_int_equal(10, leaf->dflt->uint8);
-    assert_non_null(llist = (struct lysc_node_leaflist*)leaf->next);
+    assert_non_null(llist = (struct lysc_node_leaflist *)leaf->next);
     assert_string_equal("b", llist->name);
     assert_int_equal(LY_TYPE_INT8, llist->type->basetype);
     assert_int_equal(1, LY_ARRAY_COUNT(llist->dflts));
@@ -3050,16 +3040,16 @@
 
     /* instance-identifiers with NULL canonical are changed to string types with a canonical value equal to the original value */
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module q {yang-version 1.1; namespace urn:q;prefix q; import e {prefix e;}"
-                                        "leaf q {type instance-identifier; default \"/e:d2[.='a']\";}"
-                                        "leaf-list ql {type instance-identifier; default \"/e:d[.='b']\"; default \"/e:d2[.='c']\";}}", LYS_IN_YANG, &mod));
+            "leaf q {type instance-identifier; default \"/e:d2[.='a']\";}"
+            "leaf-list ql {type instance-identifier; default \"/e:d[.='b']\"; default \"/e:d2[.='c']\";}}", LYS_IN_YANG, &mod));
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module qdev {yang-version 1.1; namespace urn:qdev;prefix qd; import q {prefix q;}"
-                                  "deviation /q:q { deviate replace {type string;}}"
-                                  "deviation /q:ql { deviate replace {type string;}}}", LYS_IN_YANG, NULL));
-    assert_non_null(leaf = (struct lysc_node_leaf*)mod->compiled->data);
+            "deviation /q:q { deviate replace {type string;}}"
+            "deviation /q:ql { deviate replace {type string;}}}", LYS_IN_YANG, NULL));
+    assert_non_null(leaf = (struct lysc_node_leaf *)mod->compiled->data);
     assert_int_equal(LY_TYPE_STRING, leaf->dflt->realtype->basetype);
     assert_non_null(leaf->dflt->canonical);
     assert_string_equal("/e:d2[.='a']", leaf->dflt->canonical);
-    assert_non_null(llist = (struct lysc_node_leaflist*)leaf->next);
+    assert_non_null(llist = (struct lysc_node_leaflist *)leaf->next);
     assert_int_equal(2, LY_ARRAY_COUNT(llist->dflts));
     assert_int_equal(LY_TYPE_STRING, llist->dflts[0]->realtype->basetype);
     assert_string_equal("/e:d[.='b']", llist->dflts[0]->canonical);
@@ -3067,55 +3057,57 @@
     assert_string_equal("/e:d2[.='c']", llist->dflts[1]->canonical);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module r {yang-version 1.1; namespace urn:r;prefix r;"
-                                        "typedef mytype {type uint8; default 200;}"
-                                        "leaf r {type mytype;} leaf-list lr {type mytype;}"
-                                        "deviation /r:r {deviate replace {type string;}}"
-                                        "deviation /r:lr {deviate replace {type string;}}}", LYS_IN_YANG, &mod));
+            "typedef mytype {type uint8; default 200;}"
+            "leaf r {type mytype;} leaf-list lr {type mytype;}"
+            "deviation /r:r {deviate replace {type string;}}"
+            "deviation /r:lr {deviate replace {type string;}}}", LYS_IN_YANG, &mod));
     assert_non_null(leaf = (struct lysc_node_leaf *)mod->compiled->data);
     assert_string_equal("r", leaf->name);
     assert_null(leaf->dflt);
-    assert_non_null(llist = (struct lysc_node_leaflist* )leaf->next);
+    assert_non_null(llist = (struct lysc_node_leaflist *)leaf->next);
     assert_string_equal("lr", llist->name);
     assert_null(llist->dflts);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module s {yang-version 1.1; namespace urn:s;prefix s;"
-                                        "leaf s {type instance-identifier {require-instance true;} default /s:x;}"
-                                        "leaf x {type string;} leaf y {type string;}"
-                                        "deviation /s:s {deviate replace {default /s:y;}}}", LYS_IN_YANG, &mod));
-    assert_non_null(leaf = (struct lysc_node_leaf*)mod->compiled->data);
+            "leaf s {type instance-identifier {require-instance true;} default /s:x;}"
+            "leaf x {type string;} leaf y {type string;}"
+            "deviation /s:s {deviate replace {default /s:y;}}}", LYS_IN_YANG, &mod));
+    assert_non_null(leaf = (struct lysc_node_leaf *)mod->compiled->data);
     assert_string_equal("s", leaf->name);
     assert_non_null(leaf->dflt);
     assert_non_null(str = leaf->dflt->realtype->plugin->print(leaf->dflt, LY_PREF_SCHEMA, mod->parsed, &dynamic));
     assert_string_equal("/s:y", str);
-    if (dynamic) { free((char*)str); }
+    if (dynamic) {
+        free((char *)str);
+    }
 
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "module t {namespace urn:t;prefix t;"
-                              "leaf l {type string;}}");
+            "leaf l {type string;}}");
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module u {namespace urn:u;prefix u;import t {prefix t;}"
-                                  "identity ident;"
-                                  "deviation /t:l {deviate replace {type identityref {base ident;}}}"
-                                  "}", LYS_IN_YANG, NULL));
+            "identity ident;"
+            "deviation /t:l {deviate replace {type identityref {base ident;}}}"
+            "}", LYS_IN_YANG, NULL));
     assert_non_null((mod = ly_ctx_get_module_implemented(ctx, "t")));
-    assert_non_null(leaf = (struct lysc_node_leaf*)mod->compiled->data);
+    assert_non_null(leaf = (struct lysc_node_leaf *)mod->compiled->data);
     assert_string_equal("l", leaf->name);
     assert_int_equal(LY_TYPE_IDENT, leaf->type->basetype);
     assert_string_equal("ident", ((struct lysc_type_identityref *)leaf->type)->bases[0]->name);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module v {namespace urn:v;prefix v;"
-                                  "identity ident; identity ident2 { base ident; }"
-                                  "}", LYS_IN_YANG, NULL));
+            "identity ident; identity ident2 { base ident; }"
+            "}", LYS_IN_YANG, NULL));
     ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "submodule w-sub { belongs-to w { prefix w; }"
-                                  "import v { prefix v_pref; }"
-                                  "leaf l { type string; default \"v_pref:ident2\"; }"
-                                  "}");
+            "import v { prefix v_pref; }"
+            "leaf l { type string; default \"v_pref:ident2\"; }"
+            "}");
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module w {namespace urn:w;prefix w;"
-                                  "include w-sub;"
-                                  "}", LYS_IN_YANG, &mod));
+            "include w-sub;"
+            "}", LYS_IN_YANG, &mod));
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module x {namespace urn:x;prefix x;"
-                                  "import w { prefix w_pref; } import v { prefix v_pref; }"
-                                  "deviation /w_pref:l { deviate replace { type identityref { base v_pref:ident; } } }"
-                                  "}", LYS_IN_YANG, NULL));
-    assert_non_null(leaf = (struct lysc_node_leaf*)mod->compiled->data);
+            "import w { prefix w_pref; } import v { prefix v_pref; }"
+            "deviation /w_pref:l { deviate replace { type identityref { base v_pref:ident; } } }"
+            "}", LYS_IN_YANG, NULL));
+    assert_non_null(leaf = (struct lysc_node_leaf *)mod->compiled->data);
     assert_string_equal("l", leaf->name);
     assert_int_equal(LY_TYPE_IDENT, leaf->type->basetype);
 
@@ -3135,214 +3127,214 @@
     assert_int_equal(LY_TYPE_LEAFREF, leaf->type->basetype);
 
     assert_int_equal(LY_ENOTFOUND, lys_parse_mem(ctx, "module aa1 {namespace urn:aa1;prefix aa1;import a {prefix a;}"
-                              "deviation /a:top/a:z {deviate not-supported;}}", LYS_IN_YANG, &mod));
+            "deviation /a:top/a:z {deviate not-supported;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Deviation(s) target node \"/a:top/a:z\" from module \"aa1\" was not found.");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module aa2 {namespace urn:aa2;prefix aa2;import a {prefix a;}"
-                              "deviation /a:top/a:a {deviate not-supported;}"
-                              "deviation /a:top/a:a {deviate add {default error;}}}", LYS_IN_YANG, NULL));
+            "deviation /a:top/a:a {deviate not-supported;}"
+            "deviation /a:top/a:a {deviate add {default error;}}}", LYS_IN_YANG, NULL));
     logbuf_assert("Multiple deviations of \"/a:top/a:a\" with one of them being \"not-supported\". /");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module bb {namespace urn:bb;prefix bb;import a {prefix a;}"
-                              "deviation a:top/a:a {deviate not-supported;}}", LYS_IN_YANG, &mod));
+            "deviation a:top/a:a {deviate not-supported;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid absolute-schema-nodeid value \"a:top/a:a\" - \"/\" expected instead of \"a:top\". /bb:{deviation='a:top/a:a'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module cc {namespace urn:cc;prefix cc; container c;"
-                              "deviation /c {deviate add {units meters;}}}", LYS_IN_YANG, &mod));
+            "deviation /c {deviate add {units meters;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation of container node - it is not possible to add \"units\" property. /cc:{deviation='/c'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module cd {namespace urn:cd;prefix cd; leaf c {type string; units centimeters;}"
-                              "deviation /c {deviate add {units meters;}}}", LYS_IN_YANG, &mod));
+            "deviation /c {deviate add {units meters;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation adding \"units\" property which already exists (with value \"centimeters\"). /cd:{deviation='/c'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module dd1 {namespace urn:dd1;prefix dd1; container c;"
-                              "deviation /c {deviate delete {units meters;}}}", LYS_IN_YANG, &mod));
+            "deviation /c {deviate delete {units meters;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation of container node - it is not possible to delete \"units\" property. /dd1:{deviation='/c'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module dd2 {namespace urn:dd2;prefix dd2; leaf c {type string;}"
-                              "deviation /c {deviate delete {units meters;}}}", LYS_IN_YANG, &mod));
+            "deviation /c {deviate delete {units meters;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation deleting \"units\" property \"meters\" which is not present. /dd2:{deviation='/c'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module dd3 {namespace urn:dd3;prefix dd3; leaf c {type string; units centimeters;}"
-                              "deviation /c {deviate delete {units meters;}}}", LYS_IN_YANG, &mod));
+            "deviation /c {deviate delete {units meters;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation deleting \"units\" property \"meters\" which does not match the target's property value \"centimeters\"."
             " /dd3:{deviation='/c'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ee1 {namespace urn:ee1;prefix ee1; container c;"
-                              "deviation /c {deviate replace {units meters;}}}", LYS_IN_YANG, &mod));
+            "deviation /c {deviate replace {units meters;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation of container node - it is not possible to replace \"units\" property. /ee1:{deviation='/c'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ee2 {namespace urn:ee2;prefix ee2; leaf c {type string;}"
-                              "deviation /c {deviate replace {units meters;}}}", LYS_IN_YANG, &mod));
+            "deviation /c {deviate replace {units meters;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation replacing \"units\" property \"meters\" which is not present. /ee2:{deviation='/c'}");
 
     /* the default is already deleted in /e:a byt module f */
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ff1 {namespace urn:ff1;prefix ff1; import e {prefix e;}"
-                              "deviation /e:a {deviate delete {default x:aa;}}}", LYS_IN_YANG, &mod));
+            "deviation /e:a {deviate delete {default x:aa;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation deleting \"default\" property \"x:aa\" which is not present. /ff1:{deviation='/e:a'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ff3 {namespace urn:ff3;prefix ff3; import e {prefix e;}"
-                              "deviation /e:b {deviate delete {default e:b;}}}", LYS_IN_YANG, &mod));
+            "deviation /e:b {deviate delete {default e:b;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation deleting \"default\" property \"e:b\" which does not match the target's property value \"x:ba\". /ff3:{deviation='/e:b'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ff5 {namespace urn:ff5;prefix ff5; anyxml a;"
-                              "deviation /a {deviate delete {default x;}}}", LYS_IN_YANG, &mod));
+            "deviation /a {deviate delete {default x;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation of anyxml node - it is not possible to delete \"default\" property. /ff5:{deviation='/a'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ff6 {namespace urn:ff6;prefix ff6; import e {prefix e;}"
-                              "deviation /e:c {deviate delete {default hi;}}}", LYS_IN_YANG, &mod));
+            "deviation /e:c {deviate delete {default hi;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation deleting \"default\" property \"hi\" which does not match the target's property value \"hello\". /ff6:{deviation='/e:c'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ff7 {namespace urn:ff7;prefix ff7; import e {prefix e;}"
-                              "deviation /e:d {deviate delete {default hi;}}}", LYS_IN_YANG, &mod));
+            "deviation /e:d {deviate delete {default hi;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation deleting \"default\" property \"hi\" which does not match any of the target's property values. /ff7:{deviation='/e:d'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module gg1 {namespace urn:gg1;prefix gg1; import e {prefix e;}"
-                              "deviation /e:b {deviate add {default e:a;}}}", LYS_IN_YANG, &mod));
+            "deviation /e:b {deviate add {default e:a;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation adding \"default\" property which already exists (with value \"x:ba\"). /gg1:{deviation='/e:b'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module gg2 {namespace urn:gg2;prefix gg2; import e {prefix e;}"
-                              "deviation /e:a {deviate add {default x:a;}}}", LYS_IN_YANG, &mod));
+            "deviation /e:a {deviate add {default x:a;}}}", LYS_IN_YANG, &mod));
     /*logbuf_assert("Invalid deviation adding \"default\" property \"x:a\" of choice. "
                   "The prefix does not match any imported module of the deviation module. /gg2:{deviation='/e:a'}");*/
     logbuf_assert("Compilation of a deviated and/or refined node failed. /e:a");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module gg3 {namespace urn:gg3;prefix gg3; import e {prefix e;}"
-                              "deviation /e:a {deviate add {default a;}}}", LYS_IN_YANG, &mod));
+            "deviation /e:a {deviate add {default a;}}}", LYS_IN_YANG, &mod));
     /*logbuf_assert("Invalid deviation adding \"default\" property \"a\" of choice - the specified case does not exists. /gg3:{deviation='/e:a'}");*/
     logbuf_assert("Compilation of a deviated and/or refined node failed. /e:a");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module gg4 {namespace urn:gg4;prefix gg4; import e {prefix e;}"
-                              "deviation /e:c {deviate add {default hi;}}}", LYS_IN_YANG, &mod));
+            "deviation /e:c {deviate add {default hi;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation adding \"default\" property which already exists (with value \"hello\"). /gg4:{deviation='/e:c'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module gg4 {namespace urn:gg4;prefix gg4; import e {prefix e;}"
-                              "deviation /e:a {deviate add {default e:ac;}}}", LYS_IN_YANG, &mod));
+            "deviation /e:a {deviate add {default e:ac;}}}", LYS_IN_YANG, &mod));
     /*logbuf_assert("Invalid deviation adding \"default\" property \"e:ac\" of choice - mandatory node \"ac\" under the default case. /gg4:{deviation='/e:a'}");*/
     logbuf_assert("Compilation of a deviated and/or refined node failed. /e:a");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module gg5 {namespace urn:gg5;prefix gg5; leaf x {type string; mandatory true;}"
-                              "deviation /x {deviate add {default error;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate add {default error;}}}", LYS_IN_YANG, &mod));
     /*logbuf_assert("Invalid deviation combining default value and mandatory leaf. /gg5:{deviation='/x'}");*/
     logbuf_assert("Compilation of a deviated and/or refined node failed. /gg5:x");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module hh1 {yang-version 1.1; namespace urn:hh1;prefix hh1; import e {prefix e;}"
-                              "deviation /e:d {deviate replace {default hi;}}}", LYS_IN_YANG, &mod));
+            "deviation /e:d {deviate replace {default hi;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation of leaf-list node - it is not possible to replace \"default\" property. /hh1:{deviation='/e:d'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ii1 {namespace urn:ii1;prefix ii1; import i {prefix i;}"
-                              "deviation /i:l1 {deviate delete {unique x;}}}", LYS_IN_YANG, &mod));
+            "deviation /i:l1 {deviate delete {unique x;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation deleting \"unique\" property \"x\" which does not match any of the target's property values. /ii1:{deviation='/i:l1'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ii2 {namespace urn:ii2;prefix ii2; import i {prefix i;} leaf x { type string;}"
-                              "deviation /i:l2 {deviate delete {unique d;}}}", LYS_IN_YANG, &mod));
+            "deviation /i:l2 {deviate delete {unique d;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation deleting \"unique\" property \"d\" which does not match any of the target's property values. /ii2:{deviation='/i:l2'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ii3 {namespace urn:ii3;prefix ii3; leaf x { type string;}"
-                              "deviation /x {deviate delete {unique d;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate delete {unique d;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation of leaf node - it is not possible to delete \"unique\" property. /ii3:{deviation='/x'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ii4 {namespace urn:ii4;prefix ii4; leaf x { type string;}"
-                              "deviation /x {deviate add {unique d;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate add {unique d;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation of leaf node - it is not possible to add \"unique\" property. /ii4:{deviation='/x'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module jj1 {namespace urn:jj1;prefix jj1; choice ch {case a {leaf a{type string;}}}"
-                              "deviation /ch/a {deviate add {config false;}}}", LYS_IN_YANG, &mod));
+            "deviation /ch/a {deviate add {config false;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation of case node - it is not possible to add \"config\" property. /jj1:{deviation='/ch/a'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module jj2 {namespace urn:jj2;prefix jj2; container top {config false; leaf x {type string;}}"
-                              "deviation /top/x {deviate add {config true;}}}", LYS_IN_YANG, &mod));
+            "deviation /top/x {deviate add {config true;}}}", LYS_IN_YANG, &mod));
     /*logbuf_assert("Invalid deviation of config - configuration node cannot be child of any state data node. /jj2:{deviation='/top/x'}");*/
     logbuf_assert("Compilation of a deviated and/or refined node failed. /jj2:top/x");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module jj3 {namespace urn:jj3;prefix jj3; container top {leaf x {type string;}}"
-                              "deviation /top/x {deviate replace {config false;}}}", LYS_IN_YANG, &mod));
+            "deviation /top/x {deviate replace {config false;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation replacing \"config\" property \"config false\" which is not present. /jj3:{deviation='/top/x'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module jj4 {namespace urn:jj4;prefix jj4; choice ch {case a {leaf a{type string;}}}"
-                              "deviation /ch/a {deviate replace {config false;}}}", LYS_IN_YANG, &mod));
+            "deviation /ch/a {deviate replace {config false;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation of case node - it is not possible to replace \"config\" property. /jj4:{deviation='/ch/a'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module jj5 {namespace urn:jj5;prefix jj5; container top {leaf x {type string; config true;}}"
-                              "deviation /top {deviate add {config false;}}}", LYS_IN_YANG, &mod));
+            "deviation /top {deviate add {config false;}}}", LYS_IN_YANG, &mod));
     /*logbuf_assert("Invalid deviation of config - configuration node cannot be child of any state data node. /jj5:{deviation='/top'}");*/
     logbuf_assert("Compilation of a deviated and/or refined node failed. /jj5:top");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module jj6 {namespace urn:jj6;prefix jj6; leaf x {config false; type string;}"
-                              "deviation /x {deviate add {config true;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate add {config true;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation adding \"config\" property which already exists (with value \"config false\"). /jj6:{deviation='/x'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module kk1 {namespace urn:kk1;prefix kk1; container top {leaf a{type string;}}"
-                              "deviation /top {deviate add {mandatory true;}}}", LYS_IN_YANG, &mod));
+            "deviation /top {deviate add {mandatory true;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation of container node - it is not possible to add \"mandatory\" property. /kk1:{deviation='/top'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module kk2 {namespace urn:kk2;prefix kk2; container top {leaf a{type string;}}"
-                              "deviation /top {deviate replace {mandatory true;}}}", LYS_IN_YANG, &mod));
+            "deviation /top {deviate replace {mandatory true;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation of container node - it is not possible to replace \"mandatory\" property. /kk2:{deviation='/top'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module kk3 {namespace urn:kk3;prefix kk3; container top {leaf x {type string;}}"
-                              "deviation /top/x {deviate replace {mandatory true;}}}", LYS_IN_YANG, &mod));
+            "deviation /top/x {deviate replace {mandatory true;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation replacing \"mandatory\" property \"mandatory true\" which is not present. /kk3:{deviation='/top/x'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module kk4 {namespace urn:kk4;prefix kk4; leaf x {mandatory true; type string;}"
-                              "deviation /x {deviate add {mandatory false;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate add {mandatory false;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation adding \"mandatory\" property which already exists (with value \"mandatory true\"). /kk4:{deviation='/x'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ll1 {namespace urn:ll1;prefix ll1; leaf x {default test; type string;}"
-                              "deviation /x {deviate add {mandatory true;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate add {mandatory true;}}}", LYS_IN_YANG, &mod));
     /*logbuf_assert("Invalid deviation combining default value and mandatory leaf. /ll1:{deviation='/x'}");*/
     logbuf_assert("Compilation of a deviated and/or refined node failed. /ll1:x");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ll2 {yang-version 1.1; namespace urn:ll2;prefix ll2; leaf-list x {default test; type string;}"
-                              "deviation /x {deviate add {min-elements 1;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate add {min-elements 1;}}}", LYS_IN_YANG, &mod));
     /*logbuf_assert("Invalid deviation combining default value and mandatory leaf-list. /ll2:{deviation='/x'}");*/
     logbuf_assert("Compilation of a deviated and/or refined node failed. /ll2:x");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module ll2 {namespace urn:ll2;prefix ll2; choice ch {default a; leaf a {type string;} leaf b {type string;}}"
-                              "deviation /ch {deviate add {mandatory true;}}}", LYS_IN_YANG, &mod));
+            "deviation /ch {deviate add {mandatory true;}}}", LYS_IN_YANG, &mod));
     /*logbuf_assert("Invalid deviation combining default case and mandatory choice. /ll2:{deviation='/ch'}");*/
     logbuf_assert("Compilation of a deviated and/or refined node failed. /ll2:ch");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module mm1 {namespace urn:mm1;prefix mm1; leaf-list x {min-elements 10; type string;}"
-                              "deviation /x {deviate add {max-elements 5;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate add {max-elements 5;}}}", LYS_IN_YANG, &mod));
     /*logbuf_assert("Invalid combination of min-elements and max-elements after deviation: min value 10 is bigger than max value 5. /mm1:{deviation='/x'}");*/
     logbuf_assert("Compilation of a deviated and/or refined node failed. /mm1:x");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module mm2 {namespace urn:mm2;prefix mm2; leaf-list x {max-elements 10; type string;}"
-                              "deviation /x {deviate add {min-elements 20;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate add {min-elements 20;}}}", LYS_IN_YANG, &mod));
     /*logbuf_assert("Invalid combination of min-elements and max-elements after deviation: min value 20 is bigger than max value 10. /mm2:{deviation='/x'}");*/
     logbuf_assert("Compilation of a deviated and/or refined node failed. /mm2:x");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module mm3 {namespace urn:mm3;prefix mm3; list x {min-elements 5; max-elements 10; config false;}"
-                              "deviation /x {deviate replace {max-elements 1;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate replace {max-elements 1;}}}", LYS_IN_YANG, &mod));
     /*logbuf_assert("Invalid combination of min-elements and max-elements after deviation: min value 5 is bigger than max value 1. /mm3:{deviation='/x'}");*/
     logbuf_assert("Compilation of a deviated and/or refined node failed. /mm3:x");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module mm4 {namespace urn:mm4;prefix mm4; list x {min-elements 5; max-elements 10; config false;}"
-                              "deviation /x {deviate replace {min-elements 20;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate replace {min-elements 20;}}}", LYS_IN_YANG, &mod));
     /*logbuf_assert("Invalid combination of min-elements and max-elements after deviation: min value 20 is bigger than max value 10. /mm4:{deviation='/x'}");*/
     logbuf_assert("Compilation of a deviated and/or refined node failed. /mm4:x");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module mm5 {namespace urn:mm5;prefix mm5; leaf-list x {type string; min-elements 5;}"
-                              "deviation /x {deviate add {min-elements 1;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate add {min-elements 1;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation adding \"min-elements\" property which already exists (with value \"5\"). /mm5:{deviation='/x'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module mm6 {namespace urn:mm6;prefix mm6; list x {config false; min-elements 5;}"
-                              "deviation /x {deviate add {min-elements 1;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate add {min-elements 1;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation adding \"min-elements\" property which already exists (with value \"5\"). /mm6:{deviation='/x'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module mm7 {namespace urn:mm7;prefix mm7; leaf-list x {type string; max-elements 5;}"
-                              "deviation /x {deviate add {max-elements 1;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate add {max-elements 1;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation adding \"max-elements\" property which already exists (with value \"5\"). /mm7:{deviation='/x'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module mm8 {namespace urn:mm8;prefix mm8; list x {config false; max-elements 5;}"
-                              "deviation /x {deviate add {max-elements 1;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate add {max-elements 1;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation adding \"max-elements\" property which already exists (with value \"5\"). /mm8:{deviation='/x'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module mm9 {namespace urn:mm9;prefix mm9; leaf-list x {type string;}"
-                              "deviation /x {deviate replace {min-elements 1;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate replace {min-elements 1;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation replacing \"min-elements\" property which is not present. /mm9:{deviation='/x'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module mm10 {namespace urn:mm10;prefix mm10; list x {config false;}"
-                              "deviation /x {deviate replace {min-elements 1;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate replace {min-elements 1;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation replacing \"min-elements\" property which is not present. /mm10:{deviation='/x'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module mm11 {namespace urn:mm11;prefix mm11; leaf-list x {type string;}"
-                              "deviation /x {deviate replace {max-elements 1;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate replace {max-elements 1;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation replacing \"max-elements\" property which is not present. /mm11:{deviation='/x'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module mm12 {namespace urn:mm12;prefix mm12; list x {config false; }"
-                              "deviation /x {deviate replace {max-elements 1;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate replace {max-elements 1;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation replacing \"max-elements\" property which is not present. /mm12:{deviation='/x'}");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module nn1 {namespace urn:nn1;prefix nn1; anyxml x;"
-                              "deviation /x {deviate replace {type string;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate replace {type string;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid deviation of anyxml node - it is not possible to replace \"type\" property. /nn1:{deviation='/x'}");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module nn2 {namespace urn:nn2;prefix nn2; leaf-list x {type string;}"
-                              "deviation /x {deviate replace {type empty;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate replace {type empty;}}}", LYS_IN_YANG, &mod));
     /*logbuf_assert("Leaf-list of type \"empty\" is allowed only in YANG 1.1 modules. /nn2:{deviation='/x'}");*/
     logbuf_assert("Compilation of a deviated and/or refined node failed. /nn2:x");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module oo1 {namespace urn:oo1;prefix oo1; leaf x {type uint16; default 300;}"
-                                  "deviation /x {deviate replace {type uint8;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate replace {type uint8;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid default - value does not fit the type "
-                  "(Value \"300\" is out of uint8's min/max bounds.). /oo1:x");
+            "(Value \"300\" is out of uint8's min/max bounds.). /oo1:x");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module oo2 {yang-version 1.1;namespace urn:oo2;prefix oo2; leaf-list x {type uint16; default 10; default 300;}"
-                                  "deviation /x {deviate replace {type uint8;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate replace {type uint8;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid default - value does not fit the type "
-                  "(Value \"300\" is out of uint8's min/max bounds.). /oo2:x");
+            "(Value \"300\" is out of uint8's min/max bounds.). /oo2:x");
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module oo3 {namespace urn:oo3;prefix oo3; leaf x {type uint8;}"
-                                  "deviation /x {deviate add {default 300;}}}", LYS_IN_YANG, &mod));
+            "deviation /x {deviate add {default 300;}}}", LYS_IN_YANG, &mod));
     logbuf_assert("Invalid default - value does not fit the type "
-                  "(Value \"300\" is out of uint8's min/max bounds.). /oo3:x");
+            "(Value \"300\" is out of uint8's min/max bounds.). /oo3:x");
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, "module pp {namespace urn:pp;prefix pp; leaf l { type leafref {path /c/x;}}"
-                                  "container c {leaf x {type string;} leaf y {type string;}}}", LYS_IN_YANG, &mod));
+            "container c {leaf x {type string;} leaf y {type string;}}}", LYS_IN_YANG, &mod));
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx, "module pp1 {namespace urn:pp1;prefix pp1; import pp {prefix pp;}"
-                              "deviation /pp:c/pp:x {deviate not-supported;}}", LYS_IN_YANG, &mod));
+            "deviation /pp:c/pp:x {deviate not-supported;}}", LYS_IN_YANG, &mod));
     logbuf_assert("Not found node \"x\" in path. /pp:l");
 
     *state = NULL;
@@ -3359,109 +3351,110 @@
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, LY_CTX_DISABLE_SEARCHDIRS, &ctx));
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx,
-        "module a {"
-            "namespace urn:a;"
-            "prefix a;"
-            "container cont {"
-                "leaf l {"
-                    "when \"/cont/lst[val='25']\";"
-                    "type empty;"
-                "}"
-                "list lst {"
-                    "key \"k\";"
-                    "leaf k {"
-                        "type uint8;"
-                    "}"
-                    "leaf val {"
-                        "when /cont2;"
-                        "type int32;"
-                    "}"
-                "}"
-            "}"
-            "container cont2 {"
-                "presence \"a\";"
-                "when ../cont/l;"
-            "}"
-        "}"
-    , LYS_IN_YANG, NULL));
+            "module a {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    container cont {\n"
+            "        leaf l {\n"
+            "            when \"/cont/lst[val='25']\";\n"
+            "            type empty;\n"
+            "        }\n"
+            "        list lst {\n"
+            "            key \"k\";\n"
+            "            leaf k {\n"
+            "                type uint8;\n"
+            "            }\n"
+            "            leaf val {\n"
+            "                when /cont2;\n"
+            "                type int32;\n"
+            "            }\n"
+            "        }\n"
+            "    }\n"
+            "    container cont2 {\n"
+            "        presence \"a\";\n"
+            "        when ../cont/l;\n"
+            "    }\n"
+            "}",
+            LYS_IN_YANG, NULL));
     logbuf_assert("When condition of \"val\" includes a self-reference (referenced by when of \"cont2\"). /a:cont/lst/val");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx,
-        "module a {"
-            "namespace urn:a;"
-            "prefix a;"
-            "container cont {"
-                "leaf l {"
-                    "when \"/cont/lst[val='25']\";"
-                    "type empty;"
-                "}"
-                "list lst {"
-                    "key \"k\";"
-                    "leaf k {"
-                        "type uint8;"
-                    "}"
-                    "leaf val {"
-                        "when /cont2;"
-                        "type int32;"
-                    "}"
-                "}"
-            "}"
-            "container cont2 {"
-                "presence \"a\";"
-                "when ../cont/lst/val;"
-            "}"
-        "}"
-    , LYS_IN_YANG, NULL));
+            "module a {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    container cont {\n"
+            "        leaf l {\n"
+            "            when \"/cont/lst[val='25']\";\n"
+            "            type empty;\n"
+            "        }\n"
+            "        list lst {\n"
+            "            key \"k\";\n"
+            "            leaf k {\n"
+            "                type uint8;\n"
+            "            }\n"
+            "            leaf val {\n"
+            "                when /cont2;\n"
+            "                type int32;\n"
+            "            }\n"
+            "        }\n"
+            "    }\n"
+            "    container cont2 {\n"
+            "        presence \"a\";\n"
+            "        when ../cont/lst/val;\n"
+            "    }\n"
+            "}",
+            LYS_IN_YANG, NULL));
     logbuf_assert("When condition of \"val\" includes a self-reference (referenced by when of \"cont2\"). /a:cont/lst/val");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx,
-        "module a {"
-            "namespace urn:a;"
-            "prefix a;"
-            "leaf val {"
-                "type int64;"
-                "when \"../val='25'\";"
-            "}"
-        "}"
-    , LYS_IN_YANG, NULL));
+            "module a {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    leaf val {\n"
+            "        type int64;\n"
+            "        when \"../val='25'\";\n"
+            "    }\n"
+            "}",
+            LYS_IN_YANG, NULL));
     logbuf_assert("When condition of \"val\" is accessing its own conditional node. /a:val");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx,
-        "module a {"
-            "namespace urn:a;"
-            "prefix a;"
-            "grouping grp {"
-                "leaf val {"
-                    "type int64;"
-                "}"
-            "}"
-            "uses grp {"
-                "when \"val='25'\";"
-            "}"
-        "}"
-    , LYS_IN_YANG, NULL));
+            "module a {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    grouping grp {\n"
+            "        leaf val {\n"
+            "            type int64;\n"
+            "        }\n"
+            "    }\n"
+            "    uses grp {\n"
+            "        when \"val='25'\";\n"
+            "    }\n"
+            "}",
+            LYS_IN_YANG, NULL));
     logbuf_assert("When condition of \"val\" is accessing its own conditional node. /a:val");
 
     assert_int_equal(LY_EVALID, lys_parse_mem(ctx,
-        "module a {"
-            "namespace urn:a;"
-            "prefix a;"
-            "augment /cont {"
-                "when \"val='25'\";"
-                "leaf val {"
-                    "type int64;"
-                "}"
-            "}"
-            "container cont;"
-        "}"
-    , LYS_IN_YANG, NULL));
+            "module a {\n"
+            "    namespace urn:a;\n"
+            "    prefix a;\n"
+            "    augment /cont {\n"
+            "        when \"val='25'\";\n"
+            "        leaf val {\n"
+            "            type int64;\n"
+            "        }\n"
+            "    }\n"
+            "    container cont;\n"
+            "}",
+            LYS_IN_YANG, NULL));
     logbuf_assert("When condition of \"val\" is accessing its own conditional node. /a:cont/val");
 
     *state = NULL;
     ly_ctx_destroy(ctx, NULL);
 }
 
-int main(void)
+int
+main(void)
 {
     const struct CMUnitTest tests[] = {
         cmocka_unit_test_setup_teardown(test_module, logger_setup, logger_teardown),