MONC
model_core
test
utils
test_maths.F90
Go to the documentation of this file.
1
! Tests the logging_mod utility functions
2
module
test_maths_mod
3
use
fruit,
only
: assert_equals, assert_not_equals, &
4
assert_true
5
use
datadefn_mod
,
only
:
default_precision
6
use
maths_mod
,
only
:
random
7
implicit none
8
9
contains
10
11
! Test random produces a non zero value
12
subroutine
test_random
13
14
integer
:: idum
15
real
:: res
16
17
res = 0.0
18
idum = 0
19
res =
random
(idum)
20
21
call
assert_not_equals(res, 0.0,
"Result is not 0"
)
22
23
end subroutine
test_random
24
25
! Test random produces different values
26
subroutine
test_randomness
27
28
integer
:: idum
29
real
:: res1, res2
30
31
res1 = 0.0
32
res2 = 0.0
33
idum = -4
34
res1 =
random
(idum)
35
res2 =
random
(idum)
36
call
assert_not_equals(res1, res2, &
37
"Result are not equal"
)
38
39
end subroutine
test_randomness
40
41
end module
test_maths_mod
42
43
44
45
! Driver for maths_mod utility tests
46
program
test_maths_mod_driver
47
use
fruit,
only
: init_fruit, run_test_case, fruit_summary
48
use
maths_mod
,
only
:
random
49
use
test_maths_mod
,
only
:
test_random
,
test_randomness
50
51
implicit none
52
53
call
init_fruit
54
call
run_test_case(
test_random
,
"Test maths_mod random function produces output"
)
55
call
run_test_case(
test_randomness
,
"Test maths_mod randomness"
)
56
call
fruit_summary
57
end program
test_maths_mod_driver
test_maths_mod::test_randomness
subroutine test_randomness
Definition:
test_maths.F90:27
test_maths_mod::test_random
subroutine test_random
Definition:
test_maths.F90:13
test_maths_mod
Definition:
test_maths.F90:2
maths_mod::random
real(kind=default_precision) function, public random(idum)
returns a scalar random number, the initial seed idum must be negative usage: idum = -k !...
Definition:
maths.F90:23
test_maths_mod_driver
program test_maths_mod_driver
Definition:
test_maths.F90:46
datadefn_mod
Contains common definitions for the data and datatypes used by MONC.
Definition:
datadefn.F90:2
maths_mod
Definition:
maths.F90:1
datadefn_mod::default_precision
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
Definition:
datadefn.F90:17
Generated by
1.8.20