Skip to content

Commit

Permalink
Extended the utest for tree_data
Browse files Browse the repository at this point in the history
  • Loading branch information
steweg committed Jan 16, 2024
1 parent 92467fa commit a3528f2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/utests/data/test_tree_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,20 @@ test_data_leafref_nodes(void **state)
assert_int_equal(0, LY_ARRAY_COUNT(target_node->leafref_nodes));
/* duplicate unlink */
assert_int_equal(LY_SUCCESS, lyd_unlink_leafref_node(target_node, leafref_node));
/* add + value modification of target */
assert_int_equal(LY_SUCCESS, lyd_link_leafref_node(target_node, leafref_node));
assert_int_equal(1, LY_ARRAY_COUNT(target_node->leafref_nodes));
assert_int_equal(LY_SUCCESS, lyd_change_term((struct lyd_node *)target_node, "ASD"));
assert_int_equal(0, LY_ARRAY_COUNT(target_node->leafref_nodes));
/* change back to original value + value modification of leafref */
assert_int_equal(LY_SUCCESS, lyd_change_term((struct lyd_node *)target_node, "asd"));
assert_int_equal(0, LY_ARRAY_COUNT(target_node->leafref_nodes));
assert_int_equal(LY_SUCCESS, lyd_link_leafref_node(target_node, leafref_node));
assert_int_equal(1, LY_ARRAY_COUNT(target_node->leafref_nodes));
assert_int_equal(LY_SUCCESS, lyd_change_term((struct lyd_node *)leafref_node, "qwe"));
assert_int_equal(0, LY_ARRAY_COUNT(target_node->leafref_nodes));
assert_int_equal(LY_SUCCESS, lyd_change_term((struct lyd_node *)leafref_node, "asd"));
assert_int_equal(0, LY_ARRAY_COUNT(target_node->leafref_nodes));
/* linking the whole tree */
assert_int_equal(LY_SUCCESS, lyd_link_leafref_node_tree(tree));
assert_int_equal(1, LY_ARRAY_COUNT(target_node->leafref_nodes));
Expand Down

0 comments on commit a3528f2

Please sign in to comment.