1
0
Fork 0

Adding upstream version 3.7.8.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-05 08:08:41 +01:00
parent 338ffded6d
commit 76b2c91d7e
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
52 changed files with 13518 additions and 998 deletions

View file

@ -65,6 +65,13 @@ const char *schema_a =
" fraction-digits 5;\n"
" }\n"
" }\n"
" leaf foo5 {\n"
" type decimal64 {\n"
" fraction-digits 1;\n"
" range \"0.5 .. 99.5\";\n"
" }\n"
" must \"(. - 0.5) mod 0.5 = 0\";\n"
" }\n"
" container c {\n"
" leaf x {\n"
" type string;\n"
@ -519,7 +526,7 @@ test_atomize(void **state)
/* some random paths just making sure the API function works */
assert_int_equal(LY_SUCCESS, lys_find_xpath_atoms(UTEST_LYCTX, NULL, "/a:*", 0, &set));
assert_int_equal(7, set->count);
assert_int_equal(8, set->count);
ly_set_free(set, NULL);
/* all nodes from all modules (including internal, which can change easily, so check just the test modules) */
@ -536,7 +543,7 @@ test_atomize(void **state)
ly_set_free(set, NULL);
assert_int_equal(LY_SUCCESS, lys_find_xpath_atoms(UTEST_LYCTX, NULL, "/*", 0, &set));
assert_int_equal(14, set->count);
assert_int_equal(15, set->count);
ly_set_free(set, NULL);
/*
@ -570,7 +577,7 @@ test_atomize(void **state)
/* descendant-or-self */
assert_int_equal(LY_SUCCESS, lys_find_xpath_atoms(UTEST_LYCTX, NULL, "/a:*/descendant-or-self::c", 0, &set));
assert_int_equal(8, set->count);
assert_int_equal(9, set->count);
ly_set_free(set, NULL);
/* following */
@ -585,7 +592,7 @@ test_atomize(void **state)
/* parent */
assert_int_equal(LY_SUCCESS, lys_find_xpath_atoms(UTEST_LYCTX, NULL, "/child::a:*/c/parent::l1", 0, &set));
assert_int_equal(8, set->count);
assert_int_equal(9, set->count);
ly_set_free(set, NULL);
assert_int_equal(LY_SUCCESS, lys_find_xpath_atoms(UTEST_LYCTX, NULL, "/child::a:c//..", 0, &set));
@ -1240,6 +1247,20 @@ test_trim(void **state)
lyd_free_all(tree);
}
static void
test_mod(void **state)
{
const char *data;
struct lyd_node *tree;
data = "<foo5 xmlns=\"urn:tests:a\">10.5</foo5>";
/* parse and validate */
assert_int_equal(LY_SUCCESS, lyd_parse_data_mem(UTEST_LYCTX, data, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, &tree));
assert_non_null(tree);
lyd_free_siblings(tree);
}
int
main(void)
{
@ -1257,6 +1278,7 @@ main(void)
UTEST(test_variables, setup),
UTEST(test_axes, setup),
UTEST(test_trim, setup),
UTEST(test_mod, setup),
};
return cmocka_run_group_tests(tests, NULL, NULL);