summaryrefslogtreecommitdiffstats
path: root/c++/test
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2017-05-15 14:13:25 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2017-05-15 14:13:25 (GMT)
commit0f8f929e918401e0781c201f7e2802f0e94fd09c (patch)
tree1680e5319cb21c05b13c8515c9dbc8d27dda591e /c++/test
parent51761a03c4598f1175bc2e23e7b152fdc1dd4f4e (diff)
parent8b1a53896565cafca3795d139a37148f89bf928d (diff)
downloadhdf5-0f8f929e918401e0781c201f7e2802f0e94fd09c.zip
hdf5-0f8f929e918401e0781c201f7e2802f0e94fd09c.tar.gz
hdf5-0f8f929e918401e0781c201f7e2802f0e94fd09c.tar.bz2
Merge pull request #502 in HDFFV/hdf5 from ~BMRIBLER/hdf5_1_8_bmr:hdf5_1_8 to hdf5_1_8
* commit '8b1a53896565cafca3795d139a37148f89bf928d': Add H5Lexists wrappers Description: Added wrappers H5Location::exists() for H5Lexists. Added new class LinkAccPropList to be used by H5Location::exists() Rearranged source files in Makefile.am Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test) Improvement of class hierarchy Description: - Moved class Attribute to be derived from class H5Location instead of IdComponent because an attribute id can be used as loc_id in C APIs. - Copied wrappers of H5A APIs in H5Location into H5Object because H5A functions do not take an attribute id as loc_id. The original wrappers will be deprecated in future releases. - Revised comments Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test)
Diffstat (limited to 'c++/test')
-rw-r--r--c++/test/tattr.cpp11
-rw-r--r--c++/test/tfile.cpp12
-rw-r--r--c++/test/tlinks.cpp8
3 files changed, 26 insertions, 5 deletions
diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp
index bb33b2b..70c4003 100644
--- a/c++/test/tattr.cpp
+++ b/c++/test/tattr.cpp
@@ -1561,11 +1561,20 @@ static void test_attr_exists()
// Open a group.
Group group = fid1.openGroup(GROUP1_NAME);
- // Check for existence of attribute
+ // Check for existence of attribute, Group::attrExists
attr_exists = group.attrExists(ATTR2_NAME);
if (attr_exists == false)
throw InvalidActionException("H5File::attrExists", "group, ATTR2_NAMEAttribute should exist but does not");
+ // Open attribute
+ Attribute attr = group.openAttribute(ATTR2_NAME);
+
+ // Test the existence of a name using attribute as location,
+ // Attribute::nameExists
+ bool name_exists = attr.nameExists(GROUP1_NAME);
+ if (name_exists == false)
+ throw InvalidActionException("Attribute::nameExists", "group GROUP1_NAME should exist but does not");
+
PASSED();
} // end try block
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp
index bd229d7..6e12dfd 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -601,6 +601,18 @@ static void test_file_attribute()
n_attrs = dataset.getNumAttrs();
verify_val(n_attrs, 1, "DataSet::getNumAttrs()", __LINE__, __FILE__);
+ // Get and verify the number of attributes at the location specified
+ // by a dataset's attribute
+ n_attrs = 0;
+ n_attrs = dattr.getNumAttrs();
+ verify_val(n_attrs, 1, "Attribute::getNumAttrs()", __LINE__, __FILE__);
+
+ // Get and verify the number of attributes at the location specified
+ // by a file's attribute
+ n_attrs = 0;
+ n_attrs = fattr1.getNumAttrs();
+ verify_val(n_attrs, 2, "Attribute::getNumAttrs()", __LINE__, __FILE__);
+
// Read back attribute's data
HDmemset(rdata, 0, sizeof(rdata));
dattr.read(PredType::NATIVE_INT, rdata);
diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp
index bb1ea17..0786bb5 100644
--- a/c++/test/tlinks.cpp
+++ b/c++/test/tlinks.cpp
@@ -422,10 +422,10 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format)
H5File file(filename, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl);
// Verify link existence
- if(H5Lexists(file.getId(), "dset1", H5P_DEFAULT) != TRUE)
- throw InvalidActionException("H5Lexists", "dset1 doesn't exist");
- if(H5Lexists(file.getId(), "grp1/soft", H5P_DEFAULT) != TRUE)
- throw InvalidActionException("H5Lexists", "grp1/soft doesn't exist");
+ if(file.nameExists("dset1", LinkAccPropList::DEFAULT) != TRUE)
+ throw InvalidActionException("H5File::nameExists", "dset1 doesn't exist");
+ if(file.nameExists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE)
+ throw InvalidActionException("H5File::nameExists", "grp1/soft doesn't exist");
// Verify link values
H5std_string softlink_val = file.getLinkval("grp1/soft");