Skip to content

Commit

Permalink
Add unit-tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed Jul 3, 2023
1 parent 9bd9c7e commit 5897d1f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/unit/tests_high_five_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,34 @@ TEMPLATE_LIST_TEST_CASE("ReadWriteAttributeVector", "[template]", dataset_test_t
readWriteAttributeVectorTest<TestType>();
}

TEST_CASE("WriteLargeAttribute") {
std::vector<double> large_attr(16000, 0.0);

auto fapl = HighFive::FileAccessProps::Default();
fapl.add(HighFive::FileVersionBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST));
HighFive::File file("create_large_attribute.h5", HighFive::File::Truncate, fapl);
auto gcpl = HighFive::GroupCreateProps::Default();
gcpl.add(HighFive::AttributePhaseChange(0, 0));

auto group = file.createGroup("grp", gcpl);
CHECK_NOTHROW(group.createAttribute("attr", large_attr));
}

TEST_CASE("AttributePhaseChange") {
auto fapl = HighFive::FileAccessProps::Default();
fapl.add(HighFive::FileVersionBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST));
HighFive::File file("attribute_phase_change.h5", HighFive::File::Truncate, fapl);

auto gcpl = HighFive::GroupCreateProps::Default();
gcpl.add(HighFive::AttributePhaseChange(42, 24));

auto group = file.createGroup("grp", gcpl);

auto actual = AttributePhaseChange(group.getCreatePropertyList());
CHECK(actual.min_dense() == 24);
CHECK(actual.max_compact() == 42);
}

TEST_CASE("datasetOffset") {
std::string filename = "datasetOffset.h5";
std::string dsetname = "dset";
Expand Down

0 comments on commit 5897d1f

Please sign in to comment.