Tests different real format strings using repeated calls to json_initialize.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(out) | :: | error_cnt | report number of errors to caller |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
subroutine test_13(error_cnt)
!! Tests different real format strings using repeated calls to [[json_initialize]].
implicit none
integer,intent(out) :: error_cnt !! report number of errors to caller
type(json_file) :: my_file
character(kind=json_CK,len=:),allocatable :: str
integer :: i
character(len=2),dimension(5),parameter :: fmts=['g ','e ','en','es','* ']
!! format statements to test
write(error_unit,'(A)') ''
write(error_unit,'(A)') '================================='
write(error_unit,'(A)') ' TEST 13'
write(error_unit,'(A)') '================================='
write(error_unit,'(A)') ''
error_cnt = 0
do i=1,size(fmts)
call my_file%initialize(real_format=trim(fmts(i)))
call my_file%load_from_string('{ "value": 1234.56789 }')
if (my_file%failed()) then
call my_file%print_error_message(error_unit)
error_cnt = error_cnt + 1
end if
call my_file%print_to_string(str)
if (my_file%failed()) then
call my_file%print_error_message(error_unit)
error_cnt = error_cnt + 1
else
write(output_unit,'(A)') str
end if
call my_file%destroy()
end do
end subroutine test_13