load() should read an RGB text file; reverse=.true. should swap the loaded endpoints.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(inout) | :: | id | |||
| integer, | intent(inout) | :: | nfail |
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