test_lib.pf 985 Bytes
Newer Older
Sebastian Müller's avatar
Sebastian Müller committed
1
2
3
4
5
6
7
8
9
10
module test_lib
  use funit
  use mo_lib_globals, only: global_int, global_real, global_array, global_container
  use mo_lib_functions, only: set_global_vars, set_container_vars
  use mo_kind, only : dp

  implicit none

  private

Sebastian Müller's avatar
Sebastian Müller committed
11
  public :: test_globals
Sebastian Müller's avatar
Sebastian Müller committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

contains

  @test
  subroutine test_globals()

    real(dp), dimension(3) :: dat

    dat = [1., 2., 3.]

    call set_global_vars(1, 2.0_dp, dat)
    call set_container_vars(2, 3.0_dp, 2.0 * dat)

    @assertEqual(1, global_int, message='global int')
    @assertEqual(2._dp, global_real, tolerance=0.001, message='global real')
    @assertEqual(dat, global_array, tolerance=0.001, message='global array')

29
30
31
    @assertEqual(2, global_container%type_int, message='container int')
    @assertEqual(3._dp, global_container%type_real, tolerance=0.001, message='container real')
    @assertEqual(2.0 * dat, global_container%type_array, tolerance=0.001, message='container array')
Sebastian Müller's avatar
Sebastian Müller committed
32
33
34
35

  end subroutine test_globals

end module test_lib