compute_RGB() should pick the expected discrete index for representative z values.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(inout) | :: | id | |||
| integer, | intent(inout) | :: | nfail |
subroutine test_053(id, nfail) use forcolormap, only: Colormap, wp integer, intent(inout) :: id, nfail character(len=*), parameter :: name = "compute_RGB on discrete z=0,1.1,2 hits expected" logical :: ok type(Colormap) :: cmap integer :: red, green, blue integer, dimension(0:6, 3) :: test_colormap 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 cmap%create("discrete", 0.0_wp, 2.0_wp, test_colormap) call cmap%compute_RGB(0.0_wp, red, green, blue) ok = (red == test_colormap(0,1)) .and. (green == test_colormap(0,2)) .and. (blue == test_colormap(0,3)) call cmap%compute_RGB(1.1_wp, red, green, blue) ok = ok .and. (red == test_colormap(3,1)) .and. (green == test_colormap(3,2)) .and. (blue == test_colormap(3,3)) call cmap%compute_RGB(2.0_wp, red, green, blue) ok = ok .and. (red == test_colormap(6,1)) .and. (green == test_colormap(6,2)) .and. (blue == test_colormap(6,3)) call report_test(name, ok, id, nfail) end subroutine test_053