tree schema FEATURE use LY_ENOT for false feature state
diff --git a/tests/utests/schema/test_schema_stmts.c b/tests/utests/schema/test_schema_stmts.c
index 35ce06a..eab21c9 100644
--- a/tests/utests/schema/test_schema_stmts.c
+++ b/tests/utests/schema/test_schema_stmts.c
@@ -211,56 +211,56 @@
/* all features are disabled by default */
LY_ARRAY_FOR(mod->compiled->features, struct lysc_feature, f) {
- assert_int_equal(0, lysc_feature_value(f));
+ assert_int_equal(LY_ENOT, lysc_feature_value(f));
}
/* enable f1 */
assert_int_equal(LY_SUCCESS, lys_feature_enable(mod, "f1"));
f1 = &mod->compiled->features[0];
- assert_int_equal(1, lysc_feature_value(f1));
+ assert_int_equal(LY_SUCCESS, lysc_feature_value(f1));
/* enable orfeature */
f = &mod->compiled->features[3];
- assert_int_equal(0, lysc_feature_value(f));
+ assert_int_equal(LY_ENOT, lysc_feature_value(f));
assert_int_equal(LY_SUCCESS, lys_feature_enable(mod, "orfeature"));
- assert_int_equal(1, lysc_feature_value(f));
+ assert_int_equal(LY_SUCCESS, lysc_feature_value(f));
/* enable andfeature - no possible since f2 is disabled */
f = &mod->compiled->features[4];
- assert_int_equal(0, lysc_feature_value(f));
+ assert_int_equal(LY_ENOT, lysc_feature_value(f));
assert_int_equal(LY_EDENIED, lys_feature_enable(mod, "andfeature"));
logbuf_assert("Feature \"andfeature\" cannot be enabled since it is disabled by its if-feature condition(s).");
- assert_int_equal(0, lysc_feature_value(f));
+ assert_int_equal(LY_ENOT, lysc_feature_value(f));
/* first enable f2, so f5 can be enabled then */
assert_int_equal(LY_SUCCESS, lys_feature_enable(mod, "f2"));
assert_int_equal(LY_SUCCESS, lys_feature_enable(mod, "andfeature"));
- assert_int_equal(1, lysc_feature_value(f));
+ assert_int_equal(LY_SUCCESS, lysc_feature_value(f));
/* f1 is enabled, so f6 cannot be enabled */
f = &mod->compiled->features[5];
- assert_int_equal(0, lysc_feature_value(f));
+ assert_int_equal(LY_ENOT, lysc_feature_value(f));
assert_int_equal(LY_EDENIED, lys_feature_enable(mod, "f6"));
logbuf_assert("Feature \"f6\" cannot be enabled since it is disabled by its if-feature condition(s).");
- assert_int_equal(0, lysc_feature_value(f));
+ assert_int_equal(LY_ENOT, lysc_feature_value(f));
/* so disable f1 - andfeature will became also disabled */
- assert_int_equal(1, lysc_feature_value(f1));
+ assert_int_equal(LY_SUCCESS, lysc_feature_value(f1));
assert_int_equal(LY_SUCCESS, lys_feature_disable(mod, "f1"));
- assert_int_equal(0, lysc_feature_value(f1));
- assert_int_equal(0, lysc_feature_value(&mod->compiled->features[4]));
+ assert_int_equal(LY_ENOT, lysc_feature_value(f1));
+ assert_int_equal(LY_ENOT, lysc_feature_value(&mod->compiled->features[4]));
/* while orfeature is stille enabled */
- assert_int_equal(1, lysc_feature_value(&mod->compiled->features[3]));
+ assert_int_equal(LY_SUCCESS, lysc_feature_value(&mod->compiled->features[3]));
/* and finally f6 can be enabled */
assert_int_equal(LY_SUCCESS, lys_feature_enable(mod, "f6"));
- assert_int_equal(1, lysc_feature_value(&mod->compiled->features[5]));
+ assert_int_equal(LY_SUCCESS, lysc_feature_value(&mod->compiled->features[5]));
/* complex evaluation of f7: f1 and f3 are disabled, while f2 is enabled */
- assert_int_equal(1, lysc_iffeature_value(&mod->compiled->features[6].iffeatures[0]));
+ assert_int_equal(LY_SUCCESS, lysc_iffeature_value(&mod->compiled->features[6].iffeatures[0]));
/* long evaluation of f8 to need to reallocate internal stack for operators */
- assert_int_equal(1, lysc_iffeature_value(&mod->compiled->features[7].iffeatures[0]));
+ assert_int_equal(LY_SUCCESS, lysc_iffeature_value(&mod->compiled->features[7].iffeatures[0]));
/* double negation of disabled f1 -> disabled */
- assert_int_equal(0, lysc_iffeature_value(&mod->compiled->features[8].iffeatures[0]));
+ assert_int_equal(LY_ENOT, lysc_iffeature_value(&mod->compiled->features[8].iffeatures[0]));
/* disable all features */
assert_int_equal(LY_SUCCESS, lys_feature_disable(mod, "*"));
diff --git a/tests/utests/schema/test_tree_schema_compile.c b/tests/utests/schema/test_tree_schema_compile.c
index 81d13bb..b82b814 100644
--- a/tests/utests/schema/test_tree_schema_compile.c
+++ b/tests/utests/schema/test_tree_schema_compile.c
@@ -2227,14 +2227,14 @@
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.");
- assert_int_equal(0, lysc_iffeature_value(&child->iffeatures[0]));
+ assert_int_equal(LY_ENOT, lysc_iffeature_value(&child->iffeatures[0]));
/* make the imported module implemented and enable the feature */
assert_non_null(mod = ly_ctx_get_module(ctx, "grp", NULL));
assert_int_equal(LY_SUCCESS, lys_set_implemented(mod));
assert_int_equal(LY_SUCCESS, lys_feature_enable(mod, "f"));
assert_string_equal("f", child->iffeatures[0].features[0]->name);
- assert_int_equal(1, lysc_iffeature_value(&child->iffeatures[0]));
+ assert_int_equal(LY_SUCCESS, lysc_iffeature_value(&child->iffeatures[0]));
ly_ctx_set_module_imp_clb(ctx, test_imp_clb, "submodule bsub {belongs-to b {prefix b;} grouping grp {leaf b {when 1; type string;} leaf c {type string;}}}");
assert_non_null(mod = lys_parse_mem(ctx, "module b {namespace urn:b;prefix b;include bsub;uses grp {when 2;}}", LYS_IN_YANG));