summaryrefslogtreecommitdiffstats
path: root/c++/test/dsets.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2014-04-06 22:36:15 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2014-04-06 22:36:15 (GMT)
commita08f75b0737c86d51bbc91538e78b1455eb2cae7 (patch)
treea1e1c4f1cf8ddda6dd0a101af17dc8524ad23050 /c++/test/dsets.cpp
parent70daa61a876274a92c0d43ec0116d68e35d0c2ce (diff)
downloadhdf5-a08f75b0737c86d51bbc91538e78b1455eb2cae7.zip
hdf5-a08f75b0737c86d51bbc91538e78b1455eb2cae7.tar.gz
hdf5-a08f75b0737c86d51bbc91538e78b1455eb2cae7.tar.bz2
[svn-r24969] Description:
- Added wrappers to H5Object for H5Iget_name() to get object's name ssize_t getObjName(char *obj_name, size_t buf_size = 0) const; ssize_t getObjName(H5std_string& obj_name, size_t len = 0) const; H5std_string getObjName() const; - Added tests tobject.cpp - Added to various cleanup_* functions in tests to remove generated files - Added an overload H5I_type_t getHDFObjType() to get object's type Platforms tested: Linux/ppc64 (ostrich) Linux/32 2.6 (jam) SunOS 5.11 (emu) with gmake
Diffstat (limited to 'c++/test/dsets.cpp')
-rw-r--r--c++/test/dsets.cpp32
1 files changed, 14 insertions, 18 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 72d7977..6824403 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -49,6 +49,7 @@
const H5std_string FILE1("dataset.h5");
const H5std_string DSET_DEFAULT_NAME("default");
+const H5std_string DSET_DEFAULT_NAME_PATH("/default");
const H5std_string DSET_CHUNKED_NAME("chunked");
const H5std_string DSET_SIMPLE_IO_NAME("simple_io");
const H5std_string DSET_TCONV_NAME ("tconv");
@@ -96,6 +97,7 @@ test_create( H5File& file)
dataset = new DataSet (file.createDataSet
(DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
+
// Add a comment to the dataset
file.setComment (DSET_DEFAULT_NAME, "This is a dataset");
@@ -120,10 +122,15 @@ test_create( H5File& file)
// way to open an existing dataset for accessing.
dataset = new DataSet (file.openDataSet (DSET_DEFAULT_NAME));
+ // Get and verify the name of this dataset, using
+ // H5std_string getObjName()
+ H5std_string ds_name = dataset->getObjName();
+ verify_val(ds_name, DSET_DEFAULT_NAME_PATH, "DataSet::getObjName", __LINE__, __FILE__);
+
// 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__);
+ verify_val(comment, "This is a dataset", "DataSet::getComment", __LINE__, __FILE__);
// Close the dataset when accessing is completed
delete dataset;
@@ -1050,11 +1057,6 @@ void test_dset()
try
{
- // Turn of the auto-printing when failure occurs so that we can
- // handle the errors appropriately since sometime failures are
- // caused deliberately and expected.
- Exception::dontPrint();
-
// Use the file access template id to create a file access prop.
// list object to pass in H5File::H5File
FileAccPropList fapl(fapl_id);
@@ -1065,18 +1067,12 @@ void test_dset()
Group grp = file.createGroup( "emit diagnostics", 0);
grp.setComment("Causes diagnostic messages to be emitted");
- nerrors += test_create(file)<0 ?1:0;
- nerrors += test_simple_io(file)<0 ?1:0;
- nerrors += test_tconv(file)<0 ?1:0;
- nerrors += test_compression(file)<0 ?1:0;
- 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__);
+ nerrors += test_create(file) < 0 ? 1:0;
+ nerrors += test_simple_io(file) < 0 ? 1:0;
+ nerrors += test_tconv(file) < 0 ? 1:0;
+ nerrors += test_compression(file) < 0 ? 1:0;
+ nerrors += test_multiopen (file) < 0 ? 1:0;
+ nerrors += test_types(file) < 0 ? 1:0;
// Close group "emit diagnostics".
grp.close();