Adding upstream version 3.12.2.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
76b2c91d7e
commit
f3d737b374
66 changed files with 4041 additions and 2142 deletions
|
@ -168,6 +168,21 @@ test_leaf(void **state)
|
|||
PARSER_CHECK_ERROR(data, 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID, "Invalid non-string-encoded string value \"\".", "/a:foo", 1);
|
||||
CHECK_PARSE_LYD(data, LYD_PARSE_JSON_NULL, LYD_VALIDATE_PRESENT, tree);
|
||||
assert_null(tree);
|
||||
|
||||
/* validate integer in quotes errors out by default */
|
||||
data = "{\"a:foo3\":\"1234\"}";
|
||||
PARSER_CHECK_ERROR(data, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
|
||||
"Invalid non-number-encoded uint32 value \"1234\".", "/a:foo3", 1);
|
||||
|
||||
/* validate integers are parsed correctly */
|
||||
data = "{\"a:foo3\":1234}";
|
||||
CHECK_PARSE_LYD(data, 0, LYD_VALIDATE_PRESENT, tree);
|
||||
lyd_free_all(tree);
|
||||
|
||||
/* validate LYD_PARSE_JSON_STRING_DATATYPES parser flag allows integers in quotes */
|
||||
data = "{\"a:foo3\":\"1234\"}";
|
||||
CHECK_PARSE_LYD(data, LYD_PARSE_JSON_STRING_DATATYPES, LYD_VALIDATE_PRESENT, tree);
|
||||
lyd_free_all(tree);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -920,6 +935,25 @@ test_metadata(void **state)
|
|||
CHECK_LOG_CTX("Invalid non-number-encoded int8 value \"value\".", "/a:c/x/@a:hint", 1);
|
||||
}
|
||||
|
||||
static void
|
||||
test_parent(void **state)
|
||||
{
|
||||
const char *data;
|
||||
struct lyd_node *tree;
|
||||
struct ly_in *in;
|
||||
|
||||
/* create the parent */
|
||||
assert_int_equal(LY_SUCCESS, lyd_new_path(NULL, UTEST_LYCTX, "/a:l1[a='vala'][b='valb'][c='25']", NULL, 0, &tree));
|
||||
|
||||
/* parse nested data */
|
||||
data = "{\"cont\":{\"e\":false}}";
|
||||
assert_int_equal(LY_SUCCESS, ly_in_new_memory(data, &in));
|
||||
assert_int_equal(LY_SUCCESS, lyd_parse_data(NULL, tree, in, LYD_JSON, 0, LYD_VALIDATE_PRESENT, NULL));
|
||||
|
||||
ly_in_free(in, 0);
|
||||
lyd_free_tree(tree);
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
|
@ -939,6 +973,7 @@ main(void)
|
|||
UTEST(test_restconf_notification, setup),
|
||||
UTEST(test_restconf_reply, setup),
|
||||
UTEST(test_metadata, setup),
|
||||
UTEST(test_parent, setup),
|
||||
};
|
||||
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue