message: Update comments, add assertions for all color channels.
diff: @@ -140,23 +140,29 @@ mod tests {
  fn cmyk_to_rgb_correct() {
  for c in 0..255 {
  for k in 0..255 {
  - // 255 * (1 - C) * (1 - K);
  - // higher k = higher black level
  - // 254 * 1/255 * 1/255 = 0
  + // Based on R = 255 * (1-C/255) * (1-K/255)
  let r = (255.0 - f32::from(c)) * (255.0 - f32::from(k)) / 255.0;
  let r_u8 = r as u8;
  let convert_r = cmyk_to_rgb(&[c, 0, 0, k])[0];
  + let convert_g = cmyk_to_rgb(&[0, c, 0, k])[1];
  + let convert_b = cmyk_to_rgb(&[0, 0, c, k])[2];
  +
  assert_eq!(convert_r, r_u8,
  "c = {}, k = {}, cymk_to_rgb[0] = {}, should be {}", c, k, convert_r, r_u8);
  + assert_eq!(convert_g, r_u8,
  + "m = {}, k = {}, cymk_to_rgb[1] = {}, should be {}", c, k, convert_g, r_u8);
  + assert_eq!(convert_b, r_u8,
  + "y = {}, k = {}, cymk_to_rgb[2] = {}, should be {}", c, k, convert_b, r_u8);
  +
  }
  }
  }
  fn single_pix_correct(cmyk_pix: [u8; 4], rgb_pix_true: [u8; 3]) {
  let rgb_pix = cmyk_to_rgb(&cmyk_pix);
  - assert_eq!(rgb_pix_true[0], rgb_pix[0], "With CYMK {:?} expected {:?}, got {:?}", cmyk_pix, rgb_pix_true, rgb_pix);
  - assert_eq!(rgb_pix_true[1], rgb_pix[1], "With CYMK {:?} expected {:?}, got {:?}", cmyk_pix, rgb_pix_true, rgb_pix);
  - assert_eq!(rgb_pix_true[2], rgb_pix[2], "With CYMK {:?} expected {:?}, got {:?}", cmyk_pix, rgb_pix_true, rgb_pix);
  + assert_eq!(rgb_pix_true[0], rgb_pix[0], "With CMYK {:?} expected {:?}, got {:?}", cmyk_pix, rgb_pix_true, rgb_pix);
  + assert_eq!(rgb_pix_true[1], rgb_pix[1], "With CMYK {:?} expected {:?}, got {:?}", cmyk_pix, rgb_pix_true, rgb_pix);
  + assert_eq!(rgb_pix_true[2], rgb_pix[2], "With CMYK {:?} expected {:?}, got {:?}", cmyk_pix, rgb_pix_true, rgb_pix);
  }
  #[test]
  