Skip to content

Commit

Permalink
Updated tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
interkosmos committed Feb 20, 2024
1 parent 6cba05d commit 33724b9
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 5 deletions.
38 changes: 36 additions & 2 deletions test/dmtesthdf5.f90
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ program dmtesthdf5
character(len=*), parameter :: FILE_PATH = 'testobserv.hdf5'
character(len=*), parameter :: GROUP_NAME = 'timeseries'

integer, parameter :: NTESTS = 6
integer, parameter :: NTESTS = 7

type(test_type) :: tests(NTESTS)
logical :: stats(NTESTS)

call dm_init()

tests(1) = test_type('dmtesthdf5.test01', test01)
tests(2) = test_type('dmtesthdf5.test02', test02)
tests(3) = test_type('dmtesthdf5.test03', test03)
tests(4) = test_type('dmtesthdf5.test04', test04)
tests(5) = test_type('dmtesthdf5.test05', test05)
tests(6) = test_type('dmtesthdf5.test06', test06)
tests(7) = test_type('dmtesthdf5.test07', test07)

call dm_init()
call dm_test_run(tests, stats, dm_env_has('NO_COLOR'))
contains
logical function test01() result(stat)
Expand Down Expand Up @@ -353,4 +355,36 @@ logical function test06() result(stat)
print *, 'Clean-up ...'
rc = dm_hdf5_destroy()
end function test06

logical function test07() result(stat)
!! Tests availale filters.
integer :: rc
logical :: avail(4)

stat = TEST_FAILED

print *, 'Initialising ...'
rc = dm_hdf5_init()
call dm_error_out(rc)
if (dm_is_error(rc)) return

print *, 'Checking available filters ...'
avail = .false.
rc = dm_hdf5_filter_available(HDF5_FILTER_DEFLATE, avail(HDF5_FILTER_DEFLATE)); call dm_error_out(rc)
rc = dm_hdf5_filter_available(HDF5_FILTER_SHUFFLE, avail(HDF5_FILTER_SHUFFLE)); call dm_error_out(rc)
rc = dm_hdf5_filter_available(HDF5_FILTER_FLETCHER32, avail(HDF5_FILTER_FLETCHER32)); call dm_error_out(rc)
rc = dm_hdf5_filter_available(HDF5_FILTER_SZIP, avail(HDF5_FILTER_SZIP)); call dm_error_out(rc)

print *, 'Deflate...: ', avail(HDF5_FILTER_DEFLATE)
print *, 'Shuffle...: ', avail(HDF5_FILTER_SHUFFLE)
print *, 'Fletcher32: ', avail(HDF5_FILTER_FLETCHER32)
print *, 'SZIP......: ', avail(HDF5_FILTER_SZIP)

print *, 'Clean-up ...'
rc = dm_hdf5_destroy()
call dm_error_out(rc)
if (dm_is_error(rc)) return

stat = TEST_PASSED
end function test07
end program dmtesthdf5
20 changes: 17 additions & 3 deletions test/dmtesthtml.f90
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
program dmtesthtml
use :: dmpack
implicit none (type, external)
integer, parameter :: NTESTS = 2
integer, parameter :: NTESTS = 3

type(test_type) :: tests(NTESTS)
logical :: stats(NTESTS)
type(test_type) :: tests(NTESTS)

call dm_init()

tests(1) = test_type('dmtesthtml.test01', test01)
tests(2) = test_type('dmtesthtml.test02', test02)
tests(3) = test_type('dmtesthtml.test03', test03)

call dm_init()
call dm_test_run(tests, stats, dm_env_has('NO_COLOR'))
contains
logical function test01() result(stat)
Expand Down Expand Up @@ -59,5 +61,17 @@ logical function test02() result(stat)

stat = TEST_PASSED
end function test02

logical function test03() result(stat)
stat = TEST_FAILED

print *, 'Basic HTML page ...'
print '(72("."))'
print '(a)', dm_html_header('Title', 'Sub-Title', 'style.css', brand='Brand')
print '(a)', dm_html_footer('Footer' // ASCII_LF, 'script.js')
print '(72("."))'

stat = TEST_PASSED
end function test03
end program dmtesthtml

2 changes: 2 additions & 0 deletions test/dmtestmqueue.f90
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ program dmtestmqueue
!! $ export DM_MQUEUE_SKIP=1
!! $ ./dmtestmqueue
!!
!! This may be necessary on test platforms where messages queues are not
!! available.
use :: dmpack
implicit none (type, external)

Expand Down
12 changes: 12 additions & 0 deletions test/dmtestpipe.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
! Author: Philipp Engel
! Licence: ISC
program dmtestpipe
!! Disabled the tests of this program by setting the following environment
!! variable:
!!
!! DM_PIPE_SKIP - Skip all tests.
!!
!! For example:
!!
!! $ export DM_PIPE_SKIP=1
!! $ ./dmtestpipe
!!
!! This may be necessary on test platforms where bi-directional pipes are
!! not available.
use, intrinsic :: iso_c_binding, only: c_associated
use :: dmpack
implicit none (type, external)
Expand Down
12 changes: 12 additions & 0 deletions test/dmtestplot.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
! Author: Philipp Engel
! Licence: ISC
program dmtestplot
!! Disabled the tests of this program by setting the following environment
!! variable:
!!
!! DM_PIPE_SKIP - Skip all tests.
!!
!! For example:
!!
!! $ export DM_PIPE_SKIP=1
!! $ ./dmtestplot
!!
!! This may be necessary on test platforms where Gnuplot or bi-directional
!! pipes are not available.
use :: dmpack
implicit none (type, external)
integer, parameter :: NTESTS = 1
Expand Down

0 comments on commit 33724b9

Please sign in to comment.