From 33724b98bb8bcaf9ad9c3b2d7d1dd2df7295c7f9 Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 20 Feb 2024 14:58:58 +0100 Subject: [PATCH] Updated tests. --- test/dmtesthdf5.f90 | 38 ++++++++++++++++++++++++++++++++++++-- test/dmtesthtml.f90 | 20 +++++++++++++++++--- test/dmtestmqueue.f90 | 2 ++ test/dmtestpipe.f90 | 12 ++++++++++++ test/dmtestplot.f90 | 12 ++++++++++++ 5 files changed, 79 insertions(+), 5 deletions(-) diff --git a/test/dmtesthdf5.f90 b/test/dmtesthdf5.f90 index c9736db..ce9e90f 100644 --- a/test/dmtesthdf5.f90 +++ b/test/dmtesthdf5.f90 @@ -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) @@ -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 diff --git a/test/dmtesthtml.f90 b/test/dmtesthtml.f90 index 56076e9..53dd49a 100644 --- a/test/dmtesthtml.f90 +++ b/test/dmtesthtml.f90 @@ -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) @@ -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 diff --git a/test/dmtestmqueue.f90 b/test/dmtestmqueue.f90 index 945d990..e92d693 100644 --- a/test/dmtestmqueue.f90 +++ b/test/dmtestmqueue.f90 @@ -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) diff --git a/test/dmtestpipe.f90 b/test/dmtestpipe.f90 index 01ef671..b2a4cfe 100644 --- a/test/dmtestpipe.f90 +++ b/test/dmtestpipe.f90 @@ -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) diff --git a/test/dmtestplot.f90 b/test/dmtestplot.f90 index 67fd04c..25c4981 100644 --- a/test/dmtestplot.f90 +++ b/test/dmtestplot.f90 @@ -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