message: Test u16 encoding roundtrip
diff: @@ -80,6 +80,34 @@ mod tests {
  }
  }
  + fn execute_roundtrip_u16(buffer: &[u16], width: u32, height: u32, color: ColorType) {
  + let mut encoded_buffer = Vec::new();
  +
  + {
  + let mut encoder = PNMEncoder::new(&mut encoded_buffer);
  + encoder.encode(buffer, width, height, color)
  + .expect("Failed to encode the image buffer");
  + }
  +
  + let (header, loaded_color, loaded_image) = {
  + let mut decoder = PNMDecoder::new(&encoded_buffer[..]).unwrap();
  + let colortype = decoder.colortype()
  + .expect("Failed to decode color type");
  + let image = decoder.read_image()
  + .expect("Failed to decode the image");
  + let (_, header) = decoder.into_inner();
  + (header, colortype, image)
  + };
  +
  + assert_eq!(header.width(), width);
  + assert_eq!(header.height(), height);
  + assert_eq!(loaded_color, color);
  + match loaded_image {
  + DecodingResult::U16(ref data) if data.as_slice() == buffer => (),
  + _ => panic!("Loaded image buffer deviates from original! {:?}", loaded_image),
  + }
  + }
  +
  #[test]
  fn roundtrip_rgb() {
  let buf: [u8; 27] = [
  @@ -101,4 +129,12 @@ mod tests {
  PNMSubtype::Pixmap(SampleEncoding::Ascii));
  }
  + #[test]
  + fn roundtrip_u16() {
  + let buf: [u16; 6] = [
  + 0, 1, 0xFFFF, 0x1234, 0x3412, 0xBEAF,
  + ];
  +
  + execute_roundtrip_u16(&buf, 6, 1, ColorType::Gray(16));
  + }
  }
  