Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lyds_tree TEST added test for 9aa830136 #2314

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions tests/utests/data/test_tree_data_sorted.c
Original file line number Diff line number Diff line change
Expand Up @@ -1605,21 +1605,22 @@ test_order_violation(void **state)
UTEST_ADD_MODULE(schema, LYS_IN_YANG, NULL, &mod);

/* inserting a new node causes the nodes to be sorted */
data = "{\"a:ll\":[1,8,2]}";
data = "{\"a:ll\":[8,2,1]}";
CHECK_PARSE_LYD_PARAM(data, LYD_JSON, LYD_PARSE_ORDERED, LYD_VALIDATE_PRESENT, LY_SUCCESS, tree);
assert_true(tree && !tree->meta && tree->next && tree->next->next);
assert_string_equal(lyd_get_value(tree), "1");
assert_string_equal(lyd_get_value(tree->next), "8");
assert_string_equal(lyd_get_value(tree->next->next), "2");
#ifndef NDEBUG
CHECK_LOG_CTX("Data in \"ll\" are not sorted, inserted node should not be added to the end.", NULL, 0);
CHECK_LOG_CTX("Data in \"ll\" are not sorted, inserted node should not be added to the end.", NULL, 0);
#endif
assert_int_equal(lyd_new_term(NULL, mod, "ll", "3", 0, &node), LY_SUCCESS);
lyd_insert_sibling(tree, node, NULL);
assert_string_equal(lyd_get_value(tree), "1");
assert_true(tree && !tree->meta && tree->next && tree->next->next);
assert_string_equal(lyd_get_value(tree), "8");
assert_string_equal(lyd_get_value(tree->next), "2");
assert_string_equal(lyd_get_value(tree->next->next), "3");
assert_string_equal(lyd_get_value(tree->next->next->next), "8");
assert_string_equal(lyd_get_value(tree->next->next), "1");
assert_int_equal(lyd_new_term(NULL, mod, "ll", "3", 0, &node), LY_SUCCESS);
lyd_insert_sibling(tree, node, &first);
assert_string_equal(lyd_get_value(first), "1");
assert_string_equal(lyd_get_value(first->next), "2");
assert_string_equal(lyd_get_value(first->next->next), "3");
assert_string_equal(lyd_get_value(first->next->next->next), "8");
lyd_free_all(tree);

/* move unsorted nodes causes the nodes to be sorted */
Expand Down
Loading