diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2017-12-04 18:21:12 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2017-12-04 18:21:12 (GMT) |
commit | e33d677636b860f8f6b95c0ee3736395541a2610 (patch) | |
tree | d70dd01c6e75aa27ef6d286c553de06625aa0b8d /c++/test/tobject.cpp | |
parent | f116545ce465181928ca97214b9cfa87092a3ee9 (diff) | |
download | hdf5-e33d677636b860f8f6b95c0ee3736395541a2610.zip hdf5-e33d677636b860f8f6b95c0ee3736395541a2610.tar.gz hdf5-e33d677636b860f8f6b95c0ee3736395541a2610.tar.bz2 |
Various code cleanup
Description:
- Replaced H5Location::exists with H5Location::nameExists and marked
H5Location::exists as deprecated.
- Miscellaneous test cleanup for consistency.
Platforms tested:
Linux/32 2.6 (jam)
Linux/64 (jelly)
Darwin (osx1010test)
Diffstat (limited to 'c++/test/tobject.cpp')
-rw-r--r-- | c++/test/tobject.cpp | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index d9f4075..9980ce0 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -45,6 +45,7 @@ const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset_in_Group_1"); const H5std_string DSET_IN_GRP1_2("Dataset_in_Group_1.2"); const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_in_Group_1.2"); + /*------------------------------------------------------------------------- * Function: test_get_objname * @@ -65,9 +66,6 @@ const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_ * * Programmer Binh-Minh Ribler * Friday, March 4, 2014 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_get_objname() @@ -153,6 +151,7 @@ static void test_get_objname() } } // test_get_objname + /*------------------------------------------------------------------------- * Function: test_existance * @@ -173,9 +172,6 @@ static void test_get_objname() * * Programmer Binh-Minh Ribler * Friday, March 4, 2014 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_existance() @@ -187,18 +183,30 @@ static void test_existance() H5File file(FILE_OBJECTS, H5F_ACC_RDONLY); // Check if GROUP1 exists in the file - bool exists = file.exists(GROUP1); + bool exists = file.nameExists(GROUP1); + verify_val(exists, TRUE, "Group::nameExists GROUP1_1", __LINE__, __FILE__); + // Deprecated + exists = file.exists(GROUP1); + verify_val(exists, TRUE, "Group::exists GROUP1_1", __LINE__, __FILE__); // Open GROUP1 Group grp1 = file.openGroup(GROUP1); // Check if GROUP1_1 and GROUP1_2 exist in GROUP1 + exists = grp1.nameExists(GROUP1_1); + verify_val(exists, TRUE, "Group::nameExists GROUP1_1", __LINE__, __FILE__); + exists = grp1.nameExists(GROUP1_2); + verify_val(exists, TRUE, "Group::nameExists GROUP1_2", __LINE__, __FILE__); + // Deprecated exists = grp1.exists(GROUP1_1); verify_val(exists, TRUE, "Group::exists GROUP1_1", __LINE__, __FILE__); exists = grp1.exists(GROUP1_2); verify_val(exists, TRUE, "Group::exists GROUP1_2", __LINE__, __FILE__); // Check if DSET_IN_GRP1 exists in GROUP1 + exists = grp1.nameExists(DSET_IN_GRP1); + verify_val(exists, TRUE, "Group::nameExists DSET_IN_GRP1", __LINE__, __FILE__); + // Deprecated exists = grp1.exists(DSET_IN_GRP1); verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__); @@ -206,14 +214,22 @@ static void test_existance() Group grp1_2 = grp1.openGroup(GROUP1_2); // Check if DSET_IN_GRP1_2 exists in GROUP1_2 + exists = grp1_2.nameExists(DSET_IN_GRP1_2); + verify_val(exists, TRUE, "Group::nameExists DSET_IN_GRP1_2", __LINE__, __FILE__); + // Deprecated exists = grp1_2.exists(DSET_IN_GRP1_2); verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1_2", __LINE__, __FILE__); // Check if a dataset exists given dataset as location with full path name DataSet dset1 = file.openDataSet(DSET_IN_FILE); + exists = dset1.nameExists("/Top Group/Dataset_in_Group_1"); + verify_val(exists, TRUE, "Group::nameExists given dataset with full path name", __LINE__, __FILE__); + + exists = grp1_2.nameExists(DSET_IN_GRP1); + verify_val(exists, FALSE, "Group::nameExists DSET_IN_GRP1", __LINE__, __FILE__); + // Deprecated exists = dset1.exists("/Top Group/Dataset_in_Group_1"); verify_val(exists, TRUE, "Group::exists given dataset with full path name", __LINE__, __FILE__); - exists = grp1_2.exists(DSET_IN_GRP1); verify_val(exists, FALSE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__); @@ -229,6 +245,7 @@ static void test_existance() } } // test_existance + /*------------------------------------------------------------------------- * Function: test_get_objname_ontypes * @@ -239,9 +256,6 @@ static void test_existance() * * Programmer Binh-Minh Ribler * March 4, 2014 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_get_objname_ontypes() @@ -330,6 +344,7 @@ static void test_get_objname_ontypes() } } // test_get_objname_ontypes + /*------------------------------------------------------------------------- * Function: test_get_objtype * @@ -340,9 +355,6 @@ static void test_get_objname_ontypes() * * Programmer Binh-Minh Ribler * Friday, March 4, 2014 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void test_get_objtype() @@ -394,6 +406,7 @@ static void test_get_objtype() issue_fail_msg("test_get_objtype", __LINE__, __FILE__); } } // test_get_objtype + /*------------------------------------------------------------------------- * Function: test_open_object_header @@ -404,9 +417,6 @@ static void test_get_objtype() * * Programmer Binh-Minh Ribler (use C version) * March, 2017 - * - * Modifications: - * *------------------------------------------------------------------------- */ const H5std_string GROUPNAME("group"); @@ -416,6 +426,7 @@ const H5std_string DSETNAME("dataset"); #define RANK 2 #define DIM0 5 #define DIM1 10 + static void test_open_object_header() { hsize_t dims[2]; @@ -513,6 +524,7 @@ static void test_open_object_header() issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg()); } } /* test_open_object_header() */ + /*------------------------------------------------------------------------- * Function: test_objects @@ -524,9 +536,6 @@ static void test_open_object_header() * * Programmer Binh-Minh Ribler * Friday, Mar 4, 2014 - * - * Modifications: - * *------------------------------------------------------------------------- */ extern "C" @@ -543,17 +552,13 @@ void test_object() } // test_objects + /*------------------------------------------------------------------------- * Function: cleanup_objects * * Purpose Cleanup temporary test files * - * Return none - * - * Programmer (use C version) - * - * Modifications: - * + * Return None *------------------------------------------------------------------------- */ extern "C" |