summaryrefslogtreecommitdiffstats
path: root/c++/test
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2014-03-23 21:30:43 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2014-03-23 21:30:43 (GMT)
commit74079aa0de09be6c57244bb4d33fcda51f7a2f4c (patch)
treeccce4a37a0a538d1a8871a3d2828e7f1f30746e4 /c++/test
parente18ee63c5a5c294d1949d83b1d34ae1fe15086ae (diff)
downloadhdf5-74079aa0de09be6c57244bb4d33fcda51f7a2f4c.zip
hdf5-74079aa0de09be6c57244bb4d33fcda51f7a2f4c.tar.gz
hdf5-74079aa0de09be6c57244bb4d33fcda51f7a2f4c.tar.bz2
[svn-r24870] Description:
- Added another overload for char* argument: ssize_t getComment(const char* name, const size_t buf_size, char* comment) - Changed default value to 0 for the other two getComment methods - Added HDmemset to after every char string allocation to clear the buffer - Added a null terminator to the comment returned from the C call, in getComment methods - Some minor cleanup Merged from trunk: -r24865 -r24867 Platforms tested: Linux/ppc64 (ostrich) Linux/32 2.6 (jam) SunOS 5.11 (emu)
Diffstat (limited to 'c++/test')
-rw-r--r--c++/test/dsets.cpp11
-rw-r--r--c++/test/trefer.cpp6
2 files changed, 15 insertions, 2 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 811d8c7..72d7977 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -120,6 +120,11 @@ test_create( H5File& file)
// way to open an existing dataset for accessing.
dataset = new DataSet (file.openDataSet (DSET_DEFAULT_NAME));
+ // Get and verify the comment from this dataset, using
+ // H5std_string getComment(const H5std_string& name, <buf_size=0, by default>)
+ H5std_string comment = file.getComment(DSET_DEFAULT_NAME);
+ verify_val(comment, "This is a dataset", "H5Location::getComment", __LINE__, __FILE__);
+
// Close the dataset when accessing is completed
delete dataset;
@@ -1067,6 +1072,12 @@ void test_dset()
nerrors += test_multiopen (file)<0 ?1:0;
nerrors += test_types(file)<0 ?1:0;
+ // Get part of the comment, random length using
+ // ssize_t getComment(const char* name, const size_t buf_size, char* comment)
+ char* comment = new char[11];
+ ssize_t comment_len = file.getComment("emit diagnostics", 11, comment);
+ verify_val((const char*)comment, "Causes dia", "H5Location::getComment", __LINE__, __FILE__);
+
// Close group "emit diagnostics".
grp.close();
diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp
index ae1ab02..d2581a3 100644
--- a/c++/test/trefer.cpp
+++ b/c++/test/trefer.cpp
@@ -317,11 +317,13 @@ static void test_reference_obj(void)
// Dereference group object from the location where 'dataset' is located
group.dereference(dataset, &rbuf[2]);
- // Get group's comment
+ // Get group's comment using
+ // H5std_string getComment(const char* name, <buf_size=0 by default>)
H5std_string read_comment1 = group.getComment(".", 10);
verify_val(read_comment1.c_str(), write_comment, "Group::getComment",__LINE__,__FILE__);
- // Test that getComment handles failures gracefully
+ // Test that getComment handles failures gracefully, using
+ // H5std_string getComment(const char* name, <buf_size=0 by default>)
try {
H5std_string read_comment_tmp = group.getComment(NULL);
}