|
| 1 | +!***************************************************************************************** |
| 2 | +!> |
| 3 | +! Module for the 49th unit test. |
| 4 | + |
| 5 | +module jf_test_49_mod |
| 6 | + |
| 7 | + use json_module, wp => json_RK, IK => json_IK, LK => json_LK, CK => json_CK |
| 8 | + use, intrinsic :: iso_fortran_env , only: error_unit, output_unit |
| 9 | + |
| 10 | + implicit none |
| 11 | + |
| 12 | + private |
| 13 | + public :: test_49 |
| 14 | + |
| 15 | +contains |
| 16 | + |
| 17 | + subroutine test_49(error_cnt) |
| 18 | + |
| 19 | + !! 49th unit test. see Issue #488 |
| 20 | + |
| 21 | + implicit none |
| 22 | + |
| 23 | + integer,intent(out) :: error_cnt |
| 24 | + |
| 25 | + type(json_file) :: json |
| 26 | + integer :: i !! counter |
| 27 | + |
| 28 | + integer,parameter :: n_repeat = 1000 !! number of time to repeat the test |
| 29 | + character(kind=CK,len=*),parameter :: json_string = CK_'{"Substance":[]}' !! string to deserialize |
| 30 | + |
| 31 | + write(error_unit,'(A)') '' |
| 32 | + write(error_unit,'(A)') '=================================' |
| 33 | + write(error_unit,'(A)') ' EXAMPLE 49' |
| 34 | + write(error_unit,'(A)') '=================================' |
| 35 | + write(error_unit,'(A)') '' |
| 36 | + |
| 37 | + error_cnt = 0 |
| 38 | + |
| 39 | + do i = 1, n_repeat |
| 40 | + call json%deserialize(json_string) |
| 41 | + if (json%failed()) then |
| 42 | + call json%print_error_message(error_unit) |
| 43 | + error_cnt = error_cnt + 1 |
| 44 | + call json%destroy() |
| 45 | + exit |
| 46 | + end if |
| 47 | + call json%destroy() |
| 48 | + end do |
| 49 | + |
| 50 | + if (error_cnt==0) then |
| 51 | + write(error_unit,'(A)') 'Success' |
| 52 | + else |
| 53 | + write(error_unit,'(A)') 'Failed' |
| 54 | + end if |
| 55 | + |
| 56 | + write(error_unit,'(A)') '' |
| 57 | + |
| 58 | + end subroutine test_49 |
| 59 | + |
| 60 | +end module jf_test_49_mod |
| 61 | +!***************************************************************************************** |
| 62 | + |
| 63 | +!***************************************************************************************** |
| 64 | +#ifndef INTEGRATED_TESTS |
| 65 | +program jf_test_49 |
| 66 | + |
| 67 | + use jf_test_49_mod , only: test_49 |
| 68 | + |
| 69 | + implicit none |
| 70 | + integer :: n_errors |
| 71 | + |
| 72 | + call test_49(n_errors) |
| 73 | + if (n_errors /= 0) stop 1 |
| 74 | + |
| 75 | +end program jf_test_49 |
| 76 | +#endif |
| 77 | +!***************************************************************************************** |
0 commit comments