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

Add group member with type #5336

Merged
merged 9 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
140 changes: 103 additions & 37 deletions test/src/unit-capi-group.cc
Original file line number Diff line number Diff line change
Expand Up @@ -592,18 +592,34 @@ TEST_CASE_METHOD(
rc = tiledb_group_open(ctx_, group2, TILEDB_WRITE);
REQUIRE(rc == TILEDB_OK);

rc =
tiledb_group_add_member(ctx_, group1, array1_uri.c_str(), false, nullptr);
REQUIRE(rc == TILEDB_OK);
rc =
tiledb_group_add_member(ctx_, group1, array2_uri.c_str(), false, nullptr);
REQUIRE(rc == TILEDB_OK);
rc =
tiledb_group_add_member(ctx_, group2, array3_uri.c_str(), false, nullptr);
REQUIRE(rc == TILEDB_OK);
rc =
tiledb_group_add_member(ctx_, group1, group2_uri.c_str(), false, nullptr);
REQUIRE(rc == TILEDB_OK);
bool add_with_type = GENERATE(true, false);
if (add_with_type) {
rc = tiledb_group_add_member_with_type(
ctx_, group1, array1_uri.c_str(), false, nullptr, TILEDB_ARRAY);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member_with_type(
ctx_, group1, array2_uri.c_str(), false, nullptr, TILEDB_ARRAY);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member_with_type(
ctx_, group2, array3_uri.c_str(), false, nullptr, TILEDB_ARRAY);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member_with_type(
ctx_, group1, group2_uri.c_str(), false, nullptr, TILEDB_GROUP);
REQUIRE(rc == TILEDB_OK);
} else {
rc = tiledb_group_add_member(
ctx_, group1, array1_uri.c_str(), false, nullptr);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member(
ctx_, group1, array2_uri.c_str(), false, nullptr);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member(
ctx_, group2, array3_uri.c_str(), false, nullptr);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member(
ctx_, group1, group2_uri.c_str(), false, nullptr);
REQUIRE(rc == TILEDB_OK);
}

// Close group from write mode
rc = tiledb_group_close(ctx_, group1);
Expand Down Expand Up @@ -720,8 +736,16 @@ TEST_CASE_METHOD(
rc = tiledb_group_open(ctx_, group1, TILEDB_WRITE);
REQUIRE(rc == TILEDB_OK);

rc = tiledb_group_add_member(ctx_, group1, array1_uri.c_str(), false, "one");
REQUIRE(rc == TILEDB_OK);
bool add_with_type = GENERATE(true, false);
if (add_with_type) {
rc = tiledb_group_add_member_with_type(
ctx_, group1, array1_uri.c_str(), false, "one", TILEDB_ARRAY);
REQUIRE(rc == TILEDB_OK);
} else {
rc =
tiledb_group_add_member(ctx_, group1, array1_uri.c_str(), false, "one");
REQUIRE(rc == TILEDB_OK);
}

// Close group from write mode
rc = tiledb_group_close(ctx_, group1);
Expand Down Expand Up @@ -755,8 +779,15 @@ TEST_CASE_METHOD(
rc = tiledb_group_remove_member(ctx_, group1, "one");
REQUIRE(rc == TILEDB_OK);
// Add one back with different URI
rc = tiledb_group_add_member(ctx_, group1, array2_uri.c_str(), false, "one");
REQUIRE(rc == TILEDB_OK);
if (add_with_type) {
rc = tiledb_group_add_member_with_type(
ctx_, group1, array2_uri.c_str(), false, "one", TILEDB_ARRAY);
REQUIRE(rc == TILEDB_OK);
} else {
rc =
tiledb_group_add_member(ctx_, group1, array2_uri.c_str(), false, "one");
REQUIRE(rc == TILEDB_OK);
}

// Close group
rc = tiledb_group_close(ctx_, group1);
Expand Down Expand Up @@ -827,15 +858,34 @@ TEST_CASE_METHOD(
rc = tiledb_group_open(ctx_, group2, TILEDB_WRITE);
REQUIRE(rc == TILEDB_OK);

rc = tiledb_group_add_member(ctx_, group1, array1_uri.c_str(), false, "one");
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member(ctx_, group1, array2_uri.c_str(), false, "two");
REQUIRE(rc == TILEDB_OK);
rc =
tiledb_group_add_member(ctx_, group2, array3_uri.c_str(), false, "three");
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member(ctx_, group1, group2_uri.c_str(), false, "four");
REQUIRE(rc == TILEDB_OK);
bool add_with_type = GENERATE(true, false);
if (add_with_type) {
rc = tiledb_group_add_member_with_type(
ctx_, group1, array1_uri.c_str(), false, "one", TILEDB_ARRAY);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member_with_type(
ctx_, group1, array2_uri.c_str(), false, "two", TILEDB_ARRAY);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member_with_type(
ctx_, group2, array3_uri.c_str(), false, "three", TILEDB_ARRAY);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member_with_type(
ctx_, group1, group2_uri.c_str(), false, "four", TILEDB_GROUP);
REQUIRE(rc == TILEDB_OK);
} else {
rc =
tiledb_group_add_member(ctx_, group1, array1_uri.c_str(), false, "one");
REQUIRE(rc == TILEDB_OK);
rc =
tiledb_group_add_member(ctx_, group1, array2_uri.c_str(), false, "two");
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member(
ctx_, group2, array3_uri.c_str(), false, "three");
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member(
ctx_, group1, group2_uri.c_str(), false, "four");
REQUIRE(rc == TILEDB_OK);
}

// Close group from write mode
rc = tiledb_group_close(ctx_, group1);
Expand Down Expand Up @@ -1186,18 +1236,34 @@ TEST_CASE_METHOD(
rc = tiledb_group_open(ctx_, group2, TILEDB_WRITE);
REQUIRE(rc == TILEDB_OK);

rc = tiledb_group_add_member(
ctx_, group1, array1_relative_uri.c_str(), true, nullptr);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member(
ctx_, group1, array2_relative_uri.c_str(), true, nullptr);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member(
ctx_, group2, array3_relative_uri.c_str(), true, nullptr);
REQUIRE(rc == TILEDB_OK);
rc =
tiledb_group_add_member(ctx_, group1, group2_uri.c_str(), false, nullptr);
REQUIRE(rc == TILEDB_OK);
bool add_with_type = GENERATE(true, false);
if (add_with_type) {
rc = tiledb_group_add_member_with_type(
ctx_, group1, array1_relative_uri.c_str(), true, nullptr, TILEDB_ARRAY);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member_with_type(
ctx_, group1, array2_relative_uri.c_str(), true, nullptr, TILEDB_ARRAY);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member_with_type(
ctx_, group2, array3_relative_uri.c_str(), true, nullptr, TILEDB_ARRAY);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member_with_type(
ctx_, group1, group2_uri.c_str(), false, nullptr, TILEDB_GROUP);
REQUIRE(rc == TILEDB_OK);
} else {
rc = tiledb_group_add_member(
ctx_, group1, array1_relative_uri.c_str(), true, nullptr);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member(
ctx_, group1, array2_relative_uri.c_str(), true, nullptr);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member(
ctx_, group2, array3_relative_uri.c_str(), true, nullptr);
REQUIRE(rc == TILEDB_OK);
rc = tiledb_group_add_member(
ctx_, group1, group2_uri.c_str(), false, nullptr);
REQUIRE(rc == TILEDB_OK);
}

// Close group from write mode
rc = tiledb_group_close(ctx_, group1);
Expand Down
Loading
Loading