tests MAINTENANCE source code formatting
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();