From c2ed846b64f02653d1460855c0aadef20308fc1f Mon Sep 17 00:00:00 2001 From: George Sedov Date: Mon, 17 Jul 2023 17:41:11 +0200 Subject: hdf5 tests: make cpp test actually use cpp HDF5 the previous version didn't even link to libhdf5_cpp.so --- test cases/frameworks/25 hdf5/main.cpp | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/test cases/frameworks/25 hdf5/main.cpp b/test cases/frameworks/25 hdf5/main.cpp index 477e76b..9c7f7bf 100644 --- a/test cases/frameworks/25 hdf5/main.cpp +++ b/test cases/frameworks/25 hdf5/main.cpp @@ -1,29 +1,19 @@ #include -#include "hdf5.h" +#include "H5Cpp.h" int main(void) { -herr_t ier; unsigned maj, min, rel; -ier = H5open(); -if (ier) { - std::cerr << "Unable to initialize HDF5: " << ier << std::endl; +try { + H5::H5Library::open(); + H5::H5Library::getLibVersion(maj, min, rel); + std::cout << "C++ HDF5 version " << maj << "." << min << "." << rel << std::endl; + H5::H5Library::close(); + return EXIT_SUCCESS; +} catch (H5::LibraryIException &e) { + std::cerr << "Exception caught from HDF5: " << e.getDetailMsg() << std::endl; return EXIT_FAILURE; } - -ier = H5get_libversion(&maj, &min, &rel); -if (ier) { - std::cerr << "HDF5 did not initialize!" << std::endl; - return EXIT_FAILURE; -} -std::cout << "C++ HDF5 version " << maj << "." << min << "." << rel << std::endl; - -ier = H5close(); -if (ier) { - std::cerr << "Unable to close HDF5: " << ier << std::endl; - return EXIT_FAILURE; -} -return EXIT_SUCCESS; } -- cgit v1.1