Skip to content

Commit 96b050a

Browse files
author
Petr Hanzlik
committed
utests schema UPDATE replace internal funstions with API
1 parent ec9fa30 commit 96b050a

5 files changed

Lines changed: 2974 additions & 3173 deletions

File tree

tests/utests/schema/test_schema.c

Lines changed: 32 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@
1919
#include <string.h>
2020
#include <sys/stat.h>
2121

22-
#include "compat.h"
2322
#include "context.h"
2423
#include "log.h"
2524
#include "parser_schema.h"
2625
#include "plugins_exts.h"
2726
#include "set.h"
2827
#include "tree_edit.h"
2928
#include "tree_schema.h"
30-
#include "tree_schema_internal.h"
3129

3230
static LY_ERR
3331
test_imp_clb(const char *UNUSED(mod_name), const char *UNUSED(mod_rev), const char *UNUSED(submod_name),
@@ -246,28 +244,38 @@ test_getnext(void **state)
246244
static void
247245
test_date(void **state)
248246
{
249-
assert_int_equal(LY_EINVAL, lys_check_date(UTEST_LYCTX, NULL, 0, "date"));
250-
CHECK_LOG_CTX("Invalid argument date (lys_check_date()).", NULL, 0);
251-
assert_int_equal(LY_EINVAL, lys_check_date(UTEST_LYCTX, "x", 1, "date"));
252-
CHECK_LOG_CTX("Invalid length 1 of a date.", NULL, 0);
253-
assert_int_equal(LY_EINVAL, lys_check_date(UTEST_LYCTX, "nonsencexx", 10, "date"));
254-
CHECK_LOG_CTX("Invalid value \"nonsencexx\" of \"date\".", NULL, 0);
255-
assert_int_equal(LY_EINVAL, lys_check_date(UTEST_LYCTX, "123x-11-11", 10, "date"));
256-
CHECK_LOG_CTX("Invalid value \"123x-11-11\" of \"date\".", NULL, 0);
257-
assert_int_equal(LY_EINVAL, lys_check_date(UTEST_LYCTX, "2018-13-11", 10, "date"));
258-
CHECK_LOG_CTX("Invalid value \"2018-13-11\" of \"date\".", NULL, 0);
259-
assert_int_equal(LY_EINVAL, lys_check_date(UTEST_LYCTX, "2018-11-41", 10, "date"));
260-
CHECK_LOG_CTX("Invalid value \"2018-11-41\" of \"date\".", NULL, 0);
261-
assert_int_equal(LY_EINVAL, lys_check_date(UTEST_LYCTX, "2018-02-29", 10, "date"));
262-
CHECK_LOG_CTX("Invalid value \"2018-02-29\" of \"date\".", NULL, 0);
263-
assert_int_equal(LY_EINVAL, lys_check_date(UTEST_LYCTX, "2018.02-28", 10, "date"));
264-
CHECK_LOG_CTX("Invalid value \"2018.02-28\" of \"date\".", NULL, 0);
265-
assert_int_equal(LY_EINVAL, lys_check_date(UTEST_LYCTX, "2018-02.28", 10, "date"));
266-
CHECK_LOG_CTX("Invalid value \"2018-02.28\" of \"date\".", NULL, 0);
267-
268-
assert_int_equal(LY_SUCCESS, lys_check_date(NULL, "2018-11-11", 10, "date"));
269-
assert_int_equal(LY_SUCCESS, lys_check_date(NULL, "2018-02-28", 10, "date"));
270-
assert_int_equal(LY_SUCCESS, lys_check_date(NULL, "2016-02-29", 10, "date"));
247+
struct ly_ctx *ctx = UTEST_LYCTX;
248+
char yang[256];
249+
size_t i;
250+
const char *invalid[] = {
251+
"",
252+
"x",
253+
"nonsencexx",
254+
"123x-11-11",
255+
"2018-13-11",
256+
"2018-11-41",
257+
"2018-02-29",
258+
"2018.02-28",
259+
"2018-02.28"
260+
};
261+
const char *valid[] = {
262+
"2018-11-11",
263+
"2018-02-28",
264+
"2016-02-29"
265+
};
266+
267+
/* 1. Test Invalid Dates */
268+
for (i = 0; i < sizeof(invalid) / sizeof(invalid[0]); ++i) {
269+
snprintf(yang, sizeof(yang), "module a {namespace urn:a;prefix a;revision \"%s\";}", invalid[i]);
270+
assert_int_equal(LY_EVALID, lys_parse_mem(ctx, yang, LYS_IN_YANG, NULL));
271+
UTEST_LOG_CTX_CLEAN;
272+
}
273+
274+
/* 2. Test Valid Dates */
275+
for (i = 0; i < sizeof(valid) / sizeof(valid[0]); ++i) {
276+
snprintf(yang, sizeof(yang), "module v%zu {namespace urn:v%zu;prefix v;revision \"%s\";}", i, i, valid[i]);
277+
assert_int_equal(LY_SUCCESS, lys_parse_mem(ctx, yang, LYS_IN_YANG, NULL));
278+
}
271279
}
272280

273281
static void
@@ -1667,76 +1675,6 @@ test_extension_argument_element(void **state)
16671675

16681676
}
16691677

