diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2015-04-05 04:12:08 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2015-04-05 04:12:08 (GMT) |
commit | 743686ebe1b0d961b6ac5ac9aa035eac36e9b629 (patch) | |
tree | 171b935be8dce5005fb41a92030e89bd1c8c46df /c++/test/tobject.cpp | |
parent | 083ef61b05cd28cae00ee348b6222538534fb12f (diff) | |
download | hdf5-743686ebe1b0d961b6ac5ac9aa035eac36e9b629.zip hdf5-743686ebe1b0d961b6ac5ac9aa035eac36e9b629.tar.gz hdf5-743686ebe1b0d961b6ac5ac9aa035eac36e9b629.tar.bz2 |
[svn-r26729] Purpose: Fix bugs
Description:
- Changed DataType::operator= to simply copy the id of rhs instead of
calling H5Tcopy because, when the operator= is invoked, a different
datatype id is created and it won't have the same characteristics as
rhs', specifically, if the rhs represents a named datatype, "this"
would still be a transient datatype.
- Added a DataType constructor that takes a PredType object, and this
constructor will cause H5Tcopy to generate another datatype id, from a
predefined datatype.
- Fixed various mistakes in tests.
- Fixed typo that caused failure on Windows.
Merged from trunk r26640 and r26462
Platforms tested:
Linux/64 (platypus)
Linux/32 2.6 (jam/gnu and jam/icc 15)
SunOS 5.11 (emu)
Diffstat (limited to 'c++/test/tobject.cpp')
-rw-r--r-- | c++/test/tobject.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index c74d34a..2381ec2 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -182,20 +182,38 @@ static void test_get_objname_ontypes() // Create a datatype and save it IntType inttype(PredType::STD_B8LE); + inttype.commit(file, "INT type of STD_B8LE"); + // Close the type then open it again to test getting its name + inttype.close(); + inttype = file.openIntType("INT type of STD_B8LE"); + + // Get and verify its name + H5std_string inttype_name = inttype.getObjName(); + verify_val(inttype_name, "/INT type of STD_B8LE", "DataType::getObjName", __LINE__, __FILE__); + + // Make copy of a predefined type and save it DataType dtype(PredType::STD_B8LE); dtype.commit(file, "STD_B8LE"); + // Close the data type and file + dtype.close(); + file.close(); + + // Re-open the file and the data type to test getting its name + file.openFile(FILE_OBJECTS, H5F_ACC_RDWR); + dtype = file.openDataType("STD_B8LE"); + // Get and verify its name H5std_string type_name = dtype.getObjName(); - verify_val(type_name, "/STD_B8LE", "DataSet::getObjName", __LINE__, __FILE__); + verify_val(type_name, "/STD_B8LE", "DataType::getObjName", __LINE__, __FILE__); // Test getting type's name from copied type DataType copied_type; copied_type.copy(dtype); copied_type.commit(file, "copy of STD_B8LE"); type_name = copied_type.getObjName(); - verify_val(type_name, "/copy of STD_B8LE", "DataSet::getObjName", __LINE__, __FILE__); + verify_val(type_name, "/copy of STD_B8LE", "DataType::getObjName", __LINE__, __FILE__); // Test copying an integer predefined type IntType new_int_type(PredType::NATIVE_INT); @@ -203,8 +221,8 @@ static void test_get_objname_ontypes() // Name this datatype new_int_type.commit(grp, "IntType NATIVE_INT"); ssize_t name_len = new_int_type.getObjName(type_name); // default len - verify_val(name_len, (ssize_t)HDstrlen("/typetests/IntType NATIVE_INT"), "DataSet::getObjName", __LINE__, __FILE__); - verify_val(type_name, "/typetests/IntType NATIVE_INT", "DataSet::getObjName", __LINE__, __FILE__); + verify_val(name_len, (ssize_t)HDstrlen("/typetests/IntType NATIVE_INT"), "DataType::getObjName", __LINE__, __FILE__); + verify_val(type_name, "/typetests/IntType NATIVE_INT", "DataType::getObjName", __LINE__, __FILE__); // Close everything or they can be closed when objects go out of scope dtype.close(); |