test_13 Subroutine

public subroutine test_13(error_cnt)

Arguments

Type IntentOptional AttributesName
integer, intent(out) :: error_cnt

report number of errors to caller

Description

Tests different real format strings using repeated calls to json_initialize.

Calls

proc~~test_13~~CallsGraph proc~test_13 test_13 proc~json_initialize json_initialize proc~test_13->proc~json_initialize proc~json_failed json_failed proc~test_13->proc~json_failed proc~json_print_error_message json_print_error_message proc~test_13->proc~json_print_error_message proc~json_clear_exceptions json_clear_exceptions proc~json_initialize->proc~json_clear_exceptions interface~throw_exception throw_exception proc~json_initialize->interface~throw_exception proc~json_print_error_message->proc~json_clear_exceptions proc~json_check_for_errors json_check_for_errors proc~json_print_error_message->proc~json_check_for_errors proc~json_throw_exception json_throw_exception interface~throw_exception->proc~json_throw_exception
Help

Called By

proc~~test_13~~CalledByGraph proc~test_13 test_13 program~jf_test_13 jf_test_13 program~jf_test_13->proc~test_13
Help

Variables

TypeVisibility AttributesNameInitial
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


Source Code

    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