File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 1010
1111#include " TestH5.hpp"
1212
13+ #include < nix/Hydra.hpp>
14+
1315#include " hdf5/FileHDF5.hpp"
1416#include " hdf5/h5x/H5Exception.hpp"
1517#include " hdf5/h5x/H5PList.hpp"
@@ -379,4 +381,17 @@ void TestH5::testUTF8() {
379381 h5group.createLink (g, " zelda" );
380382 h5group.linkInfo (" zelda" , li);
381383 CPPUNIT_ASSERT_EQUAL (H5T_CSET_UTF8, li.cset );
384+
385+ // ASCII in the file, utf8 in memory
386+ nix::hdf5::h5x::DataType ascii_type = nix::hdf5::h5x::DataType::makeStrType (H5T_VARIABLE, H5T_CSET_ASCII);
387+ std::string test_str = " Hallo" ;
388+
389+ const nix::Hydra<std::string> hydra (test_str);
390+
391+ nix::hdf5::DataSpace fileSpace = nix::hdf5::DataSpace::create (hydra.shape (), false );
392+ nix::hdf5::Attribute attr_ascii = g.createAttr (" ascii" , ascii_type, fileSpace);
393+ attr_ascii.write (nix::hdf5::data_type_to_h5_memtype (nix::DataType::String), hydra.shape (), hydra.data ());
394+
395+ std::string str_out;
396+ g.getAttr (" ascii" , str_out);
382397}
You can’t perform that action at this time.
0 commit comments