CCPP SciDoc v7.0.0  v7.0.0
Common Community Physics Package Developed at DTC
 
Loading...
Searching...
No Matches
test_tempo_utils_suite.F90
2 !! unit tests for module_mp_tempo_utils
3 use testdrive, only : new_unittest, unittest_type, error_type, check
4 use module_mp_tempo_params, only : wp, sp, dp, t_efrw, t_efsw, &
5 initialize_array_efrw, initialize_array_efsw, initialize_bins_for_tables
6 use module_mp_tempo_utils, only : calc_gamma_p, compute_efrw, compute_efsw
7 implicit none
8 private
9
10 public :: collect_tempo_utils_suite
11
12 contains
13
14 ! collect all exported unit tests
15 subroutine collect_tempo_utils_suite(testsuite)
16 ! collection of tests
17 type(unittest_type), allocatable, intent(out) :: testsuite(:)
18
19 testsuite = [ &
20 new_unittest("checking that procedure calc_gamma_p(8.,8.) = 0.547", &
21 calcgammap_a8x8), &
22 new_unittest("checking initialization of rain-cloud water collection efficiency data after allocation resulting in all(t_efrw == 0.) being false", &
23 tableefrw_allzerofalse), &
24 new_unittest("checking initialization of snow-cloud water collection efficiency data after allocation resulting in all(t_efsw == 0.) being false", &
25 tableefsw_allzerofalse) &
26 ]
27
28 end subroutine collect_tempo_utils_suite
29
30 subroutine calcgammap_a8x8(error)
31 !! test calc_gamma_p with a=8 and x=8
32 type(error_type), allocatable, intent(out) :: error
33 real(wp) :: value_from_wolfram = 0.54703919051300551
34
35 call check(error, abs(calc_gamma_p(8.,8.) - value_from_wolfram) < 1.e-6_wp)
36 if (allocated(error)) return
37 end subroutine calcgammap_a8x8
38
39
40 subroutine tableefrw_allzerofalse(error)
41 !! test for proper initialization of t_efrw
42 type(error_type), allocatable, intent(out) :: error
43 call initialize_bins_for_tables()
44 call initialize_array_efrw()
45 write(*,*) shape(t_efrw)
46 call compute_efrw()
47 call check(error, all(t_efrw==0.0_dp), .false.)
48 if (allocated(error)) return
49 end subroutine tableefrw_allzerofalse
50
51
52 subroutine tableefsw_allzerofalse(error)
53 !! test for proper initialization of t_efsw
54 type(error_type), allocatable, intent(out) :: error
55 call initialize_bins_for_tables()
56 call initialize_array_efsw()
57 call compute_efsw()
58 call check(error, all(t_efsw==0.0_dp), .false.)
59 if (allocated(error)) return
60 end subroutine tableefsw_allzerofalse
61
62end module test_tempo_utils_suite