shift(+1) should match the intrinsic circular shift cshift(map, +1).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(inout) | :: | id | |||
| integer, | intent(inout) | :: | nfail |
subroutine test_044(id, nfail) use forcolormap, only: Colormap, wp integer, intent(inout) :: id, nfail character(len=*), parameter :: name = "Colormap%shift: matches cshift for sh=+1" logical :: ok type(Colormap) :: cm integer :: map(3,3) integer :: ref(3,3) integer :: i integer :: r, g, b, rr, gg, bb map(1,:) = [ 10, 20, 30 ] map(2,:) = [ 40, 50, 60 ] map(3,:) = [ 70, 80, 90 ] call cm%create("custom", 0.0_wp, 2.0_wp, map) ref = cshift(map, 1) call cm%shift(1) ok = .true. do i = 0, cm%get_levels()-1 call cm%get_RGB(i, r, g, b) rr = ref(i+1, 1) gg = ref(i+1, 2) bb = ref(i+1, 3) ok = ok .and. (r == rr) .and. (g == gg) .and. (b == bb) end do call report_test(name, ok, id, nfail) end subroutine test_044