Skip to content

Commit

Permalink
doc and test for datatype reading
Browse files Browse the repository at this point in the history
  • Loading branch information
sbouteille committed Jul 10, 2023
1 parent 9014a91 commit 9a40308
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions include/highfive/bits/H5Node_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ class NodeTraits {
/// \return the group object
Group getGroup(const std::string& group_name) const;

///
/// \brief open a commited datatype with the name type_name
/// \param type_name
/// \return the datatype object
DataType getDataType(
const std::string& type_name,
const DataTypeAccessProps& accessProps = DataTypeAccessProps::Default()) const;
Expand Down
8 changes: 7 additions & 1 deletion tests/unit/tests_high_five_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2870,16 +2870,22 @@ TEST_CASE("HighFiveEnum") {
TEST_CASE("HighFiveReadType") {
const std::string file_name("readtype_test.h5");
const std::string datatype_name1("my_type");
const std::string datatype_name2("position");

File file(file_name, File::ReadWrite | File::Create | File::Truncate);

auto t3 = AtomicType<int>();
CompoundType t1 = create_compound_csl1();
t1.commit(file, datatype_name1);

CompoundType t2 = file.getDataType(datatype_name1);

auto t3 = create_enum_position();
t3.commit(file, datatype_name2);

DataType t4 = file.getDataType(datatype_name2);

CHECK(t2 == t1);
CHECK(t4 == t3);
}

TEST_CASE("HighFiveFixedString") {
Expand Down

0 comments on commit 9a40308

Please sign in to comment.