validation NEW default values creation
Also a lot of other refactoring and
improvements. No tests yet.
diff --git a/tests/features/test_types.c b/tests/features/test_types.c
index 751f78a..a08b3ce 100644
--- a/tests/features/test_types.c
+++ b/tests/features/test_types.c
@@ -155,7 +155,7 @@
const char *data = "<int8 xmlns=\"urn:tests:types\">\n 15 \t\n </int8>";
/* valid data */
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("int8", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -172,28 +172,28 @@
/* invalid range */
data = "<int8 xmlns=\"urn:tests:types\">1</int8>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Value \"1\" does not satisfy the range constraint. /");
data = "<int16 xmlns=\"urn:tests:types\">100</int16>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Value \"100\" does not satisfy the range constraint. /");
/* invalid value */
data = "<int32 xmlns=\"urn:tests:types\">0x01</int32>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid int32 value \"0x01\". /");
data = "<int64 xmlns=\"urn:tests:types\"></int64>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid empty int64 value. /");
data = "<int64 xmlns=\"urn:tests:types\"> </int64>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid empty int64 value. /");
data = "<int64 xmlns=\"urn:tests:types\">-10 xxx</int64>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid int64 value \"-10 xxx\". /");
s->func = NULL;
@@ -212,7 +212,7 @@
const char *data = "<uint8 xmlns=\"urn:tests:types\">\n 150 \t\n </uint8>";
/* valid data */
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("uint8", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -229,28 +229,28 @@
/* invalid range */
data = "<uint8 xmlns=\"urn:tests:types\">\n 15 \t\n </uint8>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Value \"15\" does not satisfy the range constraint. /");
data = "<uint16 xmlns=\"urn:tests:types\">\n 1500 \t\n </uint16>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Value \"1500\" does not satisfy the range constraint. /");
/* invalid value */
data = "<uint32 xmlns=\"urn:tests:types\">-10</uint32>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Value \"-10\" is out of uint32's min/max bounds. /");
data = "<uint64 xmlns=\"urn:tests:types\"/>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid empty uint64 value. /");
data = "<uint64 xmlns=\"urn:tests:types\"> </uint64>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid empty uint64 value. /");
data = "<uint64 xmlns=\"urn:tests:types\">10 xxx</uint64>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid uint64 value \"10 xxx\". /");
s->func = NULL;
@@ -269,7 +269,7 @@
const char *data = "<dec64 xmlns=\"urn:tests:types\">\n +8 \t\n </dec64>";
/* valid data */
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("dec64", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -285,7 +285,7 @@
lyd_free_all(tree);
data = "<dec64 xmlns=\"urn:tests:types\">8.00</dec64>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("dec64", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -294,7 +294,7 @@
lyd_free_all(tree);
data = "<dec64-norestr xmlns=\"urn:tests:types\">-9.223372036854775808</dec64-norestr>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("dec64-norestr", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -303,7 +303,7 @@
lyd_free_all(tree);
data = "<dec64-norestr xmlns=\"urn:tests:types\">9.223372036854775807</dec64-norestr>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("dec64-norestr", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -313,32 +313,32 @@
/* invalid range */
data = "<dec64 xmlns=\"urn:tests:types\">\n 15 \t\n </dec64>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Value \"15.0\" does not satisfy the range constraint. /");
data = "<dec64 xmlns=\"urn:tests:types\">\n 0 \t\n </dec64>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Value \"0.0\" does not satisfy the range constraint. /");
/* invalid value */
data = "<dec64 xmlns=\"urn:tests:types\">xxx</dec64>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid 1. character of decimal64 value \"xxx\". /");
data = "<dec64 xmlns=\"urn:tests:types\"/>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid empty decimal64 value. /");
data = "<dec64 xmlns=\"urn:tests:types\"> </dec64>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid empty decimal64 value. /");
data = "<dec64 xmlns=\"urn:tests:types\">8.5 xxx</dec64>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid 6. character of decimal64 value \"8.5 xxx\". /");
data = "<dec64 xmlns=\"urn:tests:types\">8.55 xxx</dec64>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Value \"8.55\" of decimal64 type exceeds defined number (1) of fraction digits. /");
s->func = NULL;
@@ -356,7 +356,7 @@
const char *data = "<str xmlns=\"urn:tests:types\">teststring</str>";
/* valid data */
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("str", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -365,34 +365,34 @@
/* multibyte characters (€ encodes as 3-byte UTF8 character, length restriction is 2-5) */
data = "<str-utf8 xmlns=\"urn:tests:types\">€€</str-utf8>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("str-utf8", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
assert_string_equal("€€", leaf->value.canonical_cache);
lyd_free_all(tree);
data = "<str-utf8 xmlns=\"urn:tests:types\">€</str-utf8>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Length \"1\" does not satisfy the length constraint. /");
data = "<str-utf8 xmlns=\"urn:tests:types\">€€€€€€</str-utf8>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Length \"6\" does not satisfy the length constraint. /");
data = "<str-utf8 xmlns=\"urn:tests:types\">€€x</str-utf8>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("String \"€€x\" does not conform to the 1. pattern restriction of its type. /");
/* invalid length */
data = "<str xmlns=\"urn:tests:types\">short</str>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Length \"5\" does not satisfy the length constraint. /");
data = "<str xmlns=\"urn:tests:types\">tooooo long</str>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Length \"11\" does not satisfy the length constraint. /");
/* invalid pattern */
data = "<str xmlns=\"urn:tests:types\">string15</str>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("String \"string15\" does not conform to the 1. pattern restriction of its type. /");
s->func = NULL;
@@ -411,7 +411,7 @@
const char *data = "<bits xmlns=\"urn:tests:types\">\n two \t\nzero\n </bits>";
/* valid data */
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("bits", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -431,7 +431,7 @@
lyd_free_all(tree);
data = "<bits xmlns=\"urn:tests:types\">zero two</bits>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("bits", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -440,12 +440,12 @@
/* disabled feature */
data = "<bits xmlns=\"urn:tests:types\"> \t one \n\t </bits>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Bit \"one\" is disabled by its 1. if-feature condition. /");
/* enable that feature */
assert_int_equal(LY_SUCCESS, lys_feature_enable(ly_ctx_get_module(s->ctx, "types", NULL), "f"));
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("bits", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -463,12 +463,12 @@
/* multiple instances of the bit */
data = "<bits xmlns=\"urn:tests:types\">one zero one</bits>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Bit \"one\" used multiple times. /");
/* invalid bit value */
data = "<bits xmlns=\"urn:tests:types\">one xero one</bits>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid bit value \"xero\". /");
s->func = NULL;
@@ -487,7 +487,7 @@
const char *data = "<enums xmlns=\"urn:tests:types\">white</enums>";
/* valid data */
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("enums", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -503,12 +503,12 @@
/* disabled feature */
data = "<enums xmlns=\"urn:tests:types\">yellow</enums>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Enumeration \"yellow\" is disabled by its 1. if-feature condition. /");
/* enable that feature */
assert_int_equal(LY_SUCCESS, lys_feature_enable(ly_ctx_get_module(s->ctx, "types", NULL), "f"));
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("enums", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -517,15 +517,15 @@
/* leading/trailing whitespaces are not valid */
data = "<enums xmlns=\"urn:tests:types\"> white</enums>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid enumeration value \" white\". /");
data = "<enums xmlns=\"urn:tests:types\">white\n</enums>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid enumeration value \"white\n\". /");
/* invalid enumeration value */
data = "<enums xmlns=\"urn:tests:types\">black</enums>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid enumeration value \"black\". /");
s->func = NULL;
@@ -545,7 +545,7 @@
"<binary-norestr xmlns=\"urn:tests:types\">TQ==</binary-norestr>";
/* valid data (hello) */
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("binary", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -565,21 +565,21 @@
/* no data */
data = "<binary-norestr xmlns=\"urn:tests:types\">\n \t\n </binary-norestr>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("binary-norestr", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
assert_string_equal("", leaf->value.canonical_cache);
lyd_free_all(tree);
data = "<binary-norestr xmlns=\"urn:tests:types\"></binary-norestr>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("binary-norestr", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
assert_string_equal("", leaf->value.canonical_cache);
lyd_free_all(tree);
data = "<binary-norestr xmlns=\"urn:tests:types\"/>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("binary-norestr", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -588,23 +588,23 @@
/* invalid base64 character */
data = "<binary-norestr xmlns=\"urn:tests:types\">a@bcd=</binary-norestr>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid Base64 character (@). /");
/* missing data */
data = "<binary-norestr xmlns=\"urn:tests:types\">aGVsbG8</binary-norestr>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Base64 encoded value length must be divisible by 4. /");
data = "<binary-norestr xmlns=\"urn:tests:types\">VsbG8=</binary-norestr>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Base64 encoded value length must be divisible by 4. /");
/* invalid binary length */
data = "<binary xmlns=\"urn:tests:types\">aGVsbG93b3JsZA==</binary>"; /* helloworld */
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("This base64 value must be of length 5. /");
data = "<binary xmlns=\"urn:tests:types\">TQ==</binary>"; /* M */
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("This base64 value must be of length 5. /");
s->func = NULL;
@@ -622,7 +622,7 @@
const char *data = "<bool xmlns=\"urn:tests:types\">true</bool>";
/* valid data */
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("bool", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -631,7 +631,7 @@
lyd_free_all(tree);
data = "<bool xmlns=\"urn:tests:types\">false</bool>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("bool", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -641,11 +641,11 @@
/* invalid value */
data = "<bool xmlns=\"urn:tests:types\">unsure</bool>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid boolean value \"unsure\". /");
data = "<bool xmlns=\"urn:tests:types\"> true</bool>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid boolean value \" true\". /");
s->func = NULL;
@@ -663,7 +663,7 @@
const char *data = "<empty xmlns=\"urn:tests:types\"></empty>";
/* valid data */
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("empty", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -671,7 +671,7 @@
lyd_free_all(tree);
data = "<empty xmlns=\"urn:tests:types\"/>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("empty", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -680,11 +680,11 @@
/* invalid value */
data = "<empty xmlns=\"urn:tests:types\">x</empty>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid empty value \"x\". /");
data = "<empty xmlns=\"urn:tests:types\"> </empty>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid empty value \" \". /");
s->func = NULL;
@@ -723,7 +723,7 @@
const char *data = "<ident xmlns=\"urn:tests:types\">gigabit-ethernet</ident>";
/* valid data */
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("ident", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -739,7 +739,7 @@
lyd_free_all(tree);
data = "<ident xmlns=\"urn:tests:types\" xmlns:x=\"urn:tests:defs\">x:fast-ethernet</ident>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("ident", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -749,19 +749,19 @@
/* invalid value */
data = "<ident xmlns=\"urn:tests:types\">fast-ethernet</ident>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid identityref \"fast-ethernet\" value - identity not found. /");
data = "<ident xmlns=\"urn:tests:types\" xmlns:x=\"urn:tests:defs\">x:slow-ethernet</ident>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid identityref \"x:slow-ethernet\" value - identity not found. /");
data = "<ident xmlns=\"urn:tests:types\" xmlns:x=\"urn:tests:defs\">x:crypto-alg</ident>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid identityref \"x:crypto-alg\" value - identity not accepted by the type specification. /");
data = "<ident xmlns=\"urn:tests:types\" xmlns:x=\"urn:tests:unknown\">x:fast-ethernet</ident>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid identityref \"x:fast-ethernet\" value - unable to map prefix to YANG schema. /");
s->func = NULL;
@@ -793,7 +793,7 @@
"<xdf:inst xmlns:xdf=\"urn:tests:types\">/xdf:cont/xdf:leaftarget</xdf:inst>";
/* valid data */
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
tree = tree->prev;
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("inst", tree->schema->name);
@@ -818,8 +818,8 @@
data = "<list xmlns=\"urn:tests:types\"><id>a</id></list><list xmlns=\"urn:tests:types\"><id>b</id></list>"
"<xdf:inst xmlns:xdf=\"urn:tests:types\">/xdf:list[xdf:id='b']/xdf:id</xdf:inst>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- tree = tree->prev;
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ tree = tree->prev->prev;
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("inst", tree->schema->name);
leaf = (const struct lyd_node_term*)tree;
@@ -828,8 +828,8 @@
data = "<leaflisttarget xmlns=\"urn:tests:types\">1</leaflisttarget><leaflisttarget xmlns=\"urn:tests:types\">2</leaflisttarget>"
"<xdf:inst xmlns:xdf=\"urn:tests:types\">/xdf:leaflisttarget[.='1']</xdf:inst>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- tree = tree->prev;
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ tree = tree->prev->prev;
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("inst", tree->schema->name);
leaf = (const struct lyd_node_term*)tree;
@@ -838,8 +838,8 @@
data = "<list xmlns=\"urn:tests:types\"><id>a</id></list><list xmlns=\"urn:tests:types\"><id>b</id><value>x</value></list>"
"<xdf:inst xmlns:xdf=\"urn:tests:types\">/xdf:list[2]/xdf:value</xdf:inst>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- tree = tree->prev;
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ tree = tree->prev->prev;
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("inst", tree->schema->name);
leaf = (const struct lyd_node_term*)tree;
@@ -850,8 +850,8 @@
"<list_inst xmlns=\"urn:tests:types\"><id xmlns:b=\"urn:tests:types\">/b:leaflisttarget[.='b']</id><value>y</value></list_inst>"
"<leaflisttarget xmlns=\"urn:tests:types\">a</leaflisttarget><leaflisttarget xmlns=\"urn:tests:types\">b</leaflisttarget>"
"<a:inst xmlns:a=\"urn:tests:types\">/a:list_inst[a:id=\"/a:leaflisttarget[.='b']\"]/a:value</a:inst>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- tree = tree->prev;
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ tree = tree->prev->prev;
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("inst", tree->schema->name);
leaf = (const struct lyd_node_term*)tree;
@@ -880,8 +880,8 @@
"<list_inst xmlns=\"urn:tests:types\"><id xmlns:b=\"urn:tests:types\">/b:leaflisttarget[2]</id><value>y</value></list_inst>"
"<leaflisttarget xmlns=\"urn:tests:types\">a</leaflisttarget><leaflisttarget xmlns=\"urn:tests:types\">b</leaflisttarget>"
"<a:inst xmlns:a=\"urn:tests:types\">/a:list_inst[a:id=\"/a:leaflisttarget[2]\"]/a:value</a:inst>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- tree = tree->prev;
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ tree = tree->prev->prev;
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("inst", tree->schema->name);
leaf = (const struct lyd_node_term*)tree;
@@ -891,8 +891,8 @@
data = "<list_ident xmlns=\"urn:tests:types\"><id xmlns:dfs=\"urn:tests:defs\">dfs:ethernet</id><value>x</value></list_ident>"
"<list_ident xmlns=\"urn:tests:types\"><id xmlns:dfs=\"urn:tests:defs\">dfs:fast-ethernet</id><value>y</value></list_ident>"
"<a:inst xmlns:a=\"urn:tests:types\" xmlns:d=\"urn:tests:defs\">/a:list_ident[a:id='d:fast-ethernet']/a:value</a:inst>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- tree = tree->prev;
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ tree = tree->prev->prev;
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("inst", tree->schema->name);
leaf = (const struct lyd_node_term*)tree;
@@ -902,8 +902,8 @@
data = "<list2 xmlns=\"urn:tests:types\"><id>types:xxx</id><value>x</value></list2>"
"<list2 xmlns=\"urn:tests:types\"><id>a:xxx</id><value>y</value></list2>"
"<a:inst xmlns:a=\"urn:tests:types\">/a:list2[a:id='a:xxx'][a:value='y']/a:value</a:inst>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- tree = tree->prev;
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ tree = tree->prev->prev;
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("inst", tree->schema->name);
leaf = (const struct lyd_node_term*)tree;
@@ -913,8 +913,8 @@
data = "<list xmlns=\"urn:tests:types\"><id>types:xxx</id><value>x</value></list>"
"<list xmlns=\"urn:tests:types\"><id>a:xxx</id><value>y</value></list>"
"<a:inst xmlns:a=\"urn:tests:types\">/a:list[2]/a:value</a:inst>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- tree = tree->prev;
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ tree = tree->prev->prev;
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("inst", tree->schema->name);
leaf = (const struct lyd_node_term*)tree;
@@ -925,8 +925,8 @@
"<list2 xmlns=\"urn:tests:types\"><id>c</id><value>b</value></list2>"
"<list2 xmlns=\"urn:tests:types\"><id>a</id><value>b</value></list2>"
"<a:inst xmlns:a=\"urn:tests:types\">/a:list2[a:id='a'][a:value='b']/a:id</a:inst>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- tree = tree->prev;
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ tree = tree->prev->prev;
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("inst", tree->schema->name);
leaf = (const struct lyd_node_term*)tree;
@@ -939,136 +939,136 @@
/* invalid value */
data = "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:1leaftarget</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/t:cont/t:1leaftarget\" value at character 11 (1leaftarget). /");
data = "<t:inst xmlns:t=\"urn:tests:types\">/t:cont:t:1leaftarget</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/t:cont:t:1leaftarget\" value at character 8 (:t:1leaftarget). /");
data = "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:invalid/t:path</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/t:cont/t:invalid/t:path\" value - path \"/t:cont/t:invalid\" does not exists in the YANG schema. /");
data = "<inst xmlns=\"urn:tests:types\" xmlns:t=\"urn:tests:invalid\">/t:cont/t:leaftarget</inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/t:cont/t:leaftarget\" value - unable to map prefix \"t\" to YANG schema. /");
data = "<inst xmlns=\"urn:tests:types\">/cont/leaftarget</inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/cont/leaftarget\" value - all node names (/cont) MUST be qualified with explicit namespace prefix. /");
data = "<cont xmlns=\"urn:tests:types\"/><t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaftarget</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
/* instance-identifier is here in JSON format because it is already in internal representation without original prefixes */
logbuf_assert("Invalid instance-identifier \"/types:cont/leaftarget\" value - required instance not found. /");
data = "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaftarget</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
/* instance-identifier is here in JSON format because it is already in internal representation without original prefixes */
logbuf_assert("Invalid instance-identifier \"/types:cont/leaftarget\" value - required instance not found. /");
data = "<leaflisttarget xmlns=\"urn:tests:types\">x</leaflisttarget><t:inst xmlns:t=\"urn:tests:types\">/t:leaflisttarget[1</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/t:leaflisttarget[1\" value's predicate \"[1\" (Predicate (pos) is not terminated by ']' character.). /");
data = "<cont xmlns=\"urn:tests:types\"/><t:inst xmlns:t=\"urn:tests:types\">/t:cont[1]</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/t:cont[1]\" value - predicate \"[1]\" for container is not accepted. /");
data = "<cont xmlns=\"urn:tests:types\"/><t:inst xmlns:t=\"urn:tests:types\">[1]</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"[1]\" value - instance-identifier must starts with '/'. /");
data = "<cont xmlns=\"urn:tests:types\"><leaflisttarget>1</leaflisttarget></cont><t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[id='1']</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/t:cont/t:leaflisttarget[id='1']\" value's predicate \"[id=\" (Missing prefix of a node name.). /");
data = "<cont xmlns=\"urn:tests:types\"><leaflisttarget>1</leaflisttarget></cont><t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[t:id='1']</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/t:cont/t:leaflisttarget[t:id='1']\" value - key-predicate \"[t:id='1']\" is accepted only for lists, not leaf-list. /");
data = "<cont xmlns=\"urn:tests:types\"><leaflisttarget>1</leaflisttarget><leaflisttarget>2</leaflisttarget></cont>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[4]</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
/* instance-identifier is here in JSON format because it is already in internal representation without original prefixes */
logbuf_assert("Invalid instance-identifier \"/types:cont/leaflisttarget[4]\" value - required instance not found. /");
data = "<t:inst-noreq xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[6]</t:inst-noreq>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/t:cont/t:leaflisttarget[6]\" value - "
"position-predicate 6 is bigger than allowed max-elements (5). /");
data = "<cont xmlns=\"urn:tests:types\"><listtarget><id>1</id><value>x</value></listtarget></cont>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:value='x']</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/t:cont/t:listtarget[t:value='x']\" value - "
"node \"value\" used in key-predicate \"[t:value='x']\" must be a key. /");
logbuf_clean();
data = "<t:inst-noreq xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:value='x']</t:inst-noreq>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/t:cont/t:listtarget[t:value='x']\" value - "
"node \"value\" used in key-predicate \"[t:value='x']\" must be a key. /");
data = "<t:inst-noreq xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:x='x']</t:inst-noreq>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/t:cont/t:listtarget[t:x='x']\" value - "
"path \"/t:cont/t:listtarget[t:x\" does not exists in the YANG schema. /");
data = "<cont xmlns=\"urn:tests:types\"><listtarget><id>1</id><value>x</value></listtarget></cont>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[.='x']</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/t:cont/t:listtarget[.='x']\" value - "
"leaf-list-predicate \"[.='x']\" is accepted only for leaf-lists, not list. /");
data = "<cont xmlns=\"urn:tests:types\"><leaflisttarget>1</leaflisttarget></cont>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[.='2']</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
/* instance-identifier is here in JSON format because it is already in internal representation without original prefixes */
logbuf_assert("Invalid instance-identifier \"/types:cont/leaflisttarget[.='2']\" value - required instance not found. /");
data = "<cont xmlns=\"urn:tests:types\"><leaflisttarget>1</leaflisttarget></cont>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[.='x']</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/t:cont/t:leaflisttarget[.='x']\" value - "
"leaf-list-predicate \"[.='x']\"'s value is invalid. /");
data = "<cont xmlns=\"urn:tests:types\"><listtarget><id>1</id><value>x</value></listtarget></cont>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:id='x']</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/t:cont/t:listtarget[t:id='x']\" value - "
"key-predicate \"[t:id='x']\"'s key value is invalid. /");
data = "<cont xmlns=\"urn:tests:types\"><listtarget><id>1</id><value>x</value></listtarget></cont>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:id='2']</t:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
/* instance-identifier is here in JSON format because it is already in internal representation without original prefixes */
logbuf_assert("Invalid instance-identifier \"/types:cont/listtarget[id='2']\" value - required instance not found. /");
data = "<leaflisttarget xmlns=\"urn:tests:types\">a</leaflisttarget>"
"<leaflisttarget xmlns=\"urn:tests:types\">b</leaflisttarget>"
"<a:inst xmlns:a=\"urn:tests:types\">/a:leaflisttarget[1][2]</a:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/a:leaflisttarget[1][2]\" value - "
"position predicate (\"[2]\") cannot be used repeatedly for a single node. /");
data = "<leaflisttarget xmlns=\"urn:tests:types\">a</leaflisttarget>"
"<leaflisttarget xmlns=\"urn:tests:types\">b</leaflisttarget>"
"<a:inst xmlns:a=\"urn:tests:types\">/a:leaflisttarget[.='a'][.='b']</a:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/a:leaflisttarget[.='a'][.='b']\" value - "
"leaf-list-predicate (\"[.='b']\") cannot be used repeatedly for a single node. /");
data = "<list xmlns=\"urn:tests:types\"><id>a</id><value>x</value></list>"
"<list xmlns=\"urn:tests:types\"><id>b</id><value>y</value></list>"
"<a:inst xmlns:a=\"urn:tests:types\">/a:list[a:id='a'][a:id='b']/a:value</a:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/a:list[a:id='a'][a:id='b']/a:value\" value - "
"key \"id\" is referenced the second time in key-predicate \"[a:id='b']\". /");
data = "<list2 xmlns=\"urn:tests:types\"><id>a</id><value>x</value></list2>"
"<list2 xmlns=\"urn:tests:types\"><id>b</id><value>y</value></list2>"
"<a:inst xmlns:a=\"urn:tests:types\">/a:list2[a:id='a']/a:value</a:inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/a:list2[a:id='a']/a:value\" value - "
"missing 1 key(s) for the list instance \"a:list2[a:id='a']\". /");
@@ -1078,23 +1078,23 @@
"<leaflisttarget xmlns=\"urn:tests:types\">a</leaflisttarget>"
"<leaflisttarget xmlns=\"urn:tests:types\">b</leaflisttarget>"
"<a:inst xmlns:a=\"urn:tests:types\">/a:list2[a:id='a'][a:value='a']/a:id</a:inst>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
trees = lyd_trees_new(1, tree);
/* key-predicate */
data = "/a:list2[a:id='a'][a:value='b']/a:id";
- assert_int_equal(LY_EVALID, lyd_value_validate(s->ctx, (const struct lyd_node_term*)tree->prev, data, strlen(data),
+ assert_int_equal(LY_EVALID, lyd_value_validate(s->ctx, (const struct lyd_node_term*)tree->prev->prev, data, strlen(data),
test_instanceid_getprefix, tree->schema->module, LYD_XML, trees));
logbuf_assert("Invalid instance-identifier \"/a:list2[a:id='a'][a:value='b']/a:id\" value - "
"key-predicate \"[a:id='a'][a:value='b']\" does not match any \"list2\" instance. /");
/* leaf-list-predicate */
data = "/a:leaflisttarget[.='c']";
- assert_int_equal(LY_EVALID, lyd_value_validate(s->ctx, (const struct lyd_node_term*)tree->prev, data, strlen(data),
+ assert_int_equal(LY_EVALID, lyd_value_validate(s->ctx, (const struct lyd_node_term*)tree->prev->prev, data, strlen(data),
test_instanceid_getprefix, tree->schema->module, LYD_XML, trees));
logbuf_assert("Invalid instance-identifier \"/a:leaflisttarget[.='c']\" value - "
"leaf-list-predicate \"[.='c']\" does not match any \"leaflisttarget\" instance. /");
/* position predicate */
data = "/a:list2[4]";
- assert_int_equal(LY_EVALID, lyd_value_validate(s->ctx, (const struct lyd_node_term*)tree->prev, data, strlen(data),
+ assert_int_equal(LY_EVALID, lyd_value_validate(s->ctx, (const struct lyd_node_term*)tree->prev->prev, data, strlen(data),
test_instanceid_getprefix, tree->schema->module, LYD_XML, trees));
logbuf_assert("Invalid instance-identifier \"/a:list2[4]\" value - "
"position-predicate 4 is bigger than number of instances in the data tree (2). /");
@@ -1102,7 +1102,7 @@
data = "<leaflisttarget xmlns=\"urn:tests:types\">b</leaflisttarget>"
"<inst xmlns=\"urn:tests:types\">/a:leaflisttarget[1]</inst>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid instance-identifier \"/a:leaflisttarget[1]\" value - unable to map prefix \"a\" to YANG schema. /");
s->func = NULL;
@@ -1134,8 +1134,8 @@
assert_non_null(lys_parse_mem(s->ctx, schema, LYS_IN_YANG));
/* valid data */
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- tree = tree->prev;
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ tree = tree->prev->prev;
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("lref", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -1146,8 +1146,8 @@
data = "<list xmlns=\"urn:tests:types\"><id>x</id><targets>a</targets><targets>b</targets></list>"
"<list xmlns=\"urn:tests:types\"><id>y</id><targets>x</targets><targets>y</targets></list>"
"<str-norestr xmlns=\"urn:tests:types\">y</str-norestr><lref2 xmlns=\"urn:tests:types\">y</lref2>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- tree = tree->prev;
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ tree = tree->prev->prev;
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("lref2", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -1156,7 +1156,7 @@
data = "<str-norestr xmlns=\"urn:tests:types\">y</str-norestr>"
"<c xmlns=\"urn:tests:leafrefs\"><l><id>x</id><value>x</value><lr1>y</lr1></l></c>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
tree = tree->prev;
assert_int_equal(LYS_CONTAINER, tree->schema->nodetype);
leaf = (struct lyd_node_term*)(lyd_node_children(lyd_node_children(tree))->prev);
@@ -1168,10 +1168,10 @@
data = "<str-norestr xmlns=\"urn:tests:types\">y</str-norestr>"
"<c xmlns=\"urn:tests:leafrefs\"><l><id>y</id><value>y</value></l>"
"<l><id>x</id><value>x</value><lr2>y</lr2></l></c>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
tree = tree->prev;
assert_int_equal(LYS_CONTAINER, tree->schema->nodetype);
- leaf = (struct lyd_node_term*)(lyd_node_children(lyd_node_children(tree)->prev)->prev);
+ leaf = (struct lyd_node_term*)(lyd_node_children(lyd_node_children(tree)->prev->prev)->prev);
assert_int_equal(LYS_LEAF, leaf->schema->nodetype);
assert_string_equal("lr2", leaf->schema->name);
assert_string_equal("y", leaf->value.canonical_cache);
@@ -1181,8 +1181,8 @@
"<list xmlns=\"urn:tests:types\"><id>y</id><targets>c</targets><targets>d</targets></list>"
"<c xmlns=\"urn:tests:leafrefs\"><x><x>y</x></x>"
"<l><id>x</id><value>x</value><lr3>c</lr3></l></c>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- tree = tree->prev;
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ tree = tree->prev->prev->prev;
assert_int_equal(LYS_CONTAINER, tree->schema->nodetype);
leaf = (struct lyd_node_term*)(lyd_node_children(lyd_node_children(tree)->prev)->prev);
assert_int_equal(LYS_LEAF, leaf->schema->nodetype);
@@ -1193,34 +1193,34 @@
/* invalid value */
data = "<leaflisttarget xmlns=\"urn:tests:types\">x</leaflisttarget>"
"<lref xmlns=\"urn:tests:types\">y</lref>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid leafref value \"y\" - required instance \"/leaflisttarget\" with this value does not exists in the data tree(s). /");
data = "<list xmlns=\"urn:tests:types\"><id>x</id><targets>a</targets><targets>b</targets></list>"
"<list xmlns=\"urn:tests:types\"><id>y</id><targets>x</targets><targets>y</targets></list>"
"<str-norestr xmlns=\"urn:tests:types\">y</str-norestr><lref2 xmlns=\"urn:tests:types\">b</lref2>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid leafref value \"b\" - required instance \"../list[id = current()/../str-norestr]/targets\" with this value does not exists in the data tree(s). /");
data = "<list xmlns=\"urn:tests:types\"><id>x</id><targets>a</targets><targets>b</targets></list>"
"<list xmlns=\"urn:tests:types\"><id>y</id><targets>x</targets><targets>y</targets></list>"
"<lref2 xmlns=\"urn:tests:types\">b</lref2>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid leafref - required instance \"../list[id = current()/../str-norestr]\" does not exists in the data tree(s). /");
data = "<str-norestr xmlns=\"urn:tests:types\">y</str-norestr><lref2 xmlns=\"urn:tests:types\">b</lref2>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid leafref - required instance \"../list\" does not exists in the data tree(s). /");
data = "<str-norestr xmlns=\"urn:tests:types\">y</str-norestr>"
"<c xmlns=\"urn:tests:leafrefs\"><l><id>x</id><value>x</value><lr1>a</lr1></l></c>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid leafref value \"a\" - required instance \"../../../t:str-norestr\" with this value does not exists in the data tree(s). /");
data = "<str-norestr xmlns=\"urn:tests:types\">z</str-norestr>"
"<c xmlns=\"urn:tests:leafrefs\"><l><id>y</id><value>y</value></l>"
"<l><id>x</id><value>x</value><lr2>z</lr2></l></c>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid leafref - required instance \"../../l[id=current()/../../../t:str-norestr][value=current()/../../../t:str-norestr]\" "
"does not exists in the data tree(s). /");
@@ -1253,8 +1253,8 @@
"<un1 xmlns=\"urn:tests:types\">12</un1>";
/* valid data */
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- tree = tree->prev;
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ tree = tree->prev->prev;
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("un1", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -1281,8 +1281,8 @@
data = "<int8 xmlns=\"urn:tests:types\">11</int8><int8 xmlns=\"urn:tests:types\">12</int8>"
"<un1 xmlns=\"urn:tests:types\">2</un1>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- tree = tree->prev;
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ tree = tree->prev->prev;
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("un1", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -1295,7 +1295,7 @@
lyd_free_all(tree);
data = "<un1 xmlns=\"urn:tests:types\" xmlns:x=\"urn:tests:defs\">x:fast-ethernet</un1>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("un1", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -1321,7 +1321,7 @@
lyd_free_all(tree);
data = "<un1 xmlns=\"urn:tests:types\" xmlns:d=\"urn:tests:defs\">d:superfast-ethernet</un1>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("un1", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -1335,8 +1335,8 @@
data = "<leaflisttarget xmlns=\"urn:tests:types\">x</leaflisttarget><leaflisttarget xmlns=\"urn:tests:types\">y</leaflisttarget>"
"<un1 xmlns=\"urn:tests:types\" xmlns:a=\"urn:tests:types\">/a:leaflisttarget[2]</un1>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- tree = tree->prev;
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ tree = tree->prev->prev;
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("un1", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -1350,8 +1350,8 @@
data = "<leaflisttarget xmlns=\"urn:tests:types\">x</leaflisttarget><leaflisttarget xmlns=\"urn:tests:types\">y</leaflisttarget>"
"<un1 xmlns=\"urn:tests:types\" xmlns:a=\"urn:tests:types\">/a:leaflisttarget[3]</un1>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- tree = tree->prev;
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ tree = tree->prev->prev;
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("un1", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
@@ -1364,7 +1364,7 @@
lyd_free_all(tree);
data = "<un1 xmlns=\"urn:tests:types\">123456789012345678901</un1>";
- assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_null(lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
logbuf_assert("Invalid union value \"123456789012345678901\" - no matching subtype found. /");
s->func = NULL;
diff --git a/tests/src/test_parser_xml.c b/tests/src/test_parser_xml.c
index dcdf84a..5b08f23 100644
--- a/tests/src/test_parser_xml.c
+++ b/tests/src/test_parser_xml.c
@@ -110,7 +110,7 @@
struct lyd_node *tree;
struct lyd_node_term *leaf;
- assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_non_null(tree);
assert_int_equal(LYS_LEAF, tree->schema->nodetype);
assert_string_equal("foo", tree->schema->name);
@@ -132,7 +132,7 @@
struct lyd_node *tree;
struct lyd_node_any *any;
- assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_non_null(tree);
assert_int_equal(LYS_ANYDATA, tree->schema->nodetype);
assert_string_equal("any", tree->schema->name);
@@ -155,7 +155,7 @@
struct lyd_node_term *leaf;
/* check hashes */
- assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_non_null(tree);
assert_int_equal(LYS_LIST, tree->schema->nodetype);
assert_string_equal("l1", tree->schema->name);
@@ -167,7 +167,7 @@
/* keys order */
data = "<l1 xmlns=\"urn:tests:a\"><d>d</d><a>a</a><c>c</c><b>b</b></l1>";
- assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_non_null(tree);
assert_int_equal(LYS_LIST, tree->schema->nodetype);
assert_string_equal("l1", tree->schema->name);
@@ -184,7 +184,7 @@
lyd_free_all(tree);
data = "<l1 xmlns=\"urn:tests:a\"><c>c</c><b>b</b><a>a</a></l1>";
- assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_non_null(tree);
assert_int_equal(LYS_LIST, tree->schema->nodetype);
assert_string_equal("l1", tree->schema->name);
@@ -219,7 +219,7 @@
struct lyd_node *tree;
struct lyd_node_inner *cont;
- assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_non_null(tree);
assert_int_equal(LYS_CONTAINER, tree->schema->nodetype);
assert_string_equal("c", tree->schema->name);
@@ -228,7 +228,7 @@
lyd_free_all(tree);
data = "<cp xmlns=\"urn:tests:a\"/>";
- assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_non_null(tree);
assert_int_equal(LYS_CONTAINER, tree->schema->nodetype);
assert_string_equal("cp", tree->schema->name);
diff --git a/tests/src/test_printer_xml.c b/tests/src/test_printer_xml.c
index 2c815d1..c5c6714 100644
--- a/tests/src/test_printer_xml.c
+++ b/tests/src/test_printer_xml.c
@@ -159,7 +159,7 @@
data = "<int8 xmlns=\"urn:tests:types\">\n 15 \t\n </int8>";
result = "<int8 xmlns=\"urn:tests:types\">15</int8>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_true((len = lyd_print_mem(&printed, tree, LYD_XML, 0)) >= 0);
assert_int_equal(len, strlen(printed));
assert_string_equal(printed, result);
@@ -181,7 +181,7 @@
s->func = test_anydata;
data = "<any xmlns=\"urn:tests:types\"><somexml xmlns:x=\"url:x\" xmlns=\"example.com\"><x:x/></somexml></any>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_true((len = lyd_print_mem(&printed, tree, LYD_XML, 0)) >= 0);
assert_int_equal(len, strlen(printed));
assert_string_equal(printed, data);
@@ -189,7 +189,7 @@
lyd_free_all(tree);
data = "<any xmlns=\"urn:tests:types\"/>";
- assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_true((len = lyd_print_mem(&printed, tree, LYD_XML, 0)) >= 0);
assert_int_equal(len, strlen(printed));
assert_string_equal(printed, data);
diff --git a/tests/src/test_tree_data.c b/tests/src/test_tree_data.c
index 25a1cfd..ecba711 100644
--- a/tests/src/test_tree_data.c
+++ b/tests/src/test_tree_data.c
@@ -111,8 +111,8 @@
assert_int_equal(LY_SUCCESS, lyd_compare(NULL, NULL, 0));
- assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, 0));
assert_int_equal(LY_ENOT, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
assert_int_equal(LY_ENOT, lyd_compare(((struct lyd_node_inner*)tree1)->child, tree2, 0));
@@ -121,8 +121,8 @@
data1 = "<l2 xmlns=\"urn:tests:a\"><c><x>a</x></c></l2><l2 xmlns=\"urn:tests:a\"><c><x>b</x></c></l2>";
data2 = "<l2 xmlns=\"urn:tests:a\"><c><x>b</x></c></l2>";
- assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LY_ENOT, lyd_compare(tree1, tree2, 0));
assert_int_equal(LY_SUCCESS, lyd_compare(tree1->next, tree2, 0));
lyd_free_all(tree1);
@@ -130,8 +130,8 @@
data1 = "<ll xmlns=\"urn:tests:a\">a</ll><ll xmlns=\"urn:tests:a\">b</ll>";
data2 = "<ll xmlns=\"urn:tests:a\">b</ll>";
- assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LY_ENOT, lyd_compare(tree1, tree2, 0));
assert_int_equal(LY_ENOT, lyd_compare(NULL, tree2, 0));
assert_int_equal(LY_ENOT, lyd_compare(tree1, NULL, 0));
@@ -141,8 +141,8 @@
data1 = "<c xmlns=\"urn:tests:a\"><x>x</x></c>";
data2 = "<c xmlns=\"urn:tests:a\"><x>y</x></c>";
- assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, 0));
assert_int_equal(LY_ENOT, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
lyd_free_all(tree1);
@@ -150,8 +150,8 @@
data1 = "<c xmlns=\"urn:tests:a\"><x>x</x></c>";
data2 = "<c xmlns=\"urn:tests:a\"><x>x</x><x>y</x></c>";
- assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, 0));
assert_int_equal(LY_ENOT, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
lyd_free_all(tree1);
@@ -159,12 +159,12 @@
data1 = "<any xmlns=\"urn:tests:a\"><x>x</x></any>";
data2 = "<any xmlns=\"urn:tests:a\"><x>x</x><x>y</x></any>";
- assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
- assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_VALOPT_DATA_ONLY));
+ assert_non_null(tree2 = lyd_parse_mem(ctx, data2, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LY_ENOT, lyd_compare(tree1, tree2, 0));
lyd_free_all(tree1);
data1 = "<any xmlns=\"urn:tests:a\"><x>x</x><x>y</x></any>";
- assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, data1, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, 0));
lyd_free_all(tree1);
lyd_free_all(tree2);
@@ -172,7 +172,6 @@
*state = NULL;
}
-
static void
test_dup(void **state)
{
@@ -182,7 +181,7 @@
const char *result;
const char *data = "<l1 xmlns=\"urn:tests:a\"><a>a</a><b>b</b><c>x</c></l1>";
- assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_non_null(tree2 = lyd_dup(tree1, NULL, LYD_DUP_RECURSIVE));
assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
lyd_free_all(tree1);
@@ -190,44 +189,43 @@
data = "<l1 xmlns=\"urn:tests:a\"><a>a</a><b>b</b><c>x</c></l1>";
result = "<l1 xmlns=\"urn:tests:a\"><a>a</a><b>b</b></l1>";
- assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_non_null(tree2 = lyd_dup(tree1, NULL, 0));
lyd_free_all(tree1);
- assert_non_null(tree1 = lyd_parse_mem(ctx, result, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, result, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
lyd_free_all(tree1);
lyd_free_all(tree2);
data = "<l2 xmlns=\"urn:tests:a\"><c><x>a</x></c></l2><l2 xmlns=\"urn:tests:a\"><c><x>b</x></c></l2>";
result = "<l2 xmlns=\"urn:tests:a\"><c><x>a</x></c></l2>";
- assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_non_null(tree2 = lyd_dup(tree1, NULL, LYD_DUP_WITH_SIBLINGS | LYD_DUP_RECURSIVE));
assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
lyd_free_all(tree2);
-
assert_non_null(tree2 = lyd_dup(tree1, NULL, LYD_DUP_RECURSIVE));
lyd_free_all(tree1);
- assert_non_null(tree1 = lyd_parse_mem(ctx, result, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, result, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
lyd_free_all(tree2);
assert_non_null(tree2 = lyd_dup(tree1, NULL, 0));
lyd_free_all(tree1);
result = "<l2 xmlns=\"urn:tests:a\"/>";
- assert_non_null(tree1 = lyd_parse_mem(ctx, result, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, result, LYD_XML, LYD_OPT_PARSE_ONLY));
assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
lyd_free_all(tree1);
lyd_free_all(tree2);
data = "<any xmlns=\"urn:tests:a\"><c><a>a</a></c></any>";
- assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_non_null(tree2 = lyd_dup(tree1, NULL, 0));
assert_int_equal(LY_SUCCESS, lyd_compare(tree1, tree2, LYD_COMPARE_FULL_RECURSION));
lyd_free_all(tree1);
lyd_free_all(tree2);
data = "<l2 xmlns=\"urn:tests:a\"><c><x>b</x></c></l2>";
- assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_non_null(tree2 = lyd_dup(((struct lyd_node_inner*)((struct lyd_node_inner*)tree1)->child)->child, NULL, LYD_DUP_WITH_PARENTS));
assert_string_equal("x", tree2->schema->name);
assert_non_null(tree2->parent);
@@ -236,7 +234,7 @@
lyd_free_all(tree2);
data = "<l1 xmlns=\"urn:tests:a\"><a>a</a><b>b</b><c>c</c></l1>";
- assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_non_null(tree2 = lyd_dup(((struct lyd_node_inner*)tree1)->child->prev, NULL, LYD_DUP_WITH_PARENTS));
assert_string_equal("c", tree2->schema->name);
assert_non_null(tree2->parent);
@@ -245,7 +243,7 @@
lyd_free_all(tree2);
data = "<l2 xmlns=\"urn:tests:a\"><c><x>b</x></c></l2>";
- assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_non_null(tree2 = lyd_dup(tree1, NULL, 0));
assert_non_null(lyd_dup(((struct lyd_node_inner*)((struct lyd_node_inner*)tree1)->child)->child,
(struct lyd_node_inner*)tree2, LYD_DUP_WITH_PARENTS));
@@ -255,7 +253,7 @@
/* invalid */
data = "<l1 xmlns=\"urn:tests:a\"><a>a</a><b>b</b><c>c</c></l1><l2 xmlns=\"urn:tests:a\"><c><x>b</x></c></l2>";
- assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_OPT_VAL_DATA_ONLY));
+ assert_non_null(tree1 = lyd_parse_mem(ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
assert_null(lyd_dup(((struct lyd_node_inner*)tree1)->child->prev, (struct lyd_node_inner*)tree1->next, LYD_DUP_WITH_PARENTS));
lyd_free_all(tree1);
diff --git a/tests/src/test_validation.c b/tests/src/test_validation.c
index ca699ae..660f856 100644
--- a/tests/src/test_validation.c
+++ b/tests/src/test_validation.c
@@ -236,19 +236,19 @@
struct lyd_node *tree;
data = "<c xmlns=\"urn:tests:a\">hey</c>";
- assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_null(tree);
- logbuf_assert("When condition \"/cont/b = 'val_b'\" not satisfied.");
+ logbuf_assert("When condition \"/cont/b = 'val_b'\" not satisfied. /a:c");
data = "<cont xmlns=\"urn:tests:a\"><b>val_b</b></cont><c xmlns=\"urn:tests:a\">hey</c>";
- assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_non_null(tree);
assert_string_equal("c", tree->next->schema->name);
assert_int_equal(LYD_WHEN_TRUE, tree->next->flags);
lyd_free_all(tree);
data = "<cont xmlns=\"urn:tests:a\"><a>val</a><b>val_b</b></cont><c xmlns=\"urn:tests:a\">val_c</c>";
- assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_non_null(tree);
assert_string_equal("a", lyd_node_children(tree)->schema->name);
assert_int_equal(LYD_WHEN_TRUE, lyd_node_children(tree)->flags);
@@ -268,22 +268,22 @@
struct lyd_node *tree;
data = "<d xmlns=\"urn:tests:b\"/>";
- assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_null(tree);
logbuf_assert("Mandatory node \"choic\" instance does not exist. /b:choic");
data = "<l xmlns=\"urn:tests:b\">string</l><d xmlns=\"urn:tests:b\"/>";
- assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_null(tree);
logbuf_assert("Mandatory node \"c\" instance does not exist. /b:c");
data = "<a xmlns=\"urn:tests:b\">string</a>";
- assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_null(tree);
logbuf_assert("Mandatory node \"c\" instance does not exist. /b:c");
data = "<a xmlns=\"urn:tests:b\">string</a><c xmlns=\"urn:tests:b\">string2</c>";
- assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_non_null(tree);
lyd_free_withsiblings(tree);
@@ -299,14 +299,14 @@
struct lyd_node *tree;
data = "<d xmlns=\"urn:tests:c\"/>";
- assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_null(tree);
logbuf_assert("Too few \"l\" instances. /c:choic/b/l");
data =
"<l xmlns=\"urn:tests:c\">val1</l>"
"<l xmlns=\"urn:tests:c\">val2</l>";
- assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_null(tree);
logbuf_assert("Too few \"l\" instances. /c:choic/b/l");
@@ -314,7 +314,7 @@
"<l xmlns=\"urn:tests:c\">val1</l>"
"<l xmlns=\"urn:tests:c\">val2</l>"
"<l xmlns=\"urn:tests:c\">val3</l>";
- assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_non_null(tree);
lyd_free_withsiblings(tree);
@@ -327,7 +327,7 @@
"<lt xmlns=\"urn:tests:c\"><k>val3</k></lt>"
"<lt xmlns=\"urn:tests:c\"><k>val4</k></lt>"
"<lt xmlns=\"urn:tests:c\"><k>val5</k></lt>";
- assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_null(tree);
logbuf_assert("Too many \"lt\" instances. /c:lt");
@@ -350,7 +350,7 @@
"<lt xmlns=\"urn:tests:d\">"
"<k>val2</k>"
"</lt>";
- assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_non_null(tree);
lyd_free_withsiblings(tree);
@@ -363,7 +363,7 @@
"<k>val2</k>"
"<l1>not-same</l1>"
"</lt>";
- assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_non_null(tree);
lyd_free_withsiblings(tree);
@@ -376,9 +376,9 @@
"<k>val2</k>"
"<l1>same</l1>"
"</lt>";
- assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_null(tree);
- logbuf_assert("Unique data leaf(s) \"l1\" not satisfied in \"/d:lt[k='val1']\" and \"/d:lt[k='val2']\".");
+ logbuf_assert("Unique data leaf(s) \"l1\" not satisfied in \"/d:lt[k='val1']\" and \"/d:lt[k='val2']\". /d:lt[k='val2']");
/* now try with more instances */
data =
@@ -414,7 +414,7 @@
"<k>val8</k>"
"<l1>8</l1>"
"</lt>";
- assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_non_null(tree);
lyd_free_withsiblings(tree);
@@ -448,7 +448,7 @@
"<lt xmlns=\"urn:tests:d\">"
"<k>val8</k>"
"</lt>";
- assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_non_null(tree);
lyd_free_withsiblings(tree);
@@ -482,9 +482,9 @@
"<k>val8</k>"
"<l1>8</l1>"
"</lt>";
- assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_null(tree);
- logbuf_assert("Unique data leaf(s) \"l1\" not satisfied in \"/d:lt[k='val7']\" and \"/d:lt[k='val2']\".");
+ logbuf_assert("Unique data leaf(s) \"l1\" not satisfied in \"/d:lt[k='val7']\" and \"/d:lt[k='val2']\". /d:lt[k='val2']");
*state = NULL;
}
@@ -554,7 +554,7 @@
"<l3>3</l3>"
"</lt3>"
"</lt2>";
- assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY | LYD_OPT_STRICT, &tree));
+ assert_int_equal(LY_SUCCESS, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY | LYD_OPT_STRICT, &tree));
assert_non_null(tree);
lyd_free_withsiblings(tree);
@@ -615,10 +615,10 @@
"<l3>3</l3>"
"</lt3>"
"</lt2>";
- assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_null(tree);
logbuf_assert("Unique data leaf(s) \"l3\" not satisfied in \"/d:lt2[k='val2']/lt3[kk='val3']\" and"
- " \"/d:lt2[k='val2']/lt3[kk='val1']\".");
+ " \"/d:lt2[k='val2']/lt3[kk='val1']\". /d:lt2[k='val2']/lt3[kk='val1']");
data =
"<lt2 xmlns=\"urn:tests:d\">"
@@ -656,9 +656,9 @@
"</cont>"
"<l4>5</l4>"
"</lt2>";
- assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_null(tree);
- logbuf_assert("Unique data leaf(s) \"cont/l2 l4\" not satisfied in \"/d:lt2[k='val4']\" and \"/d:lt2[k='val2']\".");
+ logbuf_assert("Unique data leaf(s) \"cont/l2 l4\" not satisfied in \"/d:lt2[k='val4']\" and \"/d:lt2[k='val2']\". /d:lt2[k='val2']");
data =
"<lt2 xmlns=\"urn:tests:d\">"
@@ -704,9 +704,9 @@
"<l5>3</l5>"
"<l6>3</l6>"
"</lt2>";
- assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_OPT_VAL_DATA_ONLY, &tree));
+ assert_int_equal(LY_EVALID, lyd_parse_xml(ctx, data, LYD_VALOPT_DATA_ONLY, &tree));
assert_null(tree);
- logbuf_assert("Unique data leaf(s) \"l5 l6\" not satisfied in \"/d:lt2[k='val5']\" and \"/d:lt2[k='val3']\".");
+ logbuf_assert("Unique data leaf(s) \"l5 l6\" not satisfied in \"/d:lt2[k='val5']\" and \"/d:lt2[k='val3']\". /d:lt2[k='val3']");
*state = NULL;
}