diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2022-04-07 14:23:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-07 14:23:35 (GMT) |
commit | 13d852d89ede307314adbfaa036fe670dfa75554 (patch) | |
tree | f3e66489a150de1fd493365cf5cf535963679e5d /c++/test/tfile.cpp | |
parent | 541bc15452f71f3eae7471fdecbe7994a7f138e2 (diff) | |
download | hdf5-13d852d89ede307314adbfaa036fe670dfa75554.zip hdf5-13d852d89ede307314adbfaa036fe670dfa75554.tar.gz hdf5-13d852d89ede307314adbfaa036fe670dfa75554.tar.bz2 |
1.12: Brings C++ wrappers in line with develop, minus C++11 bits (#1604)
Diffstat (limited to 'c++/test/tfile.cpp')
-rw-r--r-- | c++/test/tfile.cpp | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 5e4e91b..15bad64 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -31,14 +31,14 @@ using namespace H5; #include "h5test.h" #include "h5cpputil.h" // C++ utilility header file -const hsize_t F1_USERBLOCK_SIZE = (hsize_t)0; +const hsize_t F1_USERBLOCK_SIZE = 0; const size_t F1_OFFSET_SIZE = sizeof(haddr_t); const size_t F1_LENGTH_SIZE = sizeof(hsize_t); const unsigned F1_SYM_LEAF_K = 4; const unsigned F1_SYM_INTERN_K = 16; const H5std_string FILE1("tfile1.h5"); -const hsize_t F2_USERBLOCK_SIZE = (hsize_t)512; +const hsize_t F2_USERBLOCK_SIZE = 512; const size_t F2_OFFSET_SIZE = 8; const size_t F2_LENGTH_SIZE = 8; const unsigned F2_SYM_LEAF_K = 8; @@ -46,7 +46,7 @@ const unsigned F2_SYM_INTERN_K = 32; const unsigned F2_ISTORE = 64; const H5std_string FILE2("tfile2.h5"); -const hsize_t F3_USERBLOCK_SIZE = (hsize_t)0; +const hsize_t F3_USERBLOCK_SIZE = 0; const size_t F3_OFFSET_SIZE = F2_OFFSET_SIZE; const size_t F3_LENGTH_SIZE = F2_LENGTH_SIZE; const unsigned F3_SYM_LEAF_K = F2_SYM_LEAF_K; @@ -153,8 +153,8 @@ test_file_create() FileCreatPropList tmpl1 = file1->getCreatePlist(); hsize_t ublock = tmpl1.getUserblock(); - verify_val((long)ublock, (long)F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, - __FILE__); + verify_val(static_cast<long>(ublock), static_cast<long>(F1_USERBLOCK_SIZE), + "FileCreatPropList::getUserblock", __LINE__, __FILE__); size_t parm1, parm2; // file-creation parameters tmpl1.getSizes(parm1, parm2); @@ -175,14 +175,14 @@ test_file_create() catch (InvalidActionException &E) { cerr << " *FAILED*" << endl; cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; - if (file1 != NULL) // clean up - delete file1; + // clean up + delete file1; } // catch all other exceptions catch (Exception &E) { issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg()); - if (file1 != NULL) // clean up - delete file1; + // clean up + delete file1; } // Setting this to NULL for cleaning up in failure situations @@ -209,8 +209,8 @@ test_file_create() // Get the file-creation parameters hsize_t ublock = tmpl1->getUserblock(); - verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, - __FILE__); + verify_val(static_cast<long>(ublock), static_cast<long>(F2_USERBLOCK_SIZE), + "FileCreatPropList::getUserblock", __LINE__, __FILE__); size_t parm1, parm2; // file-creation parameters tmpl1->getSizes(parm1, parm2); @@ -242,8 +242,8 @@ test_file_create() // Get the file-creation parameters ublock = tmpl1->getUserblock(); - verify_val((long)ublock, (long)F3_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, - __FILE__); + verify_val(static_cast<long>(ublock), static_cast<long>(F3_USERBLOCK_SIZE), + "FileCreatPropList::getUserblock", __LINE__, __FILE__); tmpl1->getSizes(parm1, parm2); verify_val(parm1, F3_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); @@ -260,8 +260,8 @@ test_file_create() // catch all exceptions catch (Exception &E) { issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg()); - if (tmpl1 != NULL) // clean up - delete tmpl1; + // clean up + delete tmpl1; } } // test_file_create() @@ -300,8 +300,8 @@ test_file_open() // Get the file-creation parameters hsize_t ublock = tmpl1.getUserblock(); - verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, - __FILE__); + verify_val(static_cast<long>(ublock), static_cast<long>(F2_USERBLOCK_SIZE), + "FileCreatPropList::getUserblock", __LINE__, __FILE__); size_t parm1, parm2; // file-creation parameters tmpl1.getSizes(parm1, parm2); @@ -645,7 +645,8 @@ test_file_attribute() // Get the class of a file attribute's datatype H5T_class_t atclass = fattr1.getTypeClass(); - verify_val(atclass, H5T_FLOAT, "Attribute::getTypeClass()", __LINE__, __FILE__); + verify_val(static_cast<long>(atclass), static_cast<long>(H5T_FLOAT), "Attribute::getTypeClass()", + __LINE__, __FILE__); // Get and verify the number of attributes attached to a file int n_attrs = file5.getNumAttrs(); @@ -896,9 +897,9 @@ test_file_info() // Get the file's version information. H5F_info2_t finfo; tempfile.getFileInfo(finfo); - verify_val(finfo.super.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); - verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); - verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast<long>(finfo.super.version), 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast<long>(finfo.free.version), 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast<long>(finfo.sohm.version), 0, "H5File::getFileInfo", __LINE__, __FILE__); // Close the file. tempfile.close(); @@ -910,9 +911,10 @@ test_file_info() fcpl.getFileSpaceStrategy(out_strategy, out_persist, out_threshold); // Verify file space information. - verify_val(out_strategy, H5F_FSPACE_STRATEGY_FSM_AGGR, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast<long>(out_strategy), static_cast<long>(H5F_FSPACE_STRATEGY_FSM_AGGR), + "H5File::getFileInfo", __LINE__, __FILE__); verify_val(out_persist, FALSE, "H5File::getFileInfo", __LINE__, __FILE__); - verify_val(out_threshold, 1, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast<long>(out_threshold), 1, "H5File::getFileInfo", __LINE__, __FILE__); /* Retrieve file space page size */ hsize_t out_fsp_psize = fcpl.getFileSpacePagesize(); @@ -943,9 +945,9 @@ test_file_info() // Get the file's version information. file7.getFileInfo(finfo); - verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__); - verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); - verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast<long>(finfo.super.version), 2, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast<long>(finfo.free.version), 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast<long>(finfo.sohm.version), 0, "H5File::getFileInfo", __LINE__, __FILE__); // Close the file. file7.close(); @@ -958,9 +960,9 @@ test_file_info() // Get the file's version information. file7.getFileInfo(finfo); - verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__); - verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); - verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast<long>(finfo.super.version), 2, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast<long>(finfo.free.version), 0, "H5File::getFileInfo", __LINE__, __FILE__); + verify_val(static_cast<long>(finfo.sohm.version), 0, "H5File::getFileInfo", __LINE__, __FILE__); // Retrieve the property values & check them. hsize_t userblock = fcpl2.getUserblock(); @@ -986,7 +988,8 @@ test_file_info() // Get and verify the file space info from the creation property list */ fcpl2.getFileSpaceStrategy(out_strategy, out_persist, out_threshold); - verify_val(out_strategy, strategy, "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__); + verify_val(static_cast<long>(out_strategy), static_cast<long>(strategy), + "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__); verify_val(out_persist, persist, "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__); verify_val(out_threshold, threshold, "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__); |