Commit 97b2198 1 parent c277f0e commit 97b2198 Copy full SHA for 97b2198
File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 10
10
11
11
#include " TestH5.hpp"
12
12
13
+ #include < nix/Hydra.hpp>
14
+
13
15
#include " hdf5/FileHDF5.hpp"
14
16
#include " hdf5/h5x/H5Exception.hpp"
15
17
#include " hdf5/h5x/H5PList.hpp"
@@ -379,4 +381,17 @@ void TestH5::testUTF8() {
379
381
h5group.createLink (g, " zelda" );
380
382
h5group.linkInfo (" zelda" , li);
381
383
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);
382
397
}
You can’t perform that action at this time.
0 commit comments