MONC
Functions/Subroutines
test_optionsdatabase_mod Module Reference

Functions/Subroutines

subroutine test_get_argument_value_type ()
 
subroutine test_add_logical_key_value_pairs ()
 
subroutine test_add_integer_key_value_pairs ()
 
subroutine test_add_real_key_value_pairs ()
 
subroutine test_add_string_key_value_pairs ()
 

Function/Subroutine Documentation

◆ test_add_integer_key_value_pairs()

subroutine test_optionsdatabase_mod::test_add_integer_key_value_pairs

Definition at line 47 of file test_optionsdatabase.F90.

48  type(map_type) :: options_database
49  class(*), pointer :: raw_data
50 
51  call add_specific_option_key_value_pair(integer_type, options_database, "--test1=9542")
52  call add_specific_option_key_value_pair(integer_type, options_database, "--test2=-1234")
53  call add_specific_option_key_value_pair(integer_type, options_database, "--test3=+82")
54  call add_specific_option_key_value_pair(integer_type, options_database, "--test4=0")
55 
56  raw_data=>c_get(options_database, "test1")
57  call assert_equals(9542, conv_to_integer(raw_data, .false.), "Simple integer value added")
58  raw_data=>c_get(options_database, "test2")
59  call assert_equals(-1234, conv_to_integer(raw_data, .false.), "Negative integer value added")
60  raw_data=>c_get(options_database, "test3")
61  call assert_equals(82, conv_to_integer(raw_data, .false.), "Positive integer value added")
62  raw_data=>c_get(options_database, "test4")
63  call assert_equals(0, conv_to_integer(raw_data, .false.), "Zero integer value added")
64 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_add_logical_key_value_pairs()

subroutine test_optionsdatabase_mod::test_add_logical_key_value_pairs

Definition at line 30 of file test_optionsdatabase.F90.

31  type(map_type) :: options_database
32  class(*), pointer :: raw_data
33 
34  call add_specific_option_key_value_pair(logical_type, options_database, "--test1")
35  call add_specific_option_key_value_pair(logical_type, options_database, "--test2=false")
36  call add_specific_option_key_value_pair(logical_type, options_database, "--test3=true")
37 
38  raw_data=>c_get(options_database, "test1")
39  call assert_true(conv_to_logical(raw_data, .false.), "Logical no value is true")
40  raw_data=>c_get(options_database, "test2")
41  call assert_false(conv_to_logical(raw_data, .false.), "Logical false values")
42  raw_data=>c_get(options_database, "test3")
43  call assert_true(conv_to_logical(raw_data, .false.), "Logical true values")
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_add_real_key_value_pairs()

subroutine test_optionsdatabase_mod::test_add_real_key_value_pairs

Definition at line 68 of file test_optionsdatabase.F90.

69  type(map_type) :: options_database
70  class(*), pointer :: raw_data
71 
72  call add_specific_option_key_value_pair(real_type, options_database, "--test1=9542.342")
73  call add_specific_option_key_value_pair(real_type, options_database, "--test2=-1.33e9")
74  call add_specific_option_key_value_pair(real_type, options_database, "--test3=987.232e-6")
75  call add_specific_option_key_value_pair(real_type, options_database, "--test4=-98.72")
76 
77  raw_data=>c_get(options_database, "test1")
78  call assert_equals(9542.342, conv_to_real(raw_data, .false.), "Simple float value added")
79  raw_data=>c_get(options_database, "test2")
80  call assert_equals(-1.33e9, conv_to_real(raw_data, .false.), "Negative with exponent value added")
81  raw_data=>c_get(options_database, "test3")
82  call assert_equals(987.232e-6, conv_to_real(raw_data, .false.), &
83  "Positive with negative exponent value added")
84  raw_data=>c_get(options_database, "test4")
85  call assert_equals(-98.72, conv_to_real(raw_data, .false.), "Negative float value added")
86 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_add_string_key_value_pairs()

subroutine test_optionsdatabase_mod::test_add_string_key_value_pairs

Definition at line 90 of file test_optionsdatabase.F90.

91  type(map_type) :: options_database
92  class(*), pointer :: raw_data
93 
94  call add_specific_option_key_value_pair(string_type, options_database, "--test1=abc")
95  call add_specific_option_key_value_pair(string_type, options_database, "--test2=HeLlO")
96 
97  raw_data=>c_get(options_database, "test1")
98  call assert_equals("abc", conv_to_string(raw_data, .false., 44), "Simple string")
99  raw_data=>c_get(options_database, "test2")
100  call assert_equals("HeLlO", conv_to_string(raw_data, .false., 44), "Case sensitive string")
101 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_get_argument_value_type()

subroutine test_optionsdatabase_mod::test_get_argument_value_type

Definition at line 13 of file test_optionsdatabase.F90.

14 
15  call assert_equals(logical_type, get_argument_value_type("true"), "True is logical")
16  call assert_equals(logical_type, get_argument_value_type("false"), "False is logical")
17  call assert_equals(integer_type, get_argument_value_type("12345"), "Simple number is integer")
18  call assert_equals(integer_type, get_argument_value_type("+98"), "Positive number is integer")
19  call assert_equals(integer_type, get_argument_value_type("-55232"), "Negative number is integer")
20  call assert_equals(integer_type, get_argument_value_type("0"), "Zero is integer")
21  call assert_equals(real_type, get_argument_value_type("1.2"), "Simple floating point is real")
22  call assert_equals(real_type, get_argument_value_type("1.9867e6"), "Exponent floating point is real")
23  call assert_equals(real_type, get_argument_value_type("72.54e-6"), "Small exponent floating point is real")
24  call assert_equals(real_type, get_argument_value_type("-9983.2324"), "Negative floating point is real")
25  call assert_equals(string_type, get_argument_value_type("hello"), "Other characters are string")
26  call assert_equals(string_type, get_argument_value_type("1234abc"), "Number and then non numeric characters are string")
Here is the call graph for this function:
Here is the caller graph for this function: