diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2016-08-20 04:34:26 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2016-08-20 04:34:26 (GMT) |
commit | c78f1ec8829e25672d738d6772a096f3eafd9295 (patch) | |
tree | a1ac9ab7dfee45b7a06b1948bf111444661d138b /c++/test | |
parent | c8af99f530503a99006cb6e606cf076ba79800da (diff) | |
download | hdf5-c78f1ec8829e25672d738d6772a096f3eafd9295.zip hdf5-c78f1ec8829e25672d738d6772a096f3eafd9295.tar.gz hdf5-c78f1ec8829e25672d738d6772a096f3eafd9295.tar.bz2 |
[svn-r30309] Purpose: Fix bug HDFFR-9920
Description:
Rearranged the classes to model the relationship of HDF5 objects more
accurately. The changes included:
- moved CommonFG's methods to Group
- removed CommonFG from Group's base class list
- removed CommonFG from H5File's base class list and changed
"public H5Location" to "public Group" in the base class list
- CommonFG became unused
- result of the modified partial class diagram:
IdComponent
|
H5Location
/
H5Object
|
/ / \
DadaType Group DataSet
|
H5File
Platforms tested:
Linux/32 2.6 (jam)
Linux/64 (platypus)
Darwin (osx1010test)
Diffstat (limited to 'c++/test')
-rw-r--r-- | c++/test/tfile.cpp | 69 |
1 files changed, 66 insertions, 3 deletions
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 763f9f0..0eabfb9 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -515,8 +515,6 @@ static void test_file_name() } // test_file_name() -#define NUM_OBJS 4 -#define NUM_ATTRS 3 const int RANK1 = 1; const int ATTR1_DIM1 = 3; const H5std_string FILE5("tfattrs.h5"); @@ -742,6 +740,70 @@ static void test_libver_bounds() } /* end test_libver_bounds() */ /*------------------------------------------------------------------------- + * Function: test_commonfg + * + * Purpose: Verify that a file created and modified with the + * specified libver bounds has the specified object header + * versions for the right objects. + * + * Return: None + * + * Programmer: Binh-Minh Ribler (use C version) + * March, 2015 + * + *------------------------------------------------------------------------- + */ +static void test_commonfg() +{ + // Output message about test being performed + SUBTEST("Root group"); + + try { + // Create a file using default properties. + H5File file4(FILE4, H5F_ACC_TRUNC); + + // Try opening the root group. + Group rootgroup(file4.openGroup(ROOTGROUP)); + + // Create a group in the root group. + Group group(rootgroup.createGroup(GROUPNAME, 0)); + + // Create the data space. + hsize_t dims[RANK] = {NX, NY}; + DataSpace space(RANK, dims); + + // Create a new dataset. + DataSet dataset(group.createDataSet (DSETNAME, PredType::NATIVE_INT, space)); + + // Get and verify file name via a dataset. + H5std_string file_name = dataset.getFileName(); + verify_val(file_name, FILE4, "DataSet::getFileName", __LINE__, __FILE__); + + // Create an attribute for the dataset. + Attribute attr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space)); + + // Get and verify file name via an attribute. + file_name = attr.getFileName(); + verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__); + + // Create an attribute for the file via root group. + Attribute rootg_attr(rootgroup.createAttribute(FATTRNAME, PredType::NATIVE_INT, space)); + + // Get and verify file name via an attribute. + file_name = attr.getFileName(); + verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__); + + PASSED(); + } // end of try block + + catch (Exception& E) + { + issue_fail_msg("test_commonfg()", __LINE__, __FILE__, E.getCDetailMsg()); + } + +} /* end test_commonfg() */ + +/*------------------------------------------------------------------------- * Function: test_file * * Purpose: Main file testing routine @@ -769,6 +831,7 @@ void test_file() test_file_name(); // Test getting file's name test_file_attribute(); // Test file attribute feature test_libver_bounds(); // Test format version + test_commonfg(); } // test_file() @@ -793,7 +856,7 @@ void cleanup_file() HDremove(FILE1.c_str()); HDremove(FILE2.c_str()); HDremove(FILE3.c_str()); - HDremove(FILE4.c_str()); +// HDremove(FILE4.c_str()); HDremove(FILE5.c_str()); HDremove(FILE6.c_str()); } // cleanup_file |