@@ -32,6 +32,7 @@ subroutine test_1(error_cnt)
32
32
character (kind= json_CK,len= :),allocatable :: cval
33
33
real (wp) :: rval
34
34
logical :: found
35
+ logical :: lval
35
36
36
37
error_cnt = 0
37
38
call json% initialize()
@@ -106,6 +107,7 @@ subroutine test_1(error_cnt)
106
107
107
108
call json% initialize(path_separator= json_CK_' .' ) ! reset to normal paths
108
109
110
+ ! get an integer value:
109
111
write (error_unit,' (A)' ) ' '
110
112
call json% get(' version.svn' , ival)
111
113
if (json% failed()) then
@@ -114,7 +116,20 @@ subroutine test_1(error_cnt)
114
116
else
115
117
write (error_unit,' (A,I5)' ) ' version.svn = ' ,ival
116
118
end if
119
+ ! integer to double conversion:
120
+ call json% get(' version.svn' , rval)
121
+ if (json% failed()) then
122
+ call json% print_error_message(error_unit)
123
+ error_cnt = error_cnt + 1
124
+ end if
125
+ ! integer to logical conversion:
126
+ call json% get(' version.svn' , lval)
127
+ if (json% failed()) then
128
+ call json% print_error_message(error_unit)
129
+ error_cnt = error_cnt + 1
130
+ end if
117
131
132
+ ! get a character value:
118
133
write (error_unit,' (A)' ) ' '
119
134
call json% get(' data(1).array(2)' , cval)
120
135
if (json% failed()) then
@@ -124,6 +139,21 @@ subroutine test_1(error_cnt)
124
139
write (error_unit,' (A)' ) ' data(1).array(2) = ' // trim (cval)
125
140
end if
126
141
142
+ ! get a logical value:
143
+ call json% get(' data(1).tf1' , lval)
144
+ if (json% failed()) then
145
+ call json% print_error_message(error_unit)
146
+ error_cnt = error_cnt + 1
147
+ else
148
+ write (error_unit,' (A)' ) ' data(1).tf1 = ' , lval
149
+ end if
150
+ ! logical to double:
151
+ call json% get(' data(1).tf1' , rval)
152
+ if (json% failed()) then
153
+ call json% print_error_message(error_unit)
154
+ error_cnt = error_cnt + 1
155
+ end if
156
+
127
157
write (error_unit,' (A)' ) ' '
128
158
call json% get(' files(1)' , cval)
129
159
if (json% failed()) then
0 commit comments