Skip to content

Commit 4a1a769

Browse files
Fix error by refactoring test to use H5Group wrapper
1 parent e6720b7 commit 4a1a769

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

tests/test_write_h5_array.cxx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,21 @@ TEST_F(HDF5Test, TraverseOrCreateGroups) {
3434

3535
try {
3636
std::string group_path = "/dials/processing/group_0";
37-
hid_t final_group = traverse_or_create_groups(file, group_path);
38-
ASSERT_GE(final_group, 0) << "Failed to create or open the final group.";
37+
h5utils::H5Group final_group = traverse_or_create_groups(file, group_path);
38+
ASSERT_GE(final_group.id, 0) << "Failed to create or open the final group.";
3939

4040
// Verify group hierarchy exists
41-
hid_t dials_group = H5Gopen(file, "dials", H5P_DEFAULT);
42-
ASSERT_GE(dials_group, 0) << "Failed to open the 'dials' group.";
41+
h5utils::H5Group dials_group(H5Gopen(file, "dials", H5P_DEFAULT));
42+
ASSERT_GE(dials_group.id, 0) << "Failed to open the 'dials' group.";
4343

44-
hid_t processing_group = H5Gopen(dials_group, "processing", H5P_DEFAULT);
45-
ASSERT_GE(processing_group, 0) << "Failed to open the 'processing' group.";
44+
h5utils::H5Group processing_group(
45+
H5Gopen(dials_group, "processing", H5P_DEFAULT));
46+
ASSERT_GE(processing_group.id, 0)
47+
<< "Failed to open the 'processing' group.";
4648

47-
hid_t group_0 = H5Gopen(processing_group, "group_0", H5P_DEFAULT);
48-
ASSERT_GE(group_0, 0) << "Failed to open the 'group_0' group.";
49+
h5utils::H5Group group_0(H5Gopen(processing_group, "group_0", H5P_DEFAULT));
50+
ASSERT_GE(group_0.id, 0) << "Failed to open the 'group_0' group.";
4951

50-
// Close all groups
51-
H5Gclose(group_0);
52-
H5Gclose(processing_group);
53-
H5Gclose(dials_group);
54-
H5Gclose(final_group);
5552
} catch (const std::runtime_error &e) {
5653
FAIL() << "Runtime error occurred: " << e.what();
5754
}

0 commit comments

Comments
 (0)