1
0
Fork 0

Merging upstream version 3.4.2+dfsg.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-05 08:03:59 +01:00
parent 511f72b68b
commit 948b3e00b3
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
75 changed files with 1082 additions and 878 deletions

View file

@ -1233,6 +1233,7 @@ test_type_instanceid(void **state)
{
struct lys_module *mod;
struct lysc_type *type;
char *str;
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module a {namespace urn:a;prefix a;typedef mytype {type instance-identifier {require-instance false;}}"
"leaf l1 {type instance-identifier {require-instance true;}}"
@ -1252,12 +1253,22 @@ test_type_instanceid(void **state)
assert_int_equal(LY_TYPE_INST, type->basetype);
assert_int_equal(1, ((struct lysc_type_instanceid *)type)->require_instance);
/* default value */
str = "module b1 {namespace urn:b1;prefix b1;"
"leaf l1 {type string;}}";
ly_ctx_set_module_imp_clb(UTEST_LYCTX, test_imp_clb, str);
ly_ctx_set_options(UTEST_LYCTX, LY_CTX_REF_IMPLEMENTED);
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module b2 {namespace urn:b2;prefix b2;"
"import b1 {prefix b1;}"
"leaf l1 {type instance-identifier; default \"/b1:l1\";}}", LYS_IN_YANG, NULL));
ly_ctx_set_options(UTEST_LYCTX, 0);
/* invalid cases */
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module aa {namespace urn:aa;prefix aa; leaf l {type instance-identifier {require-instance yes;}}}", LYS_IN_YANG, &mod));
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module aa {namespace urn:aa;prefix aa; leaf l {type instance-identifier {require-instance yes;}}}", LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Parsing module \"aa\" failed.", NULL, 0);
CHECK_LOG_CTX("Invalid value \"yes\" of \"require-instance\".", NULL, 1);
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module aa {namespace urn:aa;prefix aa; leaf l {type instance-identifier {fraction-digits 1;}}}", LYS_IN_YANG, &mod));
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module aa {namespace urn:aa;prefix aa; leaf l {type instance-identifier {fraction-digits 1;}}}", LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Invalid type restrictions for instance-identifier type.", "/aa:l", 0);
}