From c6417a73a6c059ef81c263c6eefde80a7743fcfa Mon Sep 17 00:00:00 2001 From: Luis Manuel Diaz Angulo Date: Mon, 30 Dec 2024 23:30:30 +0100 Subject: [PATCH] Removes unit hdf test --- test/CMakeLists.txt | 4 -- test/hdf/CMakeLists.txt | 21 ------- test/hdf/hdf_tests.cpp | 1 - test/hdf/hdf_tests.h | 5 -- test/hdf/test_hdf.F90 | 127 ---------------------------------------- 5 files changed, 158 deletions(-) delete mode 100644 test/hdf/CMakeLists.txt delete mode 100644 test/hdf/hdf_tests.cpp delete mode 100644 test/hdf/hdf_tests.h delete mode 100644 test/hdf/test_hdf.F90 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b9e52a6a..d79a4217 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,10 +6,6 @@ enable_language(C CXX Fortran) set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/mod) -if (SEMBA_FDTD_ENABLE_HDF) - add_subdirectory(hdf) - set(HDF_TESTS_LIBRARY hdf_tests) -endif() if (SEMBA_FDTD_ENABLE_MTLN) add_subdirectory(mtln) add_subdirectory(system) diff --git a/test/hdf/CMakeLists.txt b/test/hdf/CMakeLists.txt deleted file mode 100644 index b562e4b4..00000000 --- a/test/hdf/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ - -message(STATUS "Creating build system for test/hdf") - -add_library( - hdf_test_fortran - "test_hdf.F90" -) - -target_link_libraries(hdf_test_fortran - ${HDF5_LIBRARIES} - ${HDF5_HL_LIBRARIES} -) - -add_library(hdf_tests "hdf_tests.cpp") - -target_link_libraries(hdf_tests - hdf_test_fortran - GTest::gtest -) - -include_directories(${HDF5_INCLUDE_DIRS}) \ No newline at end of file diff --git a/test/hdf/hdf_tests.cpp b/test/hdf/hdf_tests.cpp deleted file mode 100644 index ff2d04c4..00000000 --- a/test/hdf/hdf_tests.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "hdf_tests.h" \ No newline at end of file diff --git a/test/hdf/hdf_tests.h b/test/hdf/hdf_tests.h deleted file mode 100644 index 31588718..00000000 --- a/test/hdf/hdf_tests.h +++ /dev/null @@ -1,5 +0,0 @@ -#include - -extern "C" int test_hdf5_writing_and_reading(); - -TEST(hdf, writing_and_reading) {EXPECT_EQ(0, test_hdf5_writing_and_reading()); } diff --git a/test/hdf/test_hdf.F90 b/test/hdf/test_hdf.F90 deleted file mode 100644 index f85b0ff0..00000000 --- a/test/hdf/test_hdf.F90 +++ /dev/null @@ -1,127 +0,0 @@ -integer function test_hdf5_writing_and_reading() bind (C) result(err) - - ! Copied from h5ex_d_fillval - - use hdf5 - - implicit none - - character(len=*), parameter :: filename = 'testing_hdf5_writing_and_reading.h5' - CHARACTER(LEN=3) , PARAMETER :: dataset = "DS1" - INTEGER , PARAMETER :: dim0 = 4 - INTEGER , PARAMETER :: dim1 = 7 - INTEGER , PARAMETER :: edim0 = 6 - INTEGER , PARAMETER :: edim1 = 10 - INTEGER , PARAMETER :: chunk0 = 4 - INTEGER , PARAMETER :: chunk1 = 4 - INTEGER , PARAMETER :: fillval = 99 - - INTEGER :: hdferr - INTEGER(HID_T) :: file, space, dset, dcpl ! Handles - INTEGER(HSIZE_T), DIMENSION(1:2) :: dims = (/dim0, dim1/) - INTEGER(HSIZE_T), DIMENSION(1:2) :: extdims = (/edim0, edim1/) - INTEGER(HSIZE_T), DIMENSION(1:2) :: maxdims - INTEGER(HSIZE_T), DIMENSION(1:2) :: chunk = (/chunk0, chunk1/) - - INTEGER, DIMENSION(1:dim0, 1:dim1) :: wdata, & ! Write buffer - rdata ! Read buffer - INTEGER, DIMENSION(1:edim0, 1:edim1) :: rdata2 ! Read buffer for extension - INTEGER :: i, j - INTEGER :: fillvall - ! - ! Initialize FORTRAN interface. - ! - CALL h5open_f(hdferr) - ! - ! Initialize data. - ! - maxdims = (/H5S_UNLIMITED_F, H5S_UNLIMITED_F/) - - DO i = 1, dim0 - DO j = 1, dim1 - wdata(i,j) = (i-1)*(j-1)-(j-1) - ENDDO - ENDDO - ! - ! Create a new file using the default properties. - ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file, hdferr) - ! - ! Create dataspace with unlimited dimensions. - ! - CALL h5screate_simple_f(2, dims, space, hdferr, maxdims) - ! - ! Create the dataset creation property list, and set the chunk - ! size. - ! - CALL h5pcreate_f(H5P_DATASET_CREATE_F, dcpl, hdferr) - CALL h5pset_chunk_f(dcpl, 2, chunk, hdferr) - ! - ! Set the fill value for the dataset. - ! - CALL h5pset_fill_value_f(dcpl, H5T_NATIVE_INTEGER, fillval, hdferr) - ! - ! Set the allocation time to "early". This way we can be sure - ! that reading from the dataset immediately after creation will - ! return the fill value. - ! - CALL h5pset_alloc_time_f(dcpl, H5D_ALLOC_TIME_EARLY_F,hdferr) - ! - ! Create the dataset using the dataset creation property list. - ! - CALL h5dcreate_f(file, dataset, H5T_STD_I32LE, space, dset, hdferr, dcpl) - ! - ! Read values from the dataset, which has not been written to yet. - ! - CALL h5dread_f(dset, H5T_NATIVE_INTEGER, rdata, dims, hdferr) - ! - ! Output the data to the screen. - ! - WRITE(*, '("Dataset before being written to:")') - DO i=1, dim0 - WRITE(*,'(" [")', ADVANCE='NO') - WRITE(*,'(80i3)', ADVANCE='NO') rdata(i,:) - WRITE(*,'(" ]")') - ENDDO - ! - ! Write the data to the dataset. - ! - CALL h5dwrite_f(dset, H5T_NATIVE_INTEGER, wdata, dims, hdferr, file_space_id=space) - ! - ! Read the data back. - ! - CALL h5dread_f(dset, H5T_NATIVE_INTEGER, rdata, dims, hdferr) - ! - ! Output the data to the screen. - ! - WRITE(*, '("Dataset after being written to:")') - DO i=1, dim0 - WRITE(*,'(" [")', ADVANCE='NO') - WRITE(*,'(80i3)', ADVANCE='NO') rdata(i,:) - WRITE(*,'(" ]")') - ENDDO - ! - ! Extend the dataset. - ! - CALL h5dset_extent_f(dset, extdims, hdferr) - ! - ! Read from the extended dataset. - ! - CALL h5dread_f(dset, H5T_NATIVE_INTEGER, rdata2, extdims, hdferr) - ! - ! Output the data to the screen. - ! - WRITE(*, '("Dataset after extension:")') - DO i=1, extdims(1) - WRITE(*,'(" [")', ADVANCE='NO') - WRITE(*,'(80i3)', ADVANCE='NO') rdata2(i,:) - WRITE(*,'(" ]")') - ENDDO - ! - ! Close and release resources. - ! - CALL h5pclose_f(dcpl , hdferr) - CALL h5dclose_f(dset , hdferr) - CALL h5sclose_f(space, hdferr) - CALL h5fclose_f(file , hdferr) -end function \ No newline at end of file