libyang REFACTOR rename sized array size to count
... because it reflects the fact that it may not
always (internally) be the size of the array.
diff --git a/tests/utests/data/test_types.c b/tests/utests/data/test_types.c
index 39268e1..6d8de5f 100644
--- a/tests/utests/data/test_types.c
+++ b/tests/utests/data/test_types.c
@@ -368,14 +368,14 @@
assert_string_equal("bits", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
assert_string_equal("zero two", leaf->value.canonical_cache);
- assert_int_equal(2, LY_ARRAY_SIZE(leaf->value.bits_items));
+ assert_int_equal(2, LY_ARRAY_COUNT(leaf->value.bits_items));
assert_string_equal("zero", leaf->value.bits_items[0]->name);
assert_string_equal("two", leaf->value.bits_items[1]->name);
value.realtype = leaf->value.realtype;
assert_int_equal(LY_SUCCESS, value.realtype->plugin->duplicate(s->ctx, &leaf->value, &value));
assert_string_equal(leaf->value.canonical_cache, value.canonical_cache);
- assert_int_equal(2, LY_ARRAY_SIZE(value.bits_items));
+ assert_int_equal(2, LY_ARRAY_COUNT(value.bits_items));
assert_string_equal("zero", value.bits_items[0]->name);
assert_string_equal("two", value.bits_items[1]->name);
value.realtype->plugin->free(s->ctx, &value);
@@ -399,13 +399,13 @@
assert_string_equal("bits", tree->schema->name);
leaf = (struct lyd_node_term*)tree;
assert_string_equal("one", leaf->value.canonical_cache);
- assert_int_equal(1, LY_ARRAY_SIZE(leaf->value.bits_items));
+ assert_int_equal(1, LY_ARRAY_COUNT(leaf->value.bits_items));
assert_string_equal("one", leaf->value.bits_items[0]->name);
value.realtype = leaf->value.realtype;
assert_int_equal(LY_SUCCESS, value.realtype->plugin->duplicate(s->ctx, &leaf->value, &value));
assert_string_equal(leaf->value.canonical_cache, value.canonical_cache);
- assert_int_equal(1, LY_ARRAY_SIZE(value.bits_items));
+ assert_int_equal(1, LY_ARRAY_COUNT(value.bits_items));
assert_string_equal("one", value.bits_items[0]->name);
value.realtype->plugin->free(s->ctx, &value);
lyd_free_all(tree);
@@ -726,7 +726,7 @@
assert_string_equal("inst", tree->schema->name);
leaf = (const struct lyd_node_term*)tree;
assert_null(leaf->value.canonical_cache);
- assert_int_equal(2, LY_ARRAY_SIZE(leaf->value.target));
+ assert_int_equal(2, LY_ARRAY_COUNT(leaf->value.target));
assert_string_equal("cont", leaf->value.target[0].node->name);
assert_null(leaf->value.target[0].predicates);
assert_string_equal("leaftarget", leaf->value.target[1].node->name);
@@ -735,7 +735,7 @@
value.realtype = leaf->value.realtype;
assert_int_equal(LY_SUCCESS, value.realtype->plugin->duplicate(s->ctx, &leaf->value, &value));
assert_null(value.canonical_cache);
- assert_true(LY_ARRAY_SIZE(leaf->value.target) == LY_ARRAY_SIZE(value.target));
+ assert_true(LY_ARRAY_COUNT(leaf->value.target) == LY_ARRAY_COUNT(value.target));
assert_true(leaf->value.target[0].node == value.target[0].node);
assert_true(leaf->value.target[0].predicates == value.target[0].predicates); /* NULL */
assert_true(leaf->value.target[1].node == value.target[1].node);
@@ -770,9 +770,9 @@
assert_string_equal("inst", tree->schema->name);
leaf = (const struct lyd_node_term*)tree;
assert_null(leaf->value.canonical_cache);
- assert_int_equal(2, LY_ARRAY_SIZE(leaf->value.target));
+ assert_int_equal(2, LY_ARRAY_COUNT(leaf->value.target));
assert_string_equal("list_inst", leaf->value.target[0].node->name);
- assert_int_equal(1, LY_ARRAY_SIZE(leaf->value.target[0].predicates));
+ assert_int_equal(1, LY_ARRAY_COUNT(leaf->value.target[0].predicates));
assert_string_equal("value", leaf->value.target[1].node->name);
assert_null(leaf->value.target[1].predicates);
@@ -782,9 +782,9 @@
value.realtype = leaf->value.realtype;
assert_int_equal(LY_SUCCESS, value.realtype->plugin->duplicate(s->ctx, &leaf->value, &value));
assert_null(value.canonical_cache);
- assert_true(LY_ARRAY_SIZE(leaf->value.target) == LY_ARRAY_SIZE(value.target));
+ assert_true(LY_ARRAY_COUNT(leaf->value.target) == LY_ARRAY_COUNT(value.target));
assert_true(leaf->value.target[0].node == value.target[0].node);
- assert_true(LY_ARRAY_SIZE(leaf->value.target[0].predicates) == LY_ARRAY_SIZE(value.target[0].predicates));
+ assert_true(LY_ARRAY_COUNT(leaf->value.target[0].predicates) == LY_ARRAY_COUNT(value.target[0].predicates));
assert_true(leaf->value.target[1].node == value.target[1].node);
assert_true(leaf->value.target[1].predicates == value.target[1].predicates); /* NULL */
value.realtype->plugin->free(s->ctx, &value);
diff --git a/tests/utests/extensions/test_metadata.c b/tests/utests/extensions/test_metadata.c
index f8353d2..e206d22 100644
--- a/tests/utests/extensions/test_metadata.c
+++ b/tests/utests/extensions/test_metadata.c
@@ -122,7 +122,7 @@
" units meters;"
"}}";
assert_non_null(mod = lys_parse_mem(s->ctx, data, LYS_IN_YANG));
- assert_int_equal(1, LY_ARRAY_SIZE(mod->compiled->exts));
+ assert_int_equal(1, LY_ARRAY_COUNT(mod->compiled->exts));
e = &mod->compiled->exts[0];
assert_non_null(ant = (struct lyext_metadata*)e->data);
assert_string_equal("meters", ant->units);
@@ -197,7 +197,7 @@
" <units name=\"meters\"/>\n"
"</md:annotation></module>";
assert_non_null(mod = lys_parse_mem(s->ctx, data, LYS_IN_YIN));
- assert_int_equal(1, LY_ARRAY_SIZE(mod->compiled->exts));
+ assert_int_equal(1, LY_ARRAY_COUNT(mod->compiled->exts));
e = &mod->compiled->exts[0];
assert_non_null(ant = (struct lyext_metadata*)e->data);
assert_string_equal("meters", ant->units);
diff --git a/tests/utests/extensions/test_nacm.c b/tests/utests/extensions/test_nacm.c
index c95afaa..4e494f8 100644
--- a/tests/utests/extensions/test_nacm.c
+++ b/tests/utests/extensions/test_nacm.c
@@ -123,8 +123,8 @@
assert_non_null(cont = (struct lysc_node_container*)mod->compiled->data);
assert_non_null(leaf = (struct lysc_node_leaf*)cont->child);
assert_non_null(e = &cont->exts[0]);
- assert_int_equal(LY_ARRAY_SIZE(cont->exts), 1);
- assert_int_equal(LY_ARRAY_SIZE(leaf->exts), 1); /* NACM extensions inherit */
+ assert_int_equal(LY_ARRAY_COUNT(cont->exts), 1);
+ assert_int_equal(LY_ARRAY_COUNT(leaf->exts), 1); /* NACM extensions inherit */
assert_ptr_equal(e->def, leaf->exts[0].def);
assert_int_equal(1, *((uint8_t*)e->data)); /* plugin's value for default-deny-all */
assert_null(cont->next->exts);
@@ -168,8 +168,8 @@
assert_non_null(cont = (struct lysc_node_container*)mod->compiled->data);
assert_non_null(leaf = (struct lysc_node_leaf*)cont->child);
assert_non_null(e = &cont->exts[0]);
- assert_int_equal(LY_ARRAY_SIZE(cont->exts), 1);
- assert_int_equal(LY_ARRAY_SIZE(leaf->exts), 1); /* NACM extensions inherit */
+ assert_int_equal(LY_ARRAY_COUNT(cont->exts), 1);
+ assert_int_equal(LY_ARRAY_COUNT(leaf->exts), 1); /* NACM extensions inherit */
assert_ptr_equal(e->def, leaf->exts[0].def);
assert_int_equal(2, *((uint8_t*)e->data)); /* plugin's value for default-deny-write */
assert_null(cont->next->exts);
diff --git a/tests/utests/schema/test_parser_yang.c b/tests/utests/schema/test_parser_yang.c
index c51bafe..3d19f24 100644
--- a/tests/utests/schema/test_parser_yang.c
+++ b/tests/utests/schema/test_parser_yang.c
@@ -1534,7 +1534,7 @@
assert_string_equal("ll", ll->name);
assert_string_equal("test", ll->dsc);
assert_non_null(ll->dflts);
- assert_int_equal(2, LY_ARRAY_SIZE(ll->dflts));
+ assert_int_equal(2, LY_ARRAY_COUNT(ll->dflts));
assert_string_equal("xxx", ll->dflts[0]);
assert_string_equal("yyy", ll->dflts[1]);
assert_string_equal("zzz", ll->units);
@@ -1634,7 +1634,7 @@
assert_string_equal("test", l->dsc);
assert_string_equal("l", l->key);
assert_non_null(l->uniques);
- assert_int_equal(2, LY_ARRAY_SIZE(l->uniques));
+ assert_int_equal(2, LY_ARRAY_COUNT(l->uniques));
assert_string_equal("xxx", l->uniques[0]);
assert_string_equal("yyy", l->uniques[1]);
assert_int_equal(10, l->max);
diff --git a/tests/utests/schema/test_schema_common.c b/tests/utests/schema/test_schema_common.c
index 1623905..ebcdaec 100644
--- a/tests/utests/schema/test_schema_common.c
+++ b/tests/utests/schema/test_schema_common.c
@@ -194,7 +194,7 @@
LY_ARRAY_NEW_RET(NULL, revs, rev,);
strcpy(rev->date, "2018-12-31");
- assert_int_equal(2, LY_ARRAY_SIZE(revs));
+ assert_int_equal(2, LY_ARRAY_COUNT(revs));
assert_string_equal("2018-01-01", &revs[0]);
assert_string_equal("2018-12-31", &revs[1]);
/* the order should be fixed, so the newest revision will be the first in the array */
diff --git a/tests/utests/schema/test_schema_stmts.c b/tests/utests/schema/test_schema_stmts.c
index 7e93afd..9e34742 100644
--- a/tests/utests/schema/test_schema_stmts.c
+++ b/tests/utests/schema/test_schema_stmts.c
@@ -49,7 +49,7 @@
"identity test {base \"a\";base b; description text;reference \'another text\';status current; if-feature x;if-feature y; identityone:ext;}"
"identity a; identity b; extension ext; feature x; feature y;", mod);
assert_non_null(mod->parsed->identities);
- assert_int_equal(3, LY_ARRAY_SIZE(mod->parsed->identities));
+ assert_int_equal(3, LY_ARRAY_COUNT(mod->parsed->identities));
/* invalid substatement */
TEST_STMT_SUBSTM_ERR(ctx, 0, "identity", "organization", "XXX");
@@ -66,7 +66,7 @@
"<reference><text>ref</text></reference>"
"<myext:ext xmlns:myext=\"urn:libyang:test:identityone-yin\"/>"
"</identity><extension name=\"ext\"/><identity name=\"base-name\"/><feature name=\"iff\"/>", mod);
- assert_int_equal(2, LY_ARRAY_SIZE(mod->parsed->identities));
+ assert_int_equal(2, LY_ARRAY_COUNT(mod->parsed->identities));
assert_string_equal(mod->parsed->identities[0].name, "ident-name");
assert_string_equal(mod->parsed->identities[0].bases[0], "base-name");
assert_string_equal(mod->parsed->identities[0].iffeatures[0], "iff");
@@ -81,7 +81,7 @@
/* min subelems */
TEST_SCHEMA_OK(ctx, 1, 1, "identitytwo-yin", "<identity name=\"ident-name\" />", mod);
- assert_int_equal(1, LY_ARRAY_SIZE(mod->parsed->identities));
+ assert_int_equal(1, LY_ARRAY_COUNT(mod->parsed->identities));
assert_string_equal(mod->parsed->identities[0].name, "ident-name");
/* invalid substatement */
@@ -100,21 +100,21 @@
assert_non_null(mod->compiled);
assert_non_null(mod->compiled->identities);
assert_non_null(mod_imp->compiled->identities[0].derived);
- assert_int_equal(1, LY_ARRAY_SIZE(mod_imp->compiled->identities[0].derived));
+ assert_int_equal(1, LY_ARRAY_COUNT(mod_imp->compiled->identities[0].derived));
assert_ptr_equal(mod_imp->compiled->identities[0].derived[0], &mod->compiled->identities[2]);
assert_non_null(mod->compiled->identities[0].derived);
- assert_int_equal(2, LY_ARRAY_SIZE(mod->compiled->identities[0].derived));
+ assert_int_equal(2, LY_ARRAY_COUNT(mod->compiled->identities[0].derived));
assert_ptr_equal(mod->compiled->identities[0].derived[0], &mod->compiled->identities[2]);
assert_ptr_equal(mod->compiled->identities[0].derived[1], &mod->compiled->identities[3]);
assert_non_null(mod->compiled->identities[1].derived);
- assert_int_equal(1, LY_ARRAY_SIZE(mod->compiled->identities[1].derived));
+ assert_int_equal(1, LY_ARRAY_COUNT(mod->compiled->identities[1].derived));
assert_ptr_equal(mod->compiled->identities[1].derived[0], &mod->compiled->identities[2]);
assert_non_null(mod->compiled->identities[2].derived);
- assert_int_equal(1, LY_ARRAY_SIZE(mod->compiled->identities[2].derived));
+ assert_int_equal(1, LY_ARRAY_COUNT(mod->compiled->identities[2].derived));
assert_ptr_equal(mod->compiled->identities[2].derived[0], &mod->compiled->identities[3]);
TEST_SCHEMA_OK(ctx, 1, 0, "c", "identity c2 {base c1;} identity c1;", mod);
- assert_int_equal(1, LY_ARRAY_SIZE(mod->compiled->identities[1].derived));
+ assert_int_equal(1, LY_ARRAY_COUNT(mod->compiled->identities[1].derived));
assert_ptr_equal(mod->compiled->identities[1].derived[0], &mod->compiled->identities[0]);
TEST_SCHEMA_ERR(ctx, 0, 0, "inv", "identity i1;identity i1;", "Duplicate identifier \"i1\" of identity statement. /inv:{identity='i1'}");
@@ -179,7 +179,7 @@
"feature test {description text;reference \'another text\';status current; if-feature x; if-feature y; featureone:ext;}"
"extension ext; feature x; feature y;", mod);
assert_non_null(mod->parsed->features);
- assert_int_equal(3, LY_ARRAY_SIZE(mod->parsed->features));
+ assert_int_equal(3, LY_ARRAY_COUNT(mod->parsed->features));
/* invalid substatement */
TEST_STMT_SUBSTM_ERR(ctx, 0, "feature", "organization", "XXX");
@@ -195,7 +195,7 @@
"<reference><text>ref</text></reference>"
"<myext:ext xmlns:myext=\"urn:libyang:test:featureone-yin\"/>"
"</feature><extension name=\"ext\"/><feature name=\"iff\"/>", mod);
- assert_int_equal(2, LY_ARRAY_SIZE(mod->parsed->features));
+ assert_int_equal(2, LY_ARRAY_COUNT(mod->parsed->features));
assert_string_equal(mod->parsed->features[0].name, "feature-name");
assert_string_equal(mod->parsed->features[0].dsc, "desc");
assert_true(mod->parsed->features[0].flags & LYS_STATUS_DEPRC);
@@ -207,7 +207,7 @@
/* min subelems */
TEST_SCHEMA_OK(ctx, 0, 1, "featuretwo-yin", "<feature name=\"feature-name\"/>", mod)
- assert_int_equal(1, LY_ARRAY_SIZE(mod->parsed->features));
+ assert_int_equal(1, LY_ARRAY_COUNT(mod->parsed->features));
assert_string_equal(mod->parsed->features[0].name, "feature-name");
/* invalid substatement */
@@ -226,7 +226,7 @@
"feature f8 {if-feature \"f1 or f2 or f3 or orfeature or andfeature\";}\n"
"feature f9 {if-feature \"not not f1\";}", mod);
assert_non_null(mod->compiled->features);
- assert_int_equal(9, LY_ARRAY_SIZE(mod->compiled->features));
+ assert_int_equal(9, LY_ARRAY_COUNT(mod->compiled->features));
/* all features are disabled by default */
LY_ARRAY_FOR(mod->compiled->features, struct lysc_feature, f) {
@@ -303,16 +303,16 @@
TEST_SCHEMA_OK(ctx, 0, 0, "b", "feature f1 {if-feature f2;}feature f2;", mod);
assert_non_null(mod->compiled);
assert_non_null(mod->compiled->features);
- assert_int_equal(2, LY_ARRAY_SIZE(mod->compiled->features));
+ assert_int_equal(2, LY_ARRAY_COUNT(mod->compiled->features));
assert_non_null(mod->compiled->features[0].iffeatures);
- assert_int_equal(1, LY_ARRAY_SIZE(mod->compiled->features[0].iffeatures));
+ assert_int_equal(1, LY_ARRAY_COUNT(mod->compiled->features[0].iffeatures));
assert_non_null(mod->compiled->features[0].iffeatures[0].features);
- assert_int_equal(1, LY_ARRAY_SIZE(mod->compiled->features[0].iffeatures[0].features));
+ assert_int_equal(1, LY_ARRAY_COUNT(mod->compiled->features[0].iffeatures[0].features));
assert_ptr_equal(&mod->compiled->features[1], mod->compiled->features[0].iffeatures[0].features[0]);
assert_non_null(mod->compiled->features);
- assert_int_equal(2, LY_ARRAY_SIZE(mod->compiled->features));
+ assert_int_equal(2, LY_ARRAY_COUNT(mod->compiled->features));
assert_non_null(mod->compiled->features[1].depfeatures);
- assert_int_equal(1, LY_ARRAY_SIZE(mod->compiled->features[1].depfeatures));
+ assert_int_equal(1, LY_ARRAY_COUNT(mod->compiled->features[1].depfeatures));
assert_ptr_equal(&mod->compiled->features[0], mod->compiled->features[1].depfeatures[0]);
/* invalid reference */
diff --git a/tests/utests/schema/test_tree_schema_compile.c b/tests/utests/schema/test_tree_schema_compile.c
index 85dcf0e..6d9b4a3 100644
--- a/tests/utests/schema/test_tree_schema_compile.c
+++ b/tests/utests/schema/test_tree_schema_compile.c
@@ -127,14 +127,14 @@
assert_string_equal("t", mod->prefix);
/* features */
assert_non_null(mod->compiled->features);
- assert_int_equal(2, LY_ARRAY_SIZE(mod->compiled->features));
+ assert_int_equal(2, LY_ARRAY_COUNT(mod->compiled->features));
f = &mod->compiled->features[1];
assert_non_null(f->iffeatures);
- assert_int_equal(1, LY_ARRAY_SIZE(f->iffeatures));
+ assert_int_equal(1, LY_ARRAY_COUNT(f->iffeatures));
iff = &f->iffeatures[0];
assert_non_null(iff->expr);
assert_non_null(iff->features);
- assert_int_equal(1, LY_ARRAY_SIZE(iff->features));
+ assert_int_equal(1, LY_ARRAY_COUNT(iff->features));
assert_ptr_equal(&mod->compiled->features[0], iff->features[0]);
/* submodules cannot be compiled directly */
@@ -214,7 +214,7 @@
assert_int_equal(1, type->refcount);
assert_int_equal(LY_TYPE_UNION, type->basetype);
assert_non_null(((struct lysc_type_union*)type)->types);
- assert_int_equal(3, LY_ARRAY_SIZE(((struct lysc_type_union*)type)->types));
+ assert_int_equal(3, LY_ARRAY_COUNT(((struct lysc_type_union*)type)->types));
assert_int_equal(LY_TYPE_DEC64, ((struct lysc_type_union*)type)->types[0]->basetype);
assert_int_equal(LY_TYPE_LEAFREF, ((struct lysc_type_union*)type)->types[1]->basetype);
assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_union*)type)->types[2]->basetype);
@@ -240,7 +240,7 @@
assert_non_null((ll = (struct lysc_node_leaflist*)mod->compiled->data));
assert_non_null(ll->dflts);
assert_int_equal(6, ll->type->refcount); /* 3x type's reference, 3x default value's reference (typedef's default does not reference own type) */
- assert_int_equal(2, LY_ARRAY_SIZE(ll->dflts));
+ assert_int_equal(2, LY_ARRAY_COUNT(ll->dflts));
assert_string_equal("1", dflt = ll->dflts[0]->realtype->plugin->print(ll->dflts[0], LYD_XML, NULL, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_string_equal("1", dflt = ll->dflts[1]->realtype->plugin->print(ll->dflts[1], LYD_XML, NULL, NULL, &dynamic));
@@ -249,7 +249,7 @@
assert_non_null((ll = (struct lysc_node_leaflist*)mod->compiled->data->next));
assert_non_null(ll->dflts);
assert_int_equal(6, ll->type->refcount); /* 3x type's reference, 3x default value's reference */
- assert_int_equal(1, LY_ARRAY_SIZE(ll->dflts));
+ assert_int_equal(1, LY_ARRAY_COUNT(ll->dflts));
assert_string_equal("10", dflt = ll->dflts[0]->realtype->plugin->print(ll->dflts[0], LYD_XML, NULL, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_int_equal(LYS_CONFIG_W | LYS_STATUS_CURR | LYS_ORDBY_USER, ll->flags);
@@ -294,7 +294,7 @@
assert_non_null(mod->compiled);
assert_non_null((ll = (struct lysc_node_leaflist*)mod->compiled->data));
assert_non_null(ll->dflts);
- assert_int_equal(3, LY_ARRAY_SIZE(ll->dflts));
+ assert_int_equal(3, LY_ARRAY_COUNT(ll->dflts));
assert_null(lys_parse_mem(ctx, "module dd {yang-version 1.1;namespace urn:dd;prefix dd;"
"leaf-list ll {type string; default one;default two;default one;}}", LYS_IN_YANG));
logbuf_assert("Configuration leaf-list has multiple defaults of the same value \"one\". /dd:ll");
@@ -351,13 +351,13 @@
assert_true(list->child->flags & LYS_KEY);
assert_null(((struct lysc_node_leaf*)list->child)->dflt);
assert_non_null(list->uniques);
- assert_int_equal(2, LY_ARRAY_SIZE(list->uniques));
- assert_int_equal(2, LY_ARRAY_SIZE(list->uniques[0]));
+ assert_int_equal(2, LY_ARRAY_COUNT(list->uniques));
+ assert_int_equal(2, LY_ARRAY_COUNT(list->uniques[0]));
assert_string_equal("a", list->uniques[0][0]->name);
assert_true(list->uniques[0][0]->flags & LYS_UNIQUE);
assert_string_equal("b", list->uniques[0][1]->name);
assert_true(list->uniques[0][1]->flags & LYS_UNIQUE);
- assert_int_equal(2, LY_ARRAY_SIZE(list->uniques[1]));
+ assert_int_equal(2, LY_ARRAY_COUNT(list->uniques[1]));
assert_string_equal("e", list->uniques[1][0]->name);
assert_true(list->uniques[1][0]->flags & LYS_UNIQUE);
assert_string_equal("d", list->uniques[1][1]->name);
@@ -465,7 +465,7 @@
ch = (struct lysc_node_choice*)mod->compiled->data;
assert_non_null(ch);
assert_int_equal(LYS_CONFIG_W | LYS_STATUS_CURR, ch->flags);
- assert_int_equal(1, LY_ARRAY_SIZE(ch->when));
+ assert_int_equal(1, LY_ARRAY_COUNT(ch->when));
assert_null(ch->when[0]->context);
cs = ch->cases;
assert_non_null(cs);
@@ -567,7 +567,7 @@
"rpc a {input {leaf x {type int8;} leaf y {type int8;}} output {leaf result {type int16;}}}}", LYS_IN_YANG));
rpc = mod->compiled->rpcs;
assert_non_null(rpc);
- assert_int_equal(1, LY_ARRAY_SIZE(rpc));
+ assert_int_equal(1, LY_ARRAY_COUNT(rpc));
assert_int_equal(LYS_RPC, rpc->nodetype);
assert_int_equal(LYS_STATUS_CURR, rpc->flags);
assert_string_equal("a", rpc->name);
@@ -577,12 +577,12 @@
"output {must \"result > 25\"; must \"/top\"; leaf result {type int16;}}}}}", LYS_IN_YANG));
rpc = lysc_node_actions(mod->compiled->data);
assert_non_null(rpc);
- assert_int_equal(1, LY_ARRAY_SIZE(rpc));
+ assert_int_equal(1, LY_ARRAY_COUNT(rpc));
assert_int_equal(LYS_ACTION, rpc->nodetype);
assert_int_equal(LYS_STATUS_CURR, rpc->flags);
assert_string_equal("b", rpc->name);
assert_null(rpc->input.musts);
- assert_int_equal(2, LY_ARRAY_SIZE(rpc->output.musts));
+ assert_int_equal(2, LY_ARRAY_COUNT(rpc->output.musts));
/* invalid */
assert_null(lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa;container top {action x;}}", LYS_IN_YANG));
@@ -629,7 +629,7 @@
"notification a1 {leaf x {type int8;}} notification a2;}", LYS_IN_YANG));
notif = mod->compiled->notifs;
assert_non_null(notif);
- assert_int_equal(2, LY_ARRAY_SIZE(notif));
+ assert_int_equal(2, LY_ARRAY_COUNT(notif));
assert_int_equal(LYS_NOTIF, notif->nodetype);
assert_int_equal(LYS_STATUS_CURR, notif->flags);
assert_string_equal("a1", notif->name);
@@ -644,7 +644,7 @@
"notification b1 {leaf x {type int8;}} notification b2 {must \"/top\";}}}", LYS_IN_YANG));
notif = lysc_node_notifs(mod->compiled->data);
assert_non_null(notif);
- assert_int_equal(2, LY_ARRAY_SIZE(notif));
+ assert_int_equal(2, LY_ARRAY_COUNT(notif));
assert_int_equal(LYS_NOTIF, notif->nodetype);
assert_int_equal(LYS_STATUS_CURR, notif->flags);
assert_string_equal("b1", notif->name);
@@ -654,7 +654,7 @@
assert_int_equal(LYS_STATUS_CURR, notif[1].flags);
assert_string_equal("b2", notif[1].name);
assert_null(notif[1].data);
- assert_int_equal(1, LY_ARRAY_SIZE(notif[1].musts));
+ assert_int_equal(1, LY_ARRAY_COUNT(notif[1].musts));
/* invalid */
assert_null(lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa;container top {notification x;}}", LYS_IN_YANG));
@@ -707,7 +707,7 @@
assert_int_equal(LY_TYPE_INT8, type->basetype);
assert_non_null(((struct lysc_type_num*)type)->range);
assert_non_null(((struct lysc_type_num*)type)->range->parts);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_num*)type)->range->parts));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
assert_int_equal(-128, ((struct lysc_type_num*)type)->range->parts[0].min_64);
assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_64);
assert_int_equal(127, ((struct lysc_type_num*)type)->range->parts[1].min_64);
@@ -719,7 +719,7 @@
assert_int_equal(LY_TYPE_INT16, type->basetype);
assert_non_null(((struct lysc_type_num*)type)->range);
assert_non_null(((struct lysc_type_num*)type)->range->parts);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_num*)type)->range->parts));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
assert_int_equal(-32768, ((struct lysc_type_num*)type)->range->parts[0].min_64);
assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_64);
assert_int_equal(32767, ((struct lysc_type_num*)type)->range->parts[1].min_64);
@@ -731,7 +731,7 @@
assert_int_equal(LY_TYPE_INT32, type->basetype);
assert_non_null(((struct lysc_type_num*)type)->range);
assert_non_null(((struct lysc_type_num*)type)->range->parts);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_num*)type)->range->parts));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
assert_int_equal(INT64_C(-2147483648), ((struct lysc_type_num*)type)->range->parts[0].min_64);
assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_64);
assert_int_equal(INT64_C(2147483647), ((struct lysc_type_num*)type)->range->parts[1].min_64);
@@ -743,7 +743,7 @@
assert_int_equal(LY_TYPE_INT64, type->basetype);
assert_non_null(((struct lysc_type_num*)type)->range);
assert_non_null(((struct lysc_type_num*)type)->range->parts);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_num*)type)->range->parts));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
assert_int_equal(INT64_C(-9223372036854775807) - INT64_C(1), ((struct lysc_type_num*)type)->range->parts[0].min_64);
assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_64);
assert_int_equal(INT64_C(9223372036854775807), ((struct lysc_type_num*)type)->range->parts[1].min_64);
@@ -755,7 +755,7 @@
assert_int_equal(LY_TYPE_UINT8, type->basetype);
assert_non_null(((struct lysc_type_num*)type)->range);
assert_non_null(((struct lysc_type_num*)type)->range->parts);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_num*)type)->range->parts));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
assert_int_equal(0, ((struct lysc_type_num*)type)->range->parts[0].min_u64);
assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_u64);
assert_int_equal(255, ((struct lysc_type_num*)type)->range->parts[1].min_u64);
@@ -767,7 +767,7 @@
assert_int_equal(LY_TYPE_UINT16, type->basetype);
assert_non_null(((struct lysc_type_num*)type)->range);
assert_non_null(((struct lysc_type_num*)type)->range->parts);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_num*)type)->range->parts));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
assert_int_equal(0, ((struct lysc_type_num*)type)->range->parts[0].min_u64);
assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_u64);
assert_int_equal(65535, ((struct lysc_type_num*)type)->range->parts[1].min_u64);
@@ -779,7 +779,7 @@
assert_int_equal(LY_TYPE_UINT32, type->basetype);
assert_non_null(((struct lysc_type_num*)type)->range);
assert_non_null(((struct lysc_type_num*)type)->range->parts);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_num*)type)->range->parts));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
assert_int_equal(0, ((struct lysc_type_num*)type)->range->parts[0].min_u64);
assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_u64);
assert_int_equal(UINT64_C(4294967295), ((struct lysc_type_num*)type)->range->parts[1].min_u64);
@@ -791,7 +791,7 @@
assert_int_equal(LY_TYPE_UINT64, type->basetype);
assert_non_null(((struct lysc_type_num*)type)->range);
assert_non_null(((struct lysc_type_num*)type)->range->parts);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_num*)type)->range->parts));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
assert_int_equal(0, ((struct lysc_type_num*)type)->range->parts[0].min_u64);
assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_u64);
assert_int_equal(UINT64_C(18446744073709551615), ((struct lysc_type_num*)type)->range->parts[1].min_u64);
@@ -805,7 +805,7 @@
assert_int_equal(LY_TYPE_UINT8, type->basetype);
assert_non_null(((struct lysc_type_num*)type)->range);
assert_non_null(((struct lysc_type_num*)type)->range->parts);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_num*)type)->range->parts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
assert_non_null(mod = lys_parse_mem(ctx, "module j {namespace urn:j;prefix j;"
"typedef mytype {type uint8 {range 1..100{description \"one to hundred\";reference A;}}}"
@@ -818,7 +818,7 @@
assert_string_equal("one to ten", ((struct lysc_type_num*)type)->range->dsc);
assert_string_equal("B", ((struct lysc_type_num*)type)->range->ref);
assert_non_null(((struct lysc_type_num*)type)->range->parts);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_num*)type)->range->parts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_num*)type)->range->parts));
assert_int_equal(1, ((struct lysc_type_num*)type)->range->parts[0].min_u64);
assert_int_equal(10, ((struct lysc_type_num*)type)->range->parts[0].max_u64);
@@ -844,7 +844,7 @@
assert_non_null(((struct lysc_type_bin*)type)->length->parts);
assert_string_equal("errortag", ((struct lysc_type_bin*)type)->length->eapptag);
assert_string_equal("error", ((struct lysc_type_bin*)type)->length->emsg);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_bin*)type)->length->parts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
assert_int_equal(0, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
assert_int_equal(0, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
@@ -853,7 +853,7 @@
assert_non_null(type);
assert_non_null(((struct lysc_type_bin*)type)->length);
assert_non_null(((struct lysc_type_bin*)type)->length->parts);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_bin*)type)->length->parts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
assert_int_equal(UINT64_C(18446744073709551615), ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
assert_int_equal(UINT64_C(18446744073709551615), ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
@@ -862,7 +862,7 @@
assert_non_null(type);
assert_non_null(((struct lysc_type_bin*)type)->length);
assert_non_null(((struct lysc_type_bin*)type)->length->parts);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_bin*)type)->length->parts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
assert_int_equal(0, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
assert_int_equal(UINT64_C(18446744073709551615), ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
@@ -871,7 +871,7 @@
assert_non_null(type);
assert_non_null(((struct lysc_type_bin*)type)->length);
assert_non_null(((struct lysc_type_bin*)type)->length->parts);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_bin*)type)->length->parts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
assert_int_equal(5, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
assert_int_equal(5, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
@@ -880,7 +880,7 @@
assert_non_null(type);
assert_non_null(((struct lysc_type_bin*)type)->length);
assert_non_null(((struct lysc_type_bin*)type)->length->parts);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_bin*)type)->length->parts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
assert_int_equal(1, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
assert_int_equal(10, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
@@ -889,7 +889,7 @@
assert_non_null(type);
assert_non_null(((struct lysc_type_bin*)type)->length);
assert_non_null(((struct lysc_type_bin*)type)->length->parts);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_bin*)type)->length->parts));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
assert_int_equal(1, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
assert_int_equal(10, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
assert_int_equal(20, ((struct lysc_type_bin*)type)->length->parts[1].min_u64);
@@ -900,7 +900,7 @@
assert_non_null(type);
assert_non_null(((struct lysc_type_bin*)type)->length);
assert_non_null(((struct lysc_type_bin*)type)->length->parts);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_bin*)type)->length->parts));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
assert_int_equal(16, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
assert_int_equal(16, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
assert_int_equal(32, ((struct lysc_type_bin*)type)->length->parts[1].min_u64);
@@ -912,7 +912,7 @@
assert_non_null(type);
assert_non_null(((struct lysc_type_bin*)type)->length);
assert_non_null(((struct lysc_type_bin*)type)->length->parts);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_bin*)type)->length->parts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
assert_int_equal(10, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
assert_int_equal(10, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
@@ -922,7 +922,7 @@
assert_non_null(type);
assert_non_null(((struct lysc_type_bin*)type)->length);
assert_non_null(((struct lysc_type_bin*)type)->length->parts);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_bin*)type)->length->parts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
assert_int_equal(50, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
assert_int_equal(50, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
@@ -932,7 +932,7 @@
assert_non_null(type);
assert_non_null(((struct lysc_type_bin*)type)->length);
assert_non_null(((struct lysc_type_bin*)type)->length->parts);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_bin*)type)->length->parts));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
assert_int_equal(10, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
assert_int_equal(30, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
assert_int_equal(60, ((struct lysc_type_bin*)type)->length->parts[1].min_u64);
@@ -945,7 +945,7 @@
assert_int_equal(1, type->refcount);
assert_non_null(((struct lysc_type_bin*)type)->length);
assert_non_null(((struct lysc_type_bin*)type)->length->parts);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_bin*)type)->length->parts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
assert_int_equal(10, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
assert_int_equal(80, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
type = ((struct lysc_node_leaf*)mod->compiled->data->next)->type;
@@ -953,7 +953,7 @@
assert_int_equal(2, type->refcount);
assert_non_null(((struct lysc_type_bin*)type)->length);
assert_non_null(((struct lysc_type_bin*)type)->length->parts);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_bin*)type)->length->parts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_bin*)type)->length->parts));
assert_int_equal(10, ((struct lysc_type_bin*)type)->length->parts[0].min_u64);
assert_int_equal(100, ((struct lysc_type_bin*)type)->length->parts[0].max_u64);
@@ -965,7 +965,7 @@
assert_int_equal(1, type->refcount);
assert_non_null(((struct lysc_type_str*)type)->length);
assert_non_null(((struct lysc_type_str*)type)->length->parts);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_str*)type)->length->parts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_str*)type)->length->parts));
assert_int_equal(10, ((struct lysc_type_str*)type)->length->parts[0].min_u64);
assert_int_equal(100, ((struct lysc_type_str*)type)->length->parts[0].max_u64);
@@ -977,7 +977,7 @@
assert_int_equal(1, type->refcount);
assert_non_null(((struct lysc_type_str*)type)->length);
assert_non_null(((struct lysc_type_str*)type)->length->parts);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_str*)type)->length->parts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_str*)type)->length->parts));
assert_int_equal(10, ((struct lysc_type_str*)type)->length->parts[0].min_u64);
assert_int_equal(10, ((struct lysc_type_str*)type)->length->parts[0].max_u64);
@@ -1053,7 +1053,7 @@
type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
assert_non_null(type);
assert_non_null(((struct lysc_type_str*)type)->patterns);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_str*)type)->patterns));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_str*)type)->patterns));
assert_string_equal("errortag", ((struct lysc_type_str*)type)->patterns[0]->eapptag);
assert_string_equal("error", ((struct lysc_type_str*)type)->patterns[0]->emsg);
assert_string_equal(".*", ((struct lysc_type_str*)type)->patterns[0]->expr);
@@ -1070,7 +1070,7 @@
assert_int_equal(LY_TYPE_STRING, type->basetype);
assert_int_equal(1, type->refcount);
assert_non_null(((struct lysc_type_str*)type)->patterns);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_str*)type)->patterns));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_str*)type)->patterns));
assert_string_equal("[0-9]*", ((struct lysc_type_str*)type)->patterns[0]->expr);
assert_int_equal(3, ((struct lysc_type_str*)type)->patterns[0]->refcount);
assert_string_equal("[0-4]*", ((struct lysc_type_str*)type)->patterns[1]->expr);
@@ -1083,7 +1083,7 @@
assert_int_equal(LY_TYPE_STRING, type->basetype);
assert_int_equal(1, type->refcount);
assert_non_null(((struct lysc_type_str*)type)->patterns);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_str*)type)->patterns));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_str*)type)->patterns));
assert_string_equal("[0-9]*", ((struct lysc_type_str*)type)->patterns[0]->expr);
assert_int_equal(2, ((struct lysc_type_str*)type)->patterns[0]->refcount);
@@ -1093,7 +1093,7 @@
type = ((struct lysc_node_leaf*)mod->compiled->data)->type;
assert_non_null(type);
assert_non_null(((struct lysc_type_str*)type)->patterns);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_str*)type)->patterns));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_str*)type)->patterns));
assert_string_equal("^\\p{IsLatinExtended-A}$", ((struct lysc_type_str*)type)->patterns[0]->expr);
/* TODO check some data "^ř$" */
@@ -1119,7 +1119,7 @@
assert_non_null(type);
assert_int_equal(LY_TYPE_ENUM, type->basetype);
assert_non_null(((struct lysc_type_enum*)type)->enums);
- assert_int_equal(6, LY_ARRAY_SIZE(((struct lysc_type_enum*)type)->enums));
+ assert_int_equal(6, LY_ARRAY_COUNT(((struct lysc_type_enum*)type)->enums));
assert_non_null(((struct lysc_type_enum*)type)->enums[2].iffeatures);
assert_string_equal("automin", ((struct lysc_type_enum*)type)->enums[0].name);
assert_int_equal(0, ((struct lysc_type_enum*)type)->enums[0].value);
@@ -1142,7 +1142,7 @@
assert_non_null(type);
assert_int_equal(LY_TYPE_ENUM, type->basetype);
assert_non_null(((struct lysc_type_enum*)type)->enums);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_enum*)type)->enums));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_enum*)type)->enums));
assert_string_equal("seven", ((struct lysc_type_enum*)type)->enums[0].name);
assert_int_equal(7, ((struct lysc_type_enum*)type)->enums[0].value);
assert_string_equal("eight", ((struct lysc_type_enum*)type)->enums[1].name);
@@ -1223,7 +1223,7 @@
assert_non_null(type);
assert_int_equal(LY_TYPE_BITS, type->basetype);
assert_non_null(((struct lysc_type_bits*)type)->bits);
- assert_int_equal(5, LY_ARRAY_SIZE(((struct lysc_type_bits*)type)->bits));
+ assert_int_equal(5, LY_ARRAY_COUNT(((struct lysc_type_bits*)type)->bits));
assert_non_null(((struct lysc_type_bits*)type)->bits[1].iffeatures);
assert_string_equal("automin", ((struct lysc_type_bits*)type)->bits[0].name);
assert_int_equal(0, ((struct lysc_type_bits*)type)->bits[0].position);
@@ -1243,7 +1243,7 @@
assert_non_null(type);
assert_int_equal(LY_TYPE_BITS, type->basetype);
assert_non_null(((struct lysc_type_bits*)type)->bits);
- assert_int_equal(3, LY_ARRAY_SIZE(((struct lysc_type_bits*)type)->bits));
+ assert_int_equal(3, LY_ARRAY_COUNT(((struct lysc_type_bits*)type)->bits));
assert_string_equal("automin", ((struct lysc_type_bits*)type)->bits[0].name);
assert_int_equal(0, ((struct lysc_type_bits*)type)->bits[0].position);
assert_string_equal("seven", ((struct lysc_type_bits*)type)->bits[1].name);
@@ -1319,7 +1319,7 @@
assert_int_equal(2, ((struct lysc_type_dec*)type)->fraction_digits);
assert_non_null(((struct lysc_type_dec*)type)->range);
assert_non_null(((struct lysc_type_dec*)type)->range->parts);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_dec*)type)->range->parts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_dec*)type)->range->parts));
assert_int_equal(INT64_C(-9223372036854775807) - INT64_C(1), ((struct lysc_type_dec*)type)->range->parts[0].min_64);
assert_int_equal(INT64_C(9223372036854775807), ((struct lysc_type_dec*)type)->range->parts[0].max_64);
@@ -1331,7 +1331,7 @@
assert_int_equal(2, ((struct lysc_type_dec*)type)->fraction_digits);
assert_non_null(((struct lysc_type_dec*)type)->range);
assert_non_null(((struct lysc_type_dec*)type)->range->parts);
- assert_int_equal(3, LY_ARRAY_SIZE(((struct lysc_type_dec*)type)->range->parts));
+ assert_int_equal(3, LY_ARRAY_COUNT(((struct lysc_type_dec*)type)->range->parts));
assert_int_equal(314, ((struct lysc_type_dec*)type)->range->parts[0].min_64);
assert_int_equal(314, ((struct lysc_type_dec*)type)->range->parts[0].max_64);
assert_int_equal(510, ((struct lysc_type_dec*)type)->range->parts[1].min_64);
@@ -1346,7 +1346,7 @@
assert_int_equal(2, ((struct lysc_type_dec*)type)->fraction_digits);
assert_non_null(((struct lysc_type_dec*)type)->range);
assert_non_null(((struct lysc_type_dec*)type)->range->parts);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_dec*)type)->range->parts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_dec*)type)->range->parts));
assert_int_equal(100, ((struct lysc_type_dec*)type)->range->parts[0].min_64);
assert_int_equal(6553500, ((struct lysc_type_dec*)type)->range->parts[0].max_64);
@@ -1449,14 +1449,14 @@
assert_non_null(type);
assert_int_equal(LY_TYPE_IDENT, type->basetype);
assert_non_null(((struct lysc_type_identityref*)type)->bases);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_type_identityref*)type)->bases));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_identityref*)type)->bases));
assert_string_equal("i", ((struct lysc_type_identityref*)type)->bases[0]->name);
type = ((struct lysc_node_leaf*)mod->compiled->data->next)->type;
assert_non_null(type);
assert_int_equal(LY_TYPE_IDENT, type->basetype);
assert_non_null(((struct lysc_type_identityref*)type)->bases);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_identityref*)type)->bases));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_identityref*)type)->bases));
assert_string_equal("k", ((struct lysc_type_identityref*)type)->bases[0]->name);
assert_string_equal("j", ((struct lysc_type_identityref*)type)->bases[1]->name);
@@ -1466,7 +1466,7 @@
assert_non_null(type);
assert_int_equal(LY_TYPE_IDENT, type->basetype);
assert_non_null(((struct lysc_type_identityref*)type)->bases);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_identityref*)type)->bases));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_identityref*)type)->bases));
assert_string_equal("k", ((struct lysc_type_identityref*)type)->bases[0]->name);
assert_string_equal("j", ((struct lysc_type_identityref*)type)->bases[1]->name);
@@ -1937,7 +1937,7 @@
assert_int_equal(2, type->refcount);
assert_int_equal(LY_TYPE_UNION, type->basetype);
assert_non_null(((struct lysc_type_union*)type)->types);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_union*)type)->types));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_union*)type)->types));
assert_int_equal(LY_TYPE_INT8, ((struct lysc_type_union*)type)->types[0]->basetype);
assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_union*)type)->types[1]->basetype);
@@ -1949,7 +1949,7 @@
assert_int_equal(1, type->refcount);
assert_int_equal(LY_TYPE_UNION, type->basetype);
assert_non_null(((struct lysc_type_union*)type)->types);
- assert_int_equal(3, LY_ARRAY_SIZE(((struct lysc_type_union*)type)->types));
+ assert_int_equal(3, LY_ARRAY_COUNT(((struct lysc_type_union*)type)->types));
assert_int_equal(LY_TYPE_DEC64, ((struct lysc_type_union*)type)->types[0]->basetype);
assert_int_equal(LY_TYPE_INT8, ((struct lysc_type_union*)type)->types[1]->basetype);
assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_union*)type)->types[2]->basetype);
@@ -1964,7 +1964,7 @@
assert_int_equal(1, type->refcount);
assert_int_equal(LY_TYPE_UNION, type->basetype);
assert_non_null(((struct lysc_type_union*)type)->types);
- assert_int_equal(3, LY_ARRAY_SIZE(((struct lysc_type_union*)type)->types));
+ assert_int_equal(3, LY_ARRAY_COUNT(((struct lysc_type_union*)type)->types));
assert_int_equal(LY_TYPE_DEC64, ((struct lysc_type_union*)type)->types[0]->basetype);
assert_int_equal(LY_TYPE_LEAFREF, ((struct lysc_type_union*)type)->types[1]->basetype);
assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_union*)type)->types[2]->basetype);
@@ -2019,7 +2019,7 @@
assert_int_equal(1, type->refcount);
assert_int_equal(LY_TYPE_UNION, type->basetype);
assert_non_null(((struct lysc_type_union*)type)->types);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_type_union*)type)->types));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_type_union*)type)->types));
assert_int_equal(LY_TYPE_DEC64, ((struct lysc_type_union*)type)->types[0]->basetype);
assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_union*)type)->types[1]->basetype);
assert_null(((struct lysc_node_leaf*)mod->compiled->data)->dflt);
@@ -2188,8 +2188,8 @@
assert_non_null((child = child->next));
assert_string_equal("y", child->name);
assert_non_null(child->iffeatures);
- assert_int_equal(1, LY_ARRAY_SIZE(child->iffeatures));
- assert_int_equal(1, LY_ARRAY_SIZE(child->iffeatures[0].features));
+ assert_int_equal(1, LY_ARRAY_COUNT(child->iffeatures));
+ assert_int_equal(1, LY_ARRAY_COUNT(child->iffeatures[0].features));
assert_string_equal("f", child->iffeatures[0].features[0]->name);
assert_int_equal(LY_EINVAL, lys_feature_enable(mod->compiled->imports[0].module, "f"));
logbuf_assert("Module \"grp\" is not implemented so all its features are permanently disabled without a chance to change it.");
@@ -2207,7 +2207,7 @@
assert_non_null(mod->compiled->data);
assert_int_equal(LYS_LEAF, mod->compiled->data->nodetype);
assert_string_equal("b", mod->compiled->data->name);
- assert_int_equal(2, LY_ARRAY_SIZE(mod->compiled->data->when));
+ assert_int_equal(2, LY_ARRAY_COUNT(mod->compiled->data->when));
assert_int_equal(1, mod->compiled->data->when[0]->refcount);
assert_non_null(mod->compiled->data->when[0]->context);
assert_string_equal("b", mod->compiled->data->when[0]->context->name);
@@ -2216,7 +2216,7 @@
assert_int_equal(LYS_LEAF, mod->compiled->data->next->nodetype);
assert_string_equal("c", mod->compiled->data->next->name);
- assert_int_equal(1, LY_ARRAY_SIZE(mod->compiled->data->next->when));
+ assert_int_equal(1, LY_ARRAY_COUNT(mod->compiled->data->next->when));
assert_int_equal(2, mod->compiled->data->next->when[0]->refcount);
assert_null(mod->compiled->data->next->when[0]->context);
@@ -2245,7 +2245,7 @@
assert_non_null(mod->compiled->data);
cont = (const struct lysc_node_container*)mod->compiled->data;
assert_non_null(cont->actions);
- assert_int_equal(2, LY_ARRAY_SIZE(cont->actions));
+ assert_int_equal(2, LY_ARRAY_COUNT(cont->actions));
assert_string_equal("e", cont->actions[1].name);
assert_string_equal("g", cont->actions[0].name);
assert_string_equal("ultra g", cont->actions[0].dsc);
@@ -2255,7 +2255,7 @@
assert_non_null(mod->compiled->data);
cont = (const struct lysc_node_container*)mod->compiled->data;
assert_non_null(cont->notifs);
- assert_int_equal(2, LY_ARRAY_SIZE(cont->notifs));
+ assert_int_equal(2, LY_ARRAY_COUNT(cont->notifs));
assert_string_equal("f", cont->notifs[1].name);
assert_string_equal("g", cont->notifs[0].name);
assert_string_equal("ultra g", cont->notifs[0].dsc);
@@ -2358,7 +2358,7 @@
assert_non_null(llist = (struct lysc_node_leaflist*)leaf->next);
assert_int_equal(LYS_LEAFLIST, llist->nodetype);
assert_string_equal("ll", llist->name);
- assert_int_equal(2, LY_ARRAY_SIZE(llist->dflts));
+ assert_int_equal(2, LY_ARRAY_COUNT(llist->dflts));
assert_string_equal("hello", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LYD_XML, NULL, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_string_equal("world", llist->dflts[1]->realtype->plugin->print(llist->dflts[1], LYD_XML, NULL, NULL, &dynamic));
@@ -2372,7 +2372,7 @@
assert_true(LYS_SET_DFLT & ((struct lysc_node_choice*)child)->dflt->flags);
assert_false(LYS_SET_DFLT & ((struct lysc_node_choice*)child)->cases[0].flags);
assert_non_null(child->iffeatures);
- assert_int_equal(1, LY_ARRAY_SIZE(child->iffeatures));
+ assert_int_equal(1, LY_ARRAY_COUNT(child->iffeatures));
assert_non_null(leaf = (struct lysc_node_leaf*)child->next);
assert_int_equal(LYS_LEAF, leaf->nodetype);
assert_string_equal("x", leaf->name);
@@ -2380,7 +2380,7 @@
assert_string_equal("cheers!", leaf->dflt->realtype->plugin->print(leaf->dflt, LYD_XML, NULL, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_non_null(leaf->musts);
- assert_int_equal(2, LY_ARRAY_SIZE(leaf->musts));
+ assert_int_equal(2, LY_ARRAY_COUNT(leaf->musts));
assert_string_equal("refined", leaf->dsc);
assert_string_equal("refined", leaf->ref);
assert_non_null(child = leaf->next);
@@ -2388,9 +2388,9 @@
assert_string_equal("a", child->name);
assert_true(LYS_MAND_TRUE & child->flags);
assert_non_null(((struct lysc_node_anydata*)child)->musts);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_node_anydata*)child)->musts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_node_anydata*)child)->musts));
assert_non_null(child->iffeatures);
- assert_int_equal(2, LY_ARRAY_SIZE(child->iffeatures));
+ assert_int_equal(2, LY_ARRAY_COUNT(child->iffeatures));
assert_string_equal("refined", child->dsc);
assert_string_equal("refined", child->ref);
assert_non_null(child = child->next);
@@ -2576,7 +2576,7 @@
"augment /hi:func/output {leaf y {type string;}}}", LYS_IN_YANG));
assert_non_null(mod = ly_ctx_get_module_implemented(ctx, "himp"));
assert_non_null(rpc = mod->compiled->rpcs);
- assert_int_equal(1, LY_ARRAY_SIZE(rpc));
+ assert_int_equal(1, LY_ARRAY_COUNT(rpc));
assert_non_null(rpc->input.data);
assert_string_equal("x", rpc->input.data->name);
assert_null(rpc->input.data->next);
@@ -2590,7 +2590,7 @@
assert_non_null(cont = (const struct lysc_node_container*)mod->compiled->data);
assert_null(cont->child);
assert_non_null(notif = cont->notifs);
- assert_int_equal(1, LY_ARRAY_SIZE(notif));
+ assert_int_equal(1, LY_ARRAY_COUNT(notif));
assert_null(lys_parse_mem(ctx, "module aa {namespace urn:aa;prefix aa; container c {leaf a {type string;}}"
"augment /x {leaf a {type int8;}}}", LYS_IN_YANG));
@@ -2668,7 +2668,7 @@
assert_string_equal("ch", node->name);
assert_null(((struct lysc_node_choice*)node)->dflt);
assert_null(((struct lysc_node_choice*)node)->cases);
- assert_int_equal(1, LY_ARRAY_SIZE(mod->compiled->rpcs));
+ assert_int_equal(1, LY_ARRAY_COUNT(mod->compiled->rpcs));
assert_null(mod->compiled->rpcs[0].input.data);
assert_null(mod->compiled->rpcs[0].output.data);
@@ -2694,11 +2694,11 @@
"deviation /c3 {deviate delete {must 3; must 1;}}}", LYS_IN_YANG));
assert_non_null(node = mod->compiled->data);
assert_string_equal("c1", node->name);
- assert_int_equal(2, LY_ARRAY_SIZE(((struct lysc_node_leaf*)node)->musts));
+ assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_node_leaf*)node)->musts));
assert_string_equal("3", ((struct lysc_node_leaf*)node)->musts[1].cond->expr);
assert_non_null(node = node->next);
assert_string_equal("c2", node->name);
- assert_int_equal(1, LY_ARRAY_SIZE(((struct lysc_node_container*)node)->musts));
+ assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_node_container*)node)->musts));
assert_string_equal("1", ((struct lysc_node_container*)node)->musts[0].cond->expr);
assert_non_null(node = node->next);
assert_string_equal("c3", node->name);
@@ -2723,7 +2723,7 @@
assert_non_null(leaf = (struct lysc_node_leaf*)node->next);
assert_null(leaf->dflt);
assert_non_null(llist = (struct lysc_node_leaflist*)leaf->next);
- assert_int_equal(1, LY_ARRAY_SIZE(llist->dflts));
+ assert_int_equal(1, LY_ARRAY_COUNT(llist->dflts));
assert_string_equal("hello", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LYD_XML, NULL, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_non_null(leaf = (struct lysc_node_leaf*)llist->next);
@@ -2731,7 +2731,7 @@
assert_int_equal(0, dynamic);
assert_int_equal(5, leaf->dflt->realtype->refcount); /* 3x type reference, 2x default value reference (typedef's default does not reference own type) */
assert_non_null(llist = (struct lysc_node_leaflist*)leaf->next);
- assert_int_equal(1, LY_ARRAY_SIZE(llist->dflts));
+ assert_int_equal(1, LY_ARRAY_COUNT(llist->dflts));
assert_string_equal("nothing", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LYD_XML, NULL, NULL, &dynamic));
assert_int_equal(0, dynamic);
@@ -2752,7 +2752,7 @@
assert_string_equal("bye", leaf->dflt->realtype->plugin->print(leaf->dflt, LYD_XML, NULL, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_non_null(llist = (struct lysc_node_leaflist*)leaf->next);
- assert_int_equal(3, LY_ARRAY_SIZE(llist->dflts));
+ assert_int_equal(3, LY_ARRAY_COUNT(llist->dflts));
assert_string_equal("hello", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LYD_XML, NULL, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_string_equal("all", llist->dflts[1]->realtype->plugin->print(llist->dflts[1], LYD_XML, NULL, NULL, &dynamic));
@@ -2765,10 +2765,10 @@
assert_int_equal(0, dynamic);
assert_int_equal(6, leaf->dflt->realtype->refcount); /* 3x type reference, 3x default value reference
- previous type's default values were replaced by node's default values where d2 now has 2 default values */
- assert_int_equal(1, LY_ARRAY_SIZE(leaf->musts));
+ assert_int_equal(1, LY_ARRAY_COUNT(leaf->musts));
assert_ptr_equal(leaf->musts[0].module, ly_ctx_get_module_implemented(ctx, "g"));
assert_non_null(llist = (struct lysc_node_leaflist*)leaf->next);
- assert_int_equal(2, LY_ARRAY_SIZE(llist->dflts));
+ assert_int_equal(2, LY_ARRAY_COUNT(llist->dflts));
assert_string_equal("hi", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LYD_XML, NULL, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_string_equal("all", llist->dflts[1]->realtype->plugin->print(llist->dflts[1], LYD_XML, NULL, NULL, &dynamic));
@@ -2800,11 +2800,11 @@
assert_non_null((mod = ly_ctx_get_module_implemented(ctx, "i")));
assert_non_null(list = (struct lysc_node_list*)mod->compiled->data);
assert_string_equal("l1", list->name);
- assert_int_equal(2, LY_ARRAY_SIZE(list->uniques));
- assert_int_equal(2, LY_ARRAY_SIZE(list->uniques[0]));
+ assert_int_equal(2, LY_ARRAY_COUNT(list->uniques));
+ assert_int_equal(2, LY_ARRAY_COUNT(list->uniques[0]));
assert_string_equal("b", list->uniques[0][0]->name);
assert_string_equal("j_c", list->uniques[0][1]->name);
- assert_int_equal(1, LY_ARRAY_SIZE(list->uniques[1]));
+ assert_int_equal(1, LY_ARRAY_COUNT(list->uniques[1]));
assert_string_equal("c", list->uniques[1][0]->name);
assert_non_null(list = (struct lysc_node_list*)list->next);
assert_string_equal("l2", list->name);
@@ -2908,7 +2908,7 @@
assert_non_null(llist = (struct lysc_node_leaflist*)leaf->next);
assert_string_equal("b", llist->name);
assert_int_equal(LY_TYPE_INT8, llist->type->basetype);
- assert_int_equal(1, LY_ARRAY_SIZE(llist->dflts));
+ assert_int_equal(1, LY_ARRAY_COUNT(llist->dflts));
assert_string_equal("1", llist->dflts[0]->realtype->plugin->print(llist->dflts[0], LYD_XML, NULL, NULL, &dynamic));
assert_int_equal(0, dynamic);
assert_int_equal(1, llist->dflts[0]->uint8);
@@ -2925,8 +2925,8 @@
assert_non_null(leaf->dflt->canonical_cache);
assert_string_equal("/e:d2[.='a']", leaf->dflt->canonical_cache);
assert_non_null(llist = (struct lysc_node_leaflist*)leaf->next);
- assert_int_equal(2, LY_ARRAY_SIZE(llist->dflts));
- assert_int_equal(2, LY_ARRAY_SIZE(llist->dflts_mods));
+ assert_int_equal(2, LY_ARRAY_COUNT(llist->dflts));
+ assert_int_equal(2, LY_ARRAY_COUNT(llist->dflts_mods));
assert_ptr_equal(llist->dflts_mods[0], mod);
assert_int_equal(LY_TYPE_STRING, llist->dflts[0]->realtype->basetype);
assert_string_equal("/e:d[.='b']", llist->dflts[0]->canonical_cache);