Skip to content

Commit

Permalink
Allow default ctors.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed Feb 20, 2024
1 parent 6b8bd89 commit 3491dc0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/highfive/H5DataSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class DataSet: public Object,
return details::get_plist<DataSetAccessProps>(*this, H5Dget_access_plist);
}

DataSet() = delete;
DataSet() = default;

protected:
using Object::Object; // bring DataSet(hid_t)
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/tests_high_five_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,19 @@ TEST_CASE("Test allocation time") {
CHECK(alloc_size == data.size() * sizeof(decltype(data)::value_type));
}

TEST_CASE("Test default constructors") {
const std::string file_name("h5_default_ctors.h5");
const std::string dataset_name("dset");
File file(file_name, File::Truncate);
auto ds = file.createDataSet(dataset_name, std::vector<int>{1, 2, 3, 4, 5});

DataSet d2;
CHECK_THROWS(d2.getFile());
CHECK(!d2.isValid());
d2 = ds; // copy
CHECK(d2.isValid());
}

TEST_CASE("Test groups and datasets") {
const std::string file_name("h5_group_test.h5");
const std::string dataset_name("dset");
Expand Down

0 comments on commit 3491dc0

Please sign in to comment.