MONC
Functions/Subroutines
test_checkpointer_mod Module Reference

Functions/Subroutines

subroutine test_write_out_global_attributes ()
 
subroutine test_write_out_misc_variables ()
 
subroutine test_define_velocity_variable ()
 
subroutine test_does_field_exist ()
 

Function/Subroutine Documentation

◆ test_define_velocity_variable()

subroutine test_checkpointer_mod::test_define_velocity_variable

Definition at line 45 of file test_checkpointer.F90.

46  integer :: id
47  class(*), pointer :: raw_data, raw_id
48 
49  call dummy_netcdf_reset()
50  call define_velocity_variable(1, 10, field_name="A",field_id=id)
51  call assert_equals(1, id)
52  raw_data => c_get(variable_data, "A")
53  raw_id => c_get(variable_ids, "A")
54  select type(raw_data)
55  type is (integer_array_wrapper_type)
56  call assert_equals(id, conv_to_integer(raw_id, .false.))
57  call assert_equals(1, raw_data%size, "Size expected")
58  call assert_equals(10, raw_data%data(1), "Dimension correct")
59  end select
60  call define_velocity_variable(1, 11, 20, field_name="B",field_id=id)
61  call assert_equals(2, id)
62  raw_data => c_get(variable_data, "B")
63  raw_id => c_get(variable_ids, "B")
64  select type(raw_data)
65  type is (integer_array_wrapper_type)
66  call assert_equals(id, conv_to_integer(raw_id, .false.))
67  call assert_equals(2, raw_data%size, "Size expected")
68  call assert_equals(11, raw_data%data(1), "Dimension correct")
69  call assert_equals(20, raw_data%data(2), "Dimension correct")
70  end select
71  call define_velocity_variable(1, 11, 21, 30, field_name="C",field_id=id)
72  call assert_equals(3, id)
73  raw_data => c_get(variable_data, "C")
74  raw_id => c_get(variable_ids, "C")
75  select type(raw_data)
76  type is (integer_array_wrapper_type)
77  call assert_equals(id, conv_to_integer(raw_id, .false.))
78  call assert_equals(3, raw_data%size, "Size expected")
79  call assert_equals(11, raw_data%data(1), "Dimension correct")
80  call assert_equals(21, raw_data%data(2), "Dimension correct")
81  call assert_equals(30, raw_data%data(3), "Dimension correct")
82  end select
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_does_field_exist()

subroutine test_checkpointer_mod::test_does_field_exist

Definition at line 86 of file test_checkpointer.F90.

87  logical :: exists
88  integer :: dummy=1
89 
90  class(*), pointer :: raw_data
91 
92  raw_data=>conv_to_generic(dummy, .true.)
93  call c_put(variable_ids, "BCD", raw_data)
94 
95  exists = does_field_exist(1, "ABC")
96  call assert_false(exists, "Field does not exist")
97  exists = does_field_exist(1, "BCD")
98  call assert_true(exists, "Field does exist")
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_write_out_global_attributes()

subroutine test_checkpointer_mod::test_write_out_global_attributes

Definition at line 18 of file test_checkpointer.F90.

19  class(*), pointer :: raw_data
20 
21  call dummy_netcdf_reset()
22  call write_out_global_attributes(1)
23 
24  call assert_true(c_contains(global_attributes, title_attribute_key), "Checkpoint title exists")
25  raw_data=>c_get(global_attributes, title_attribute_key)
26  call assert_equals(checkpoint_title, trim(conv_to_string(raw_data, .true., 20)), "Checkpoint title correct")
27  call assert_true(c_contains(global_attributes, created_attribute_key), "Created attribute exists")
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_write_out_misc_variables()

subroutine test_checkpointer_mod::test_write_out_misc_variables

Definition at line 31 of file test_checkpointer.F90.

32  type(model_state_type) :: state_mod
33  integer, dimension(1) :: test_int
34  integer :: ret
35 
36  call dummy_netcdf_reset()
37  state_mod%timestep=100
38  call write_out_misc_variables(state_mod, 1, 1, 2, 3, 4, 5)
39 
40  ret = nf90_get_var_integer(1, 1, test_int)
41  call assert_equals(test_int(1), state_mod%timestep, "Timestep correct")
Here is the call graph for this function:
Here is the caller graph for this function:
state_mod
The model state which represents the current state of a run.
Definition: state.F90:2