Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(out) | :: | error_cnt | report number of errors to caller |
Tests different real format strings using repeated calls to json_initialize.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(json_file), | public | :: | my_file | ||||
character(kind=CK,len=:), | public, | allocatable | :: | str | |||
integer, | public | :: | i | ||||
character(len=2), | public, | parameter, dimension(5) | :: | fmts | = | ['g ', 'e ', 'en', 'es', '* '] | format statements to test |
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=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 json_initialize(real_format=trim(fmts(i)))
call my_file%load_from_string('{ "value": 1234.56789 }')
if (json_failed()) then
call json_print_error_message(error_unit)
error_cnt = error_cnt + 1
end if
call my_file%print_to_string(str)
if (json_failed()) then
call json_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