1670-
static void
1671-
test_extension_compile(void **state)
1672-
{
1673-
struct lys_module *mod;
1674-
struct lysc_ctx cctx = {0};
1675-
struct lysp_ext_instance ext_p = {0};
1676-
struct lysp_ext_substmt *substmtp;
1677-
struct lysp_stmt child = {0};
1678-
struct lysc_ext_instance ext_c = {0};
1679-
struct lysc_ext_substmt *substmt;
1680-
LY_ERR rc = LY_SUCCESS;
1681-
1682-
/* current module, whatever */
1683-
mod = ly_ctx_get_module_implemented(UTEST_LYCTX, "yang");
1684-
assert_true(mod);
1685-
1686-
/* compile context */
1687-
cctx.ctx = UTEST_LYCTX;
1688-
cctx.cur_mod = mod;
1689-
cctx.pmod = mod->parsed;
1690-
cctx.path_len = 1;
1691-
cctx.path[0] = '/';
1692-
1693-
/* parsed ext instance */
1694-
lysdict_insert(UTEST_LYCTX, "pref:my-ext", 0, &ext_p.name);
1695-
ext_p.format = LY_VALUE_JSON;
1696-
ext_p.parent_stmt = LY_STMT_MODULE;
1697-
1698-
LY_ARRAY_NEW_GOTO(UTEST_LYCTX, ext_p.substmts, substmtp, rc, cleanup);
1699-
1700-
substmtp->stmt = LY_STMT_ERROR_MESSAGE;
1701-
substmtp->storage_p = &ext_p.parsed;
1702-
/* fake parse */
1703-
lysdict_insert(UTEST_LYCTX, "my error", 0, (const char **)&ext_p.parsed);
1704-
1705-
/* compiled ext instance */
1706-
ext_c.parent_stmt = ext_p.parent_stmt;
1707-
LY_ARRAY_NEW_GOTO(UTEST_LYCTX, ext_c.substmts, substmt, rc, cleanup);
1708-
1709-
substmt->stmt = LY_STMT_ERROR_MESSAGE;
1710-
substmt->storage_p = &ext_c.compiled;
1711-
1712-
/*
1713-
* error-message
1714-
*/
1715-
ext_p.child = &child;
1716-
lysdict_insert(UTEST_LYCTX, "error-message", 0, &child.stmt);
1717-
lysdict_insert(UTEST_LYCTX, "my error", 0, &child.arg);
1718-
child.format = LY_VALUE_JSON;
1719-
child.kw = LY_STMT_ERROR_MESSAGE;
1720-
1721-
/* compile */
1722-
assert_int_equal(LY_SUCCESS, lyplg_ext_compile_extension_instance(&cctx, &ext_p, &ext_c, NULL));
1723-
1724-
/* check */
1725-
assert_string_equal(ext_c.compiled, "my error");
1726-
1727-
cleanup:
1728-
lysdict_remove(UTEST_LYCTX, ext_p.name);
1729-
lysdict_remove(UTEST_LYCTX, child.stmt);
1730-
lysdict_remove(UTEST_LYCTX, child.arg);
1731-
LY_ARRAY_FREE(ext_p.substmts);
1732-
lysdict_remove(UTEST_LYCTX, ext_p.parsed);
1733-
LY_ARRAY_FREE(ext_c.substmts);
1734-
lysdict_remove(UTEST_LYCTX, ext_c.compiled);
1735-
if (rc) {
1736-
fail();
1737-
}
1738-
}
1739-
17401678
static void
17411679
test_ext_recursive(void **state)
17421680
{
@@ -2313,7 +2251,6 @@ main(void)
23132251
UTEST(test_feature),
23142252
UTEST(test_extension_argument),
23152253
UTEST(test_extension_argument_element),
2316-
UTEST(test_extension_compile),
23172254
UTEST(test_ext_recursive),
23182255
UTEST(test_lysc_path),
23192256
UTEST(test_lysc_backlinks),

tests/utests/schema/test_tree_schema_compile.c

Lines changed: 40 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@
1616
#include "utests.h"
1717

1818
#include "in.h"
19-
#include "ly_common.h"
20-
#include "parser_internal.h"
21-
#include "path.h"
2219
#include "plugins_types.h"
23-
#include "schema_compile.h"
24-
#include "xpath.h"
2520

2621
static int
2722
setup(void **state)
@@ -89,15 +84,13 @@ test_module(void **state)
8984
struct lys_module *mod = NULL;
9085
struct lysp_feature *f;
9186
struct lysc_iffeature *iff;
92-
struct lys_glob_unres unres = {0};
9387

9488
str = "module test {namespace urn:test; prefix t;"
9589
"feature f1;feature f2 {if-feature f1;}}";
9690
assert_int_equal(LY_SUCCESS, ly_in_new_memory(str, &in));
97-
assert_int_equal(LY_SUCCESS, lys_parse_in(UTEST_LYCTX, in, LYS_IN_YANG, NULL, &unres.creating, &mod));
98-
lys_unres_glob_erase(&unres);
91+
assert_int_equal(LY_SUCCESS, lys_parse(UTEST_LYCTX, in, LYS_IN_YANG, NULL, &mod));
9992
ly_in_free(in, 0);
100-
assert_int_equal(0, mod->implemented);
93+
assert_int_equal(1, mod->implemented);
10194
assert_int_equal(LY_EINVAL, lys_set_implemented(mod, feats));
10295
CHECK_LOG_CTX("Feature \"invalid\" not found in module \"test@<none>\".", NULL, 0);
10396
assert_int_equal(LY_SUCCESS, lys_set_implemented(mod, NULL));
@@ -120,8 +113,7 @@ test_module(void **state)
120113
/* submodules cannot be compiled directly */
121114
str = "submodule test {belongs-to xxx {prefix x;}}";
122115
assert_int_equal(LY_SUCCESS, ly_in_new_memory(str, &in));
123-
assert_int_equal(LY_EINVAL, lys_parse_in(UTEST_LYCTX, in, LYS_IN_YANG, NULL, &unres.creating, NULL));
124-
lys_unres_glob_erase(&unres);
116+
assert_int_equal(LY_EINVAL, lys_parse(UTEST_LYCTX, in, LYS_IN_YANG, NULL, NULL));
125117
ly_in_free(in, 0);
126118
CHECK_LOG_CTX("Input data contains submodule which cannot be parsed directly without its main module.", NULL, 0);
127119

@@ -1701,49 +1693,31 @@ test_type_leafref(void **state)
17011693
char *str;
17021694
struct lys_module *mod;
17031695
struct lysc_type *type;
1704-
const char *path;
1705-
struct lyxp_expr *expr;
1706-
1707-
/* lys_path_parse() */
1708-
path = "invalid_path";
1709-
assert_int_equal(LY_EVALID, ly_path_parse(UTEST_LYCTX, NULL, path, strlen(path), 1, LY_PATH_BEGIN_EITHER,
1710-
LY_PATH_PREFIX_OPTIONAL, LY_PATH_PRED_LEAFREF, &expr));
1711-
CHECK_LOG_CTX("Unexpected XPath token \"NameTest\" (\"invalid_path\"), expected \"..\".", NULL, 0);
1712-
1713-
path = "..";
1714-
assert_int_equal(LY_EVALID, ly_path_parse(UTEST_LYCTX, NULL, path, strlen(path), 1, LY_PATH_BEGIN_EITHER,
1715-
LY_PATH_PREFIX_OPTIONAL, LY_PATH_PRED_LEAFREF, &expr));
1716-
CHECK_LOG_CTX("Unexpected XPath expression end.", NULL, 0);
1717-
1718-
path = "..[";
1719-
assert_int_equal(LY_EVALID, ly_path_parse(UTEST_LYCTX, NULL, path, strlen(path), 1, LY_PATH_BEGIN_EITHER,
1720-
LY_PATH_PREFIX_OPTIONAL, LY_PATH_PRED_LEAFREF, &expr));
1721-
CHECK_LOG_CTX("Unexpected XPath token \"[\" (\"[\"), expected \"Operator(Path)\".", NULL, 0);
1722-
1723-
path = "../";
1724-
assert_int_equal(LY_EVALID, ly_path_parse(UTEST_LYCTX, NULL, path, strlen(path), 1, LY_PATH_BEGIN_EITHER,
1725-
LY_PATH_PREFIX_OPTIONAL, LY_PATH_PRED_LEAFREF, &expr));
1726-
CHECK_LOG_CTX("Unexpected XPath expression end.", NULL, 0);
1727-
1728-
path = "/";
1729-
assert_int_equal(LY_EVALID, ly_path_parse(UTEST_LYCTX, NULL, path, strlen(path), 1, LY_PATH_BEGIN_EITHER,
1730-
LY_PATH_PREFIX_OPTIONAL, LY_PATH_PRED_LEAFREF, &expr));
1731-
CHECK_LOG_CTX("Unexpected XPath expression end.", NULL, 0);
1732-
1733-
path = "../../pref:id/xxx[predicate]/invalid!!!";
1734-
assert_int_equal(LY_EVALID, ly_path_parse(UTEST_LYCTX, NULL, path, strlen(path), 1, LY_PATH_BEGIN_EITHER,
1735-
LY_PATH_PREFIX_OPTIONAL, LY_PATH_PRED_LEAFREF, &expr));
1736-
CHECK_LOG_CTX("Invalid character 0x21 ('!'), perhaps \"invalid\" is supposed to be a function call.", NULL, 0);
1737-
1738-
path = "/absolute/prefix:path";
1739-
assert_int_equal(LY_SUCCESS, ly_path_parse(UTEST_LYCTX, NULL, path, strlen(path), 1, LY_PATH_BEGIN_EITHER,
1740-
LY_PATH_PREFIX_OPTIONAL, LY_PATH_PRED_LEAFREF, &expr));
1741-
assert_int_equal(4, expr->used);
1742-
assert_int_equal(LYXP_TOKEN_OPER_PATH, expr->tokens[0]);
1743-
assert_int_equal(LYXP_TOKEN_NAMETEST, expr->tokens[1]);
1744-
assert_int_equal(LYXP_TOKEN_OPER_PATH, expr->tokens[2]);
1745-
assert_int_equal(LYXP_TOKEN_NAMETEST, expr->tokens[3]);
1746-
lyxp_expr_free(expr);
1696+
char yang[512];
1697+
size_t i;
1698+
const char *invalid[] = {
1699+
"invalid_path",
1700+
"..[",
1701+
"../",
1702+
"/",
1703+
"../../pref:id/xxx[predicate]/invalid!!!"
1704+
};
1705+
1706+
/* 1. Test Invalid Paths */
1707+
for (i = 0; i < sizeof(invalid) / sizeof(invalid[0]); ++i) {
1708+
snprintf(yang, sizeof(yang), "module a {namespace urn:a;prefix a; leaf l { type leafref { path \"%s\"; } } }", invalid[i]);
1709+
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, yang, LYS_IN_YANG, NULL));
1710+
UTEST_LOG_CTX_CLEAN;
1711+
}
1712+
1713+
/* 2. Test Valid Path */
1714+
const char *valid_yang =
1715+
"module v {namespace urn:v; prefix prefix;"
1716+
" container absolute { leaf path { type string; } }"
1717+
" leaf l { type leafref { path \"/absolute/prefix:path\"; } }"
1718+
"}";
1719+
1720+
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, valid_yang, LYS_IN_YANG, NULL));
17471721

