C.2.3 Shell_Utils Module Unit Test Program

This lightly commented program performs a unit test on the Shell_Utils Module.

program Unit_Test

  use Caesar_Intrinsics_Module
  use Caesar_Shell_Utils_Module
  implicit none

  type(character,80) :: Filename

  ! Testing statements.

  Filename = '/one/two/three/four/five/six.1.2.3'
  write (6,*) ' '
  write (6,*) 'Filename =           ', TRIM(Filename)
  write (6,*) 'Basename =           ', TRIM(Basename(Filename))
  write (6,*) 'Basename, w/suffix = ', TRIM(Basename(Filename,.false.))
  write (6,*) 'Dirname =            ', TRIM(Dirname(Filename))
  write (6,*) 'Reconstructed path = ', &
              TRIM(Dirname(Filename))//'/'//TRIM(Basename(Filename,.false.))

  Filename = '/one'
  write (6,*) ' '
  write (6,*) 'Filename =           ', TRIM(Filename)
  write (6,*) 'Basename =           ', TRIM(Basename(Filename))
  write (6,*) 'Basename, w/suffix = ', TRIM(Basename(Filename,.false.))
  write (6,*) 'Dirname =            ', TRIM(Dirname(Filename))
  write (6,*) 'Reconstructed path = ', &
              TRIM(Dirname(Filename))//'/'//TRIM(Basename(Filename,.false.))

  Filename = '/one/two.three/four.five'
  write (6,*) ' '
  write (6,*) 'Filename =           ', TRIM(Filename)
  write (6,*) 'Basename =           ', TRIM(Basename(Filename))
  write (6,*) 'Basename, w/suffix = ', TRIM(Basename(Filename,.false.))
  write (6,*) 'Dirname =            ', TRIM(Dirname(Filename))
  write (6,*) 'Reconstructed path = ', &
              TRIM(Dirname(Filename))//'/'//TRIM(Basename(Filename,.false.))

  Filename = 'one'
  write (6,*) ' '
  write (6,*) 'Filename =           ', TRIM(Filename)
  write (6,*) 'Basename =           ', TRIM(Basename(Filename))
  write (6,*) 'Basename, w/suffix = ', TRIM(Basename(Filename,.false.))
  write (6,*) 'Dirname =            ', TRIM(Dirname(Filename))
  write (6,*) 'Reconstructed path = ', &
              TRIM(Dirname(Filename))//'/'//TRIM(Basename(Filename,.false.))

  Filename = './one'
  write (6,*) ' '
  write (6,*) 'Filename =           ', TRIM(Filename)
  write (6,*) 'Basename =           ', TRIM(Basename(Filename))
  write (6,*) 'Basename, w/suffix = ', TRIM(Basename(Filename,.false.))
  write (6,*) 'Dirname =            ', TRIM(Dirname(Filename))
  write (6,*) 'Reconstructed path = ', &
              TRIM(Dirname(Filename))//'/'//TRIM(Basename(Filename,.false.))

end



Michael L. Hall