test_088 Subroutine

subroutine test_088(id, nfail)

Uses

  • proc~~test_088~~UsesGraph proc~test_088 test_088 module~forcolormap_info forcolormap_info proc~test_088->module~forcolormap_info module~forcolormap_cm_matplotlib forcolormap_cm_matplotlib module~forcolormap_info->module~forcolormap_cm_matplotlib module~forcolormap_cm_miscellaneous forcolormap_cm_miscellaneous module~forcolormap_info->module~forcolormap_cm_miscellaneous module~forcolormap_cm_scientific forcolormap_cm_scientific module~forcolormap_info->module~forcolormap_cm_scientific module~forcolormap_parameters forcolormap_parameters module~forcolormap_info->module~forcolormap_parameters module~forcolormap_cm_matplotlib->module~forcolormap_parameters module~forcolormap_cm_miscellaneous->module~forcolormap_parameters module~forcolormap_cm_scientific->module~forcolormap_parameters iso_fortran_env iso_fortran_env module~forcolormap_parameters->iso_fortran_env

write(verbose=3,name=...) should filter output to exactly one matching name line.

Arguments

Type IntentOptional Attributes Name
integer, intent(inout) :: id
integer, intent(inout) :: nfail

Calls

proc~~test_088~~CallsGraph proc~test_088 test_088 proc~delete_if_exists delete_if_exists proc~test_088->proc~delete_if_exists proc~exists_file exists_file proc~test_088->proc~exists_file proc~get_name~2 Colormaps_info%get_name proc~test_088->proc~get_name~2 proc~report_test report_test proc~test_088->proc~report_test

Called by

proc~~test_088~~CalledByGraph proc~test_088 test_088 program~check check program~check->proc~test_088

Source Code

   subroutine test_088(id, nfail)
      use forcolormap_info, only: cmap_info
      integer, intent(inout) :: id, nfail
      character(len=*), parameter :: name = "cmap_info%write(name=...): filters to exactly one entry"
      logical :: ok
      character(len=*), parameter :: fname = "test_tmp_cmap_info_write_filter.txt"
      character(len=:), allocatable :: target
      integer :: u, ios, count
      character(len=512) :: line

      target = trim(cmap_info%get_name(1))

      call delete_if_exists(fname)
      call cmap_info%write(verbose=3, name=target, file_name=fname)

      ok = exists_file(fname)
      if (.not. ok) then
         call report_test(name, ok, id, nfail)
         return
      end if

      count = 0
      ok    = .true.
      open(newunit=u, file=fname, status="old", action="read")
      do
         read(u,'(a)', iostat=ios) line
         if (ios /= 0) exit
         if (len_trim(line) == 0) cycle
         count = count + 1
         ok = ok .and. (trim(line) == target)
      end do
      close(u)

      ok = ok .and. (count == 1)

      call delete_if_exists(fname)
      call report_test(name, ok, id, nfail)
   end subroutine test_088