17481722
/* complete leafref paths */
17491723
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module a {yang-version 1.1;namespace urn:a;prefix a;"
@@ -1752,15 +1726,14 @@ test_type_leafref(void **state)
17521726
type = ((struct lysc_node_leaf *)mod->compiled->data)->type;
17531727
assert_non_null(type);
17541728
assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
1755-
assert_string_equal("/a:target1", ((struct lysc_type_leafref *)type)->path->expr);
1756-
assert_ptr_equal(mod, ly_resolve_prefix(UTEST_LYCTX, "a", 1, LY_VALUE_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes));
1729+
assert_string_equal("/a:target1", lyxp_get_expr(((struct lysc_type_leafref *)type)->path));
17571730
assert_non_null(((struct lysc_type_leafref *)type)->realtype);
17581731
assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref *)type)->realtype->basetype);
17591732
assert_int_equal(1, ((struct lysc_type_leafref *)type)->require_instance);
17601733
type = ((struct lysc_node_leaf *)mod->compiled->data->next)->type;
17611734
assert_non_null(type);
17621735
assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
1763-
assert_string_equal("/a/target2", ((struct lysc_type_leafref *)type)->path->expr);
1736+
assert_string_equal("/a/target2", lyxp_get_expr(((struct lysc_type_leafref *)type)->path));
17641737
assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_leafref *)type)->prefixes));
17651738
assert_non_null(((struct lysc_type_leafref *)type)->realtype);
17661739
assert_int_equal(LY_TYPE_UINT8, ((struct lysc_type_leafref *)type)->realtype->basetype);
@@ -1773,8 +1746,7 @@ test_type_leafref(void **state)
17731746
assert_non_null(type);
17741747
assert_int_equal(1, type->refcount);
17751748
assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
1776-
assert_string_equal("/b:target", ((struct lysc_type_leafref *)type)->path->expr);
1777-
assert_ptr_equal(mod, ly_resolve_prefix(UTEST_LYCTX, "b", 1, LY_VALUE_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes));
1749+
assert_string_equal("/b:target", lyxp_get_expr(((struct lysc_type_leafref *)type)->path));
17781750
assert_non_null(((struct lysc_type_leafref *)type)->realtype);
17791751
assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref *)type)->realtype->basetype);
17801752
assert_int_equal(1, ((struct lysc_type_leafref *)type)->require_instance);
@@ -1787,17 +1759,15 @@ test_type_leafref(void **state)
17871759
assert_non_null(type);
17881760
assert_int_equal(1, type->refcount);
17891761
assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
1790-
assert_string_equal("/b:target", ((struct lysc_type_leafref *)type)->path->expr);
1791-
assert_ptr_not_equal(mod, ly_resolve_prefix(UTEST_LYCTX, "b", 1, LY_VALUE_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes));
1762+
assert_string_equal("/b:target", lyxp_get_expr(((struct lysc_type_leafref *)type)->path));
17921763
assert_non_null(((struct lysc_type_leafref *)type)->realtype);
17931764
assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref *)type)->realtype->basetype);
17941765
assert_int_equal(0, ((struct lysc_type_leafref *)type)->require_instance);
17951766
type = ((struct lysc_node_leaf *)mod->compiled->data->next)->type;
17961767
assert_non_null(type);
17971768
assert_int_equal(1, type->refcount);
17981769
assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
1799-
assert_string_equal("/b:target", ((struct lysc_type_leafref *)type)->path->expr);
1800-
assert_ptr_not_equal(mod, ly_resolve_prefix(UTEST_LYCTX, "b", 1, LY_VALUE_SCHEMA_RESOLVED, ((struct lysc_type_leafref *)type)->prefixes));
1770+
assert_string_equal("/b:target", lyxp_get_expr(((struct lysc_type_leafref *)type)->path));
18011771
assert_int_equal(1, ((struct lysc_type_leafref *)type)->require_instance);
18021772

