test_073 Subroutine

subroutine test_073(id, nfail)

Uses

  • proc~~test_073~~UsesGraph proc~test_073 test_073 module~forcolormap forcolormap proc~test_073->module~forcolormap module~forcolormap_cm_matplotlib forcolormap_cm_matplotlib module~forcolormap->module~forcolormap_cm_matplotlib module~forcolormap_cm_miscellaneous forcolormap_cm_miscellaneous module~forcolormap->module~forcolormap_cm_miscellaneous module~forcolormap_cm_scientific forcolormap_cm_scientific module~forcolormap->module~forcolormap_cm_scientific module~forcolormap_info forcolormap_info module~forcolormap->module~forcolormap_info module~forcolormap_parameters forcolormap_parameters module~forcolormap->module~forcolormap_parameters module~forcolormap_utils forcolormap_utils module~forcolormap->module~forcolormap_utils module~forcolormap_cm_matplotlib->module~forcolormap_parameters module~forcolormap_cm_miscellaneous->module~forcolormap_parameters module~forcolormap_cm_scientific->module~forcolormap_parameters module~forcolormap_info->module~forcolormap_cm_matplotlib module~forcolormap_info->module~forcolormap_cm_miscellaneous module~forcolormap_info->module~forcolormap_cm_scientific module~forcolormap_info->module~forcolormap_parameters iso_fortran_env iso_fortran_env module~forcolormap_parameters->iso_fortran_env module~forcolormap_utils->module~forcolormap_parameters

load() should read an RGB text file; reverse=.true. should swap the loaded endpoints.

Arguments

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

Calls

proc~~test_073~~CallsGraph proc~test_073 test_073 proc~delete_if_exists delete_if_exists proc~test_073->proc~delete_if_exists proc~get_levels Colormap%get_levels proc~test_073->proc~get_levels proc~get_name Colormap%get_name proc~test_073->proc~get_name proc~get_rgb Colormap%get_RGB proc~test_073->proc~get_rgb proc~load Colormap%load proc~test_073->proc~load proc~report_test report_test proc~test_073->proc~report_test proc~check Colormap%check proc~load->proc~check proc~reverse Colormap%reverse proc~load->proc~reverse proc~find_index Colormaps_info%find_index proc~check->proc~find_index proc~get_levels~2 Colormaps_info%get_levels proc~check->proc~get_levels~2

Called by

proc~~test_073~~CalledByGraph proc~test_073 test_073 program~check check program~check->proc~test_073

Source Code

   subroutine test_073(id, nfail)
      use forcolormap, only: Colormap, wp
      integer, intent(inout) :: id, nfail
      character(len=*), parameter :: name = "load() reads RGB file (and reverse=.true. swaps endpoints)"
      logical :: ok
      type(Colormap) :: a, b
      character(len=*), parameter :: fname = "test_tmp_colormap_load.txt"
      integer :: u
      integer :: r0, g0, b0, rL, gL, bL
      integer :: rr0, gg0, bb0
      logical :: ex

      ! Create a tiny RGB file (3 lines) for load() tests.
      open(newunit=u, file=fname, status="replace", action="write")
      write(u,'(3I3)')  10,  20,  30
      write(u,'(3I3)')  40,  50,  60
      write(u,'(3I3)')  70,  80,  90
      close(u)

      inquire(file=fname, exist=ex)
      if (.not. ex) then
         ok = .false.
         call report_test(name, ok, id, nfail)
         return
      end if

      call a%load(fname, 0.0_wp, 1.0_wp)
      call a%get_RGB(0, r0, g0, b0)
      call a%get_RGB(a%get_levels()-1, rL, gL, bL)

      ok = (a%get_levels() == 3) .and. &
         (trim(a%get_name()) == fname) .and. &
         (r0 == 10) .and. (g0 == 20) .and. (b0 == 30) .and. &
         (rL == 70) .and. (gL == 80) .and. (bL == 90)

      call b%load(fname, 0.0_wp, 1.0_wp, reverse=.true.)
      call b%get_RGB(0, rr0, gg0, bb0)
      ok = ok .and. (rr0 == 70) .and. (gg0 == 80) .and. (bb0 == 90)

      call delete_if_exists(fname)

      call report_test(name, ok, id, nfail)
   end subroutine test_073