subroutine chk(modelout,name,rgb,other)
! given a color convert to MODELOUT and compare to expected values
character(len=*),intent(in) :: name
integer,intent(in) :: rgb(3), other(3)
character(len=*),intent(in) :: modelout
real :: val1,val2,val3
integer :: status
! convert RGB values to MODELOUT values
call hue('rgb',REAL(rgb(1)),REAL(rgb(2)),REAL(rgb(3)),&
& modelout,val1,val2,val3,status)
! left-justify name to 10 characters or more
write(*,'(a,1x)',advance='no') &
& [ character(len=max(10,len_trim(name))) ::' '//trim(name)]
write(*,'(a,1x,3(i3,1x))',advance='no') &
& modelout//' EXPECTED',other
write(*,'(a,1x,3(i3,1x))',advance='no') &
& 'GOT',int([val1+0.5,val2+0.5,val3+0.5])
write(*,'(a,i0)')'STATUS ',status
end subroutine chk