18031773
/* non-prefixed nodes in path are supposed to be from the module where the leafref type is instantiated */
@@ -1807,7 +1777,7 @@ test_type_leafref(void **state)
18071777
assert_non_null(type);
18081778
assert_int_equal(1, type->refcount);
18091779
assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
1810-
assert_string_equal("/target", ((struct lysc_type_leafref *)type)->path->expr);
1780+
assert_string_equal("/target", lyxp_get_expr(((struct lysc_type_leafref *)type)->path));
18111781
assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_leafref *)type)->prefixes));
18121782
assert_non_null(((struct lysc_type_leafref *)type)->realtype);
18131783
assert_int_equal(LY_TYPE_INT8, ((struct lysc_type_leafref *)type)->realtype->basetype);
@@ -1847,12 +1817,12 @@ test_type_leafref(void **state)
18471817
"container default-address{leaf ifname{type leafref{ path \"../../interface/name\";}}"
18481818
"leaf address {type leafref{ path \"../../interface[ name = current()/../ifname ]/address/ip\";}}}}",
18491819
LYS_IN_YANG, &mod));
1850-
type = ((struct lysc_node_leaf *)(*lysc_node_child_p(mod->compiled->data->prev))->prev)->type;
1820+
type = ((struct lysc_node_leaf *)(lysc_node_child(mod->compiled->data->prev)->prev))->type;
18511821
assert_non_null(type);
18521822
assert_int_equal(1, type->refcount);
18531823
assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
18541824
assert_string_equal("../../interface[ name = current()/../ifname ]/address/ip",
1855-
((struct lysc_type_leafref *)type)->path->expr);
1825+
lyxp_get_expr(((struct lysc_type_leafref *)type)->path));
18561826
assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_leafref *)type)->prefixes));
18571827
assert_non_null(((struct lysc_type_leafref *)type)->realtype);
18581828
assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref *)type)->realtype->basetype);
@@ -1865,7 +1835,7 @@ test_type_leafref(void **state)
18651835
assert_non_null(type);
18661836
assert_int_equal(1, type->refcount);
18671837
assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
1868-
assert_string_equal("/endpoint-parent[id=current()/../field]/endpoint/name", ((struct lysc_type_leafref *)type)->path->expr);
1838+
assert_string_equal("/endpoint-parent[id=current()/../field]/endpoint/name", lyxp_get_expr(((struct lysc_type_leafref *)type)->path));
18691839
assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_type_leafref *)type)->prefixes));
18701840
assert_non_null(((struct lysc_type_leafref *)type)->realtype);
18711841
assert_int_equal(LY_TYPE_STRING, ((struct lysc_type_leafref *)type)->realtype->basetype);
@@ -1909,7 +1879,7 @@ test_type_leafref(void **state)
19091879
assert_non_null(type);
19101880
assert_int_equal(1, type->refcount);
19111881
assert_int_equal(LY_TYPE_LEAFREF, type->basetype);
1912-
assert_string_equal("../target", ((struct lysc_type_leafref *)type)->path->expr);
1882+
assert_string_equal("../target", lyxp_get_expr(((struct lysc_type_leafref *)type)->path));
19131883
assert_non_null(((struct lysc_type_leafref *)type)->realtype);
19141884
assert_int_equal(LY_TYPE_BOOL, ((struct lysc_type_leafref *)type)->realtype->basetype);
19151885
assert_non_null(((struct lysc_node_leaf *)mod->compiled->data)->dflt.str);
@@ -3133,11 +3103,11 @@ test_deviation(void **state)
31333103
assert_non_null(node = mod->compiled->data);
31343104
assert_string_equal("c1", node->name);
31353105
assert_int_equal(2, LY_ARRAY_COUNT(((struct lysc_node_leaf *)node)->musts));
3136-
assert_string_equal("3", ((struct lysc_node_leaf *)node)->musts[1].cond->expr);
3106+
assert_string_equal("3", lyxp_get_expr(((struct lysc_node_leaf *)node)->musts[1].cond));
31373107
assert_non_null(node = node->next);
31383108
assert_string_equal("c2", node->name);
31393109
assert_int_equal(1, LY_ARRAY_COUNT(((struct lysc_node_container *)node)->musts));
3140-
assert_string_equal("1", ((struct lysc_node_container *)node)->musts[0].cond->expr);
3110+
assert_string_equal("1", lyxp_get_expr(((struct lysc_node_container *)node)->musts[0].cond));
31413111
assert_non_null(node = node->next);
31423112
assert_string_equal("c3", node->name);
31433113
assert_null(((struct lysc_node_leaf *)node)->musts);

0 commit comments

Comments
 (0)