Merging upstream version 3.7.8.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
099007bbc4
commit
a3c6363c26
52 changed files with 13518 additions and 998 deletions
|
@ -163,6 +163,37 @@ test_type_incomplete_when(void **state)
|
|||
lyd_free_all(tree);
|
||||
}
|
||||
|
||||
static void
|
||||
test_unprefixed_ident(void **state)
|
||||
{
|
||||
struct lyd_node *tree;
|
||||
const char *schema =
|
||||
"module a {\n"
|
||||
" namespace urn:tests:a;\n"
|
||||
" prefix a;\n"
|
||||
" yang-version 1.1;\n"
|
||||
"\n"
|
||||
" identity d3 {base d2;}\n"
|
||||
" identity d2 {base d1;}\n"
|
||||
" identity d1;\n"
|
||||
"\n"
|
||||
" leaf a {type identityref {base d1;}}\n"
|
||||
" leaf b {type string; must \"derived-from-or-self(/a, 'd2')\";}\n"
|
||||
" leaf c {type string; when \"derived-from(/a, 'd2')\";}\n"
|
||||
"}";
|
||||
|
||||
UTEST_ADD_MODULE(schema, LYS_IN_YANG, NULL, NULL);
|
||||
|
||||
CHECK_PARSE_LYD_PARAM("<b xmlns=\"urn:tests:a\">hey</b>", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
|
||||
CHECK_LOG_CTX("Must condition \"derived-from-or-self(/a, 'd2')\" not satisfied.", "/a:b", 0);
|
||||
|
||||
CHECK_PARSE_LYD_PARAM("<c xmlns=\"urn:tests:a\">hey</c>", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
|
||||
CHECK_LOG_CTX("When condition \"derived-from(/a, 'd2')\" not satisfied.", "/a:c", 0);
|
||||
|
||||
LYD_TREE_CREATE("<a xmlns=\"urn:tests:a\">d3</a><b xmlns=\"urn:tests:a\">b-val</b><c xmlns=\"urn:tests:a\">c-val</c>", tree);
|
||||
lyd_free_all(tree);
|
||||
}
|
||||
|
||||
static void
|
||||
test_mandatory(void **state)
|
||||
{
|
||||
|
@ -1515,6 +1546,20 @@ test_case(void **state)
|
|||
CHECK_LOG_CTX("Data for both cases \"v0\" and \"v2\" exist.", "/k:ch", 6);
|
||||
}
|
||||
|
||||
static void
|
||||
test_pattern(void **UNUSED(state))
|
||||
{
|
||||
pcre2_code *pcode = NULL;
|
||||
|
||||
assert_int_equal(ly_pattern_match(NULL, "a.b.c", "abc", 0, NULL), LY_ENOT);
|
||||
assert_int_equal(ly_pattern_match(NULL, "a.b.c", "a0b1c", 0, NULL), LY_SUCCESS);
|
||||
|
||||
assert_int_equal(ly_pattern_match(NULL, "a.b.c", "abc", 0, &pcode), LY_ENOT);
|
||||
assert_int_equal(ly_pattern_match(NULL, NULL, "a0b1c", 0, &pcode), LY_SUCCESS);
|
||||
|
||||
pcre2_code_free(pcode);
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
|
@ -1523,6 +1568,7 @@ main(void)
|
|||
UTEST(test_mandatory),
|
||||
UTEST(test_mandatory_when),
|
||||
UTEST(test_type_incomplete_when),
|
||||
UTEST(test_unprefixed_ident),
|
||||
UTEST(test_minmax),
|
||||
UTEST(test_unique),
|
||||
UTEST(test_unique_nested),
|
||||
|
@ -1535,6 +1581,7 @@ main(void)
|
|||
UTEST(test_rpc),
|
||||
UTEST(test_reply),
|
||||
UTEST(test_case),
|
||||
UTEST(test_pattern),
|
||||
};
|
||||
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue