Large shifts should wrap modulo the number of levels (circular behavior).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(inout) | :: | id | |||
| integer, | intent(inout) | :: | nfail |
subroutine test_067(id, nfail) use forcolormap, only: Colormap, wp integer, intent(inout) :: id, nfail character(len=*), parameter :: name = "shift(100) == cshift(map, mod(100,levels)) for discrete map" logical :: ok type(Colormap) :: cm integer, dimension(0:6,3) :: test_colormap, ref integer :: sh, shmod integer :: i, r, g, b test_colormap = reshape([ & 1, 2, 3, & 4, 5, 6, & 7, 8, 9, & 0, 0, 0, & 9, 8, 7, & 6, 5, 4, & 3, 2, 1 ], shape(test_colormap), order=[2,1]) call cm%create("discrete", 0.0_wp, 2.0_wp, test_colormap) sh = 100 shmod = modulo(sh, cm%get_levels()) ref = cshift(test_colormap, shmod) call cm%shift(sh) ok = .true. do i = 0, cm%get_levels()-1 call cm%get_RGB(i, r, g, b) ok = ok .and. (r == ref(i,1)) .and. (g == ref(i,2)) .and. (b == ref(i,3)) end do call report_test(name, ok, id, nfail) end subroutine test_067