mod black_and_white {
const EXPECTED: [[bool; 9]; 3] = [
[false, true, false, true, false, true, true, false, true],
[true, true, false, true, true, true, true, true, false],
[true, true, true, true, true, true, true, true, false],
];
#[test]
fn black_and_white() {
const P1: [[bool; 9]; 3] = include_pnm::include_pbm!("BlackAndWhite.p1.pbm");
const P4: [[bool; 9]; 3] = include_pnm::include_pbm!("BlackAndWhite.p4.pbm");
const P7: [[bool; 9]; 3] = include_pnm::include_pbm!("BlackAndWhite.p7.pam");
const PNM: [[[bool; 1]; 9]; 3] =
include_pnm::include_pnm!([bool; 1], "BlackAndWhite.p7.pam");
assert_eq!(EXPECTED, P1);
assert_eq!(EXPECTED, P4);
assert_eq!(EXPECTED, P7);
assert_eq!(EXPECTED, PNM.map(|row| row.map(|col| col[0])));
}
#[test]
fn black_and_white_alpha() {
const P1: [[[bool; 2]; 9]; 3] = include_pnm::include_pbma!("BlackAndWhite.p1.pbm");
const BLACK_AND_WHITE_ALPHA_P7: [[[bool; 2]; 9]; 3] =
include_pnm::include_pbma!("BlackAndWhite_BlackAndWhiteAlpha.p7.pam");
assert_eq!(P1, BLACK_AND_WHITE_ALPHA_P7);
}
#[test]
fn grayscale() {
const P1: [[u8; 9]; 3] = include_pnm::include_pgm!("BlackAndWhite.p1.pbm");
const GRAYSCALE_P2: [[u8; 9]; 3] =
include_pnm::include_pgm!("BlackAndWhite_Grayscale.p2.pgm");
const GRAYSCALE_P5: [[u8; 9]; 3] =
include_pnm::include_pgm!("BlackAndWhite_Grayscale.p5.pgm");
const GRAYSCALE_P7: [[u8; 9]; 3] =
include_pnm::include_pgm!("BlackAndWhite_Grayscale.p7.pam");
assert_eq!(P1, GRAYSCALE_P2);
assert_eq!(P1, GRAYSCALE_P5);
assert_eq!(P1, GRAYSCALE_P7);
}
#[test]
fn grayscale_alpha() {
const P1: [[[u8; 2]; 9]; 3] = include_pnm::include_pgma!("BlackAndWhite.p1.pbm");
const GRAYSCALE_ALPHA_P7: [[[u8; 2]; 9]; 3] =
include_pnm::include_pgma!("BlackAndWhite_GrayscaleAlpha.p7.pam");
assert_eq!(P1, GRAYSCALE_ALPHA_P7);
}
#[test]
fn rgb() {
const P1: [[[u8; 3]; 9]; 3] = include_pnm::include_ppm!("BlackAndWhite.p1.pbm");
const RGB_P3: [[[u8; 3]; 9]; 3] = include_pnm::include_ppm!("BlackAndWhite_Rgb.p3.ppm");
const RGB_P6: [[[u8; 3]; 9]; 3] = include_pnm::include_ppm!("BlackAndWhite_Rgb.p6.ppm");
const RGB_P7: [[[u8; 3]; 9]; 3] = include_pnm::include_ppm!("BlackAndWhite_Rgb.p7.pam");
assert_eq!(P1, RGB_P3);
assert_eq!(P1, RGB_P6);
assert_eq!(P1, RGB_P7);
}
#[test]
fn rgb_alpha() {
const P1: [[[u8; 4]; 9]; 3] = include_pnm::include_ppma!("BlackAndWhite.p1.pbm");
const RGB_ALPHA_P7: [[[u8; 4]; 9]; 3] =
include_pnm::include_ppma!("BlackAndWhite_RgbAlpha.p7.pam");
assert_eq!(P1, RGB_ALPHA_P7);
}
#[test]
fn grayscale16() {
const P1: [[u16; 9]; 3] = include_pnm::include_pgm16!("BlackAndWhite.p1.pbm");
const GRAYSCALE16_P2: [[u16; 9]; 3] =
include_pnm::include_pgm16!("BlackAndWhite_Grayscale16.p2.pgm");
const GRAYSCALE16_P5: [[u16; 9]; 3] =
include_pnm::include_pgm16!("BlackAndWhite_Grayscale16.p5.pgm");
const GRAYSCALE16_P7: [[u16; 9]; 3] =
include_pnm::include_pgm16!("BlackAndWhite_Grayscale16.p7.pam");
assert_eq!(P1, GRAYSCALE16_P2);
assert_eq!(P1, GRAYSCALE16_P5);
assert_eq!(P1, GRAYSCALE16_P7);
}
#[test]
fn grayscale_alpha16() {
const P1: [[[u16; 2]; 9]; 3] = include_pnm::include_pgma16!("BlackAndWhite.p1.pbm");
const GRAYSCALE_ALPHA16_P7: [[[u16; 2]; 9]; 3] =
include_pnm::include_pgma16!("BlackAndWhite_GrayscaleAlpha16.p7.pam");
assert_eq!(P1, GRAYSCALE_ALPHA16_P7);
}
#[test]
fn rgb16() {
const P1: [[[u16; 3]; 9]; 3] = include_pnm::include_ppm16!("BlackAndWhite.p1.pbm");
const RGB16_P3: [[[u16; 3]; 9]; 3] =
include_pnm::include_ppm16!("BlackAndWhite_Rgb16.p3.ppm");
const RGB16_P6: [[[u16; 3]; 9]; 3] =
include_pnm::include_ppm16!("BlackAndWhite_Rgb16.p6.ppm");
const RGB16_P7: [[[u16; 3]; 9]; 3] =
include_pnm::include_ppm16!("BlackAndWhite_Rgb16.p7.pam");
assert_eq!(P1, RGB16_P3);
assert_eq!(P1, RGB16_P6);
assert_eq!(P1, RGB16_P7);
}
#[test]
fn rgb_alpha16() {
const P1: [[[u16; 4]; 9]; 3] = include_pnm::include_ppma16!("BlackAndWhite.p1.pbm");
const RGB_ALPHA16_P7: [[[u16; 4]; 9]; 3] =
include_pnm::include_ppma16!("BlackAndWhite_RgbAlpha16.p7.pam");
assert_eq!(P1, RGB_ALPHA16_P7);
}
#[test]
fn even_width() {
const EXPECTED: [[bool; 8]; 4] = [
[false, true, false, true, false, true, true, false],
[true, true, true, false, true, true, true, true],
[true, false, true, true, true, true, true, true],
[true, true, false, false, false, false, false, false],
];
const P1: [[bool; 8]; 4] = include_pnm::include_pbm!("BlackAndWhite.EvenWidth.p1.pbm");
const P4: [[bool; 8]; 4] = include_pnm::include_pbm!("BlackAndWhite.EvenWidth.p4.pbm");
assert_eq!(EXPECTED, P1);
assert_eq!(EXPECTED, P4);
}
}
mod black_and_white_alpha {
const EXPECTED: [[[bool; 2]; 9]; 3] = [
[
[false, false],
[true, true],
[false, false],
[false, true],
[false, false],
[true, true],
[true, true],
[false, false],
[false, true],
],
[
[false, true],
[false, true],
[false, false],
[true, true],
[true, true],
[true, true],
[true, true],
[true, true],
[false, false],
],
[
[false, true],
[false, true],
[false, true],
[false, true],
[false, true],
[false, true],
[false, true],
[false, true],
[false, false],
],
];
#[test]
fn black_and_white_alpha() {
const P7: [[[bool; 2]; 9]; 3] = include_pnm::include_pbma!("BlackAndWhiteAlpha.p7.pam");
const PNM: [[[bool; 2]; 9]; 3] =
include_pnm::include_pnm!([bool; 2], "BlackAndWhiteAlpha.p7.pam");
assert_eq!(EXPECTED, P7);
assert_eq!(EXPECTED, PNM);
}
#[test]
fn grayscale_alpha() {
const P7: [[[u8; 2]; 9]; 3] = include_pnm::include_pgma!("BlackAndWhiteAlpha.p7.pam");
const GRAYSCALE_ALPHA_P7: [[[u8; 2]; 9]; 3] =
include_pnm::include_pgma!("BlackAndWhiteAlpha_GrayscaleAlpha.p7.pam");
assert_eq!(P7, GRAYSCALE_ALPHA_P7);
}
#[test]
fn rgb_alpha() {
const P7: [[[u8; 4]; 9]; 3] = include_pnm::include_ppma!("BlackAndWhiteAlpha.p7.pam");
const RGB_ALPHA_P7: [[[u8; 4]; 9]; 3] =
include_pnm::include_ppma!("BlackAndWhiteAlpha_RgbAlpha.p7.pam");
assert_eq!(P7, RGB_ALPHA_P7);
}
#[test]
fn grayscale_alpha16() {
const P7: [[[u16; 2]; 9]; 3] = include_pnm::include_pgma16!("BlackAndWhiteAlpha.p7.pam");
const GRAYSCALE_ALPHA16_P7: [[[u16; 2]; 9]; 3] =
include_pnm::include_pgma16!("BlackAndWhiteAlpha_GrayscaleAlpha16.p7.pam");
assert_eq!(P7, GRAYSCALE_ALPHA16_P7);
}
#[test]
fn rgb_alpha16() {
const P7: [[[u16; 4]; 9]; 3] = include_pnm::include_ppma16!("BlackAndWhiteAlpha.p7.pam");
const RGB_ALPHA16_P7: [[[u16; 4]; 9]; 3] =
include_pnm::include_ppma16!("BlackAndWhiteAlpha_RgbAlpha16.p7.pam");
assert_eq!(P7, RGB_ALPHA16_P7);
}
}
mod grayscale {
const EXPECTED: [[u8; 9]; 3] = [
[0, 255, 0, 255, 0, 127, 255, 0, 85],
[170, 255, 0, 51, 102, 153, 204, 255, 0],
[32, 64, 96, 128, 159, 191, 223, 255, 0],
];
#[test]
fn grayscale() {
const P2: [[u8; 9]; 3] = include_pnm::include_pgm!("Grayscale.p2.pgm");
const P5: [[u8; 9]; 3] = include_pnm::include_pgm!("Grayscale.p5.pgm");
const P7: [[u8; 9]; 3] = include_pnm::include_pgm!("Grayscale.p7.pam");
const PNM: [[[u8; 1]; 9]; 3] =
include_pnm::include_pnm!([u8; 1], "Grayscale.p2.pgm");
assert_eq!(EXPECTED, P2);
assert_eq!(EXPECTED, P5);
assert_eq!(EXPECTED, P7);
assert_eq!(EXPECTED, PNM.map(|row| row.map(|col| col[0])));
}
#[test]
fn grayscale_alpha() {
const P2: [[[u8; 2]; 9]; 3] = include_pnm::include_pgma!("Grayscale.p2.pgm");
const GRAYSCALE_ALPHA_P7: [[[u8; 2]; 9]; 3] =
include_pnm::include_pgma!("Grayscale_GrayscaleAlpha.p7.pam");
assert_eq!(P2, GRAYSCALE_ALPHA_P7);
}
#[test]
fn rgb() {
const P2: [[[u8; 3]; 9]; 3] = include_pnm::include_ppm!("Grayscale.p2.pgm");
const RGB_P3: [[[u8; 3]; 9]; 3] = include_pnm::include_ppm!("Grayscale_Rgb.p3.ppm");
const RGB_P6: [[[u8; 3]; 9]; 3] = include_pnm::include_ppm!("Grayscale_Rgb.p6.ppm");
const RGB_P7: [[[u8; 3]; 9]; 3] = include_pnm::include_ppm!("Grayscale_Rgb.p7.pam");
assert_eq!(P2, RGB_P3);
assert_eq!(P2, RGB_P6);
assert_eq!(P2, RGB_P7);
}
#[test]
fn rgb_alpha() {
const P2: [[[u8; 4]; 9]; 3] = include_pnm::include_ppma!("Grayscale.p2.pgm");
const RGB_ALPHA_P7: [[[u8; 4]; 9]; 3] =
include_pnm::include_ppma!("Grayscale_RgbAlpha.p7.pam");
assert_eq!(P2, RGB_ALPHA_P7);
}
#[test]
fn grayscale16() {
const P2: [[u16; 9]; 3] = include_pnm::include_pgm16!("Grayscale.p2.pgm");
const GRAYSCALE16_P2: [[u16; 9]; 3] =
include_pnm::include_pgm16!("Grayscale_Grayscale16.p2.pgm");
const GRAYSCALE16_P5: [[u16; 9]; 3] =
include_pnm::include_pgm16!("Grayscale_Grayscale16.p5.pgm");
const GRAYSCALE16_P7: [[u16; 9]; 3] =
include_pnm::include_pgm16!("Grayscale_Grayscale16.p7.pam");
assert_eq!(P2, GRAYSCALE16_P2);
assert_eq!(P2, GRAYSCALE16_P5);
assert_eq!(P2, GRAYSCALE16_P7);
}
#[test]
fn grayscale_alpha16() {
const P2: [[[u16; 2]; 9]; 3] = include_pnm::include_pgma16!("Grayscale.p2.pgm");
const GRAYSCALE_ALPHA16_P7: [[[u16; 2]; 9]; 3] =
include_pnm::include_pgma16!("Grayscale_GrayscaleAlpha16.p7.pam");
assert_eq!(P2, GRAYSCALE_ALPHA16_P7);
}
#[test]
fn rgb16() {
const P2: [[[u16; 3]; 9]; 3] = include_pnm::include_ppm16!("Grayscale.p2.pgm");
const RGB16_P3: [[[u16; 3]; 9]; 3] = include_pnm::include_ppm16!("Grayscale_Rgb16.p3.ppm");
const RGB16_P6: [[[u16; 3]; 9]; 3] = include_pnm::include_ppm16!("Grayscale_Rgb16.p6.ppm");
const RGB16_P7: [[[u16; 3]; 9]; 3] = include_pnm::include_ppm16!("Grayscale_Rgb16.p7.pam");
assert_eq!(P2, RGB16_P3);
assert_eq!(P2, RGB16_P6);
assert_eq!(P2, RGB16_P7);
}
#[test]
fn rgb_alpha16() {
const P2: [[[u16; 4]; 9]; 3] = include_pnm::include_ppma16!("Grayscale.p2.pgm");
const RGB_ALPHA16_P7: [[[u16; 4]; 9]; 3] =
include_pnm::include_ppma16!("Grayscale_RgbAlpha16.p7.pam");
assert_eq!(P2, RGB_ALPHA16_P7);
}
}
mod grayscale_alpha {
const EXPECTED: [[[u8; 2]; 9]; 3] = [
[
[0, 0],
[255, 255],
[0, 0],
[255, 255],
[0, 0],
[127, 255],
[255, 255],
[0, 0],
[85, 255],
],
[
[170, 255],
[255, 255],
[0, 0],
[51, 255],
[102, 255],
[153, 255],
[204, 255],
[255, 255],
[0, 0],
],
[
[32, 255],
[64, 255],
[96, 255],
[128, 255],
[159, 255],
[191, 255],
[223, 255],
[255, 255],
[0, 0],
],
];
#[test]
fn grayscale_alpha() {
const P7: [[[u8; 2]; 9]; 3] = include_pnm::include_pgma!("GrayscaleAlpha.p7.pam");
const PNM: [[[u8; 2]; 9]; 3] = include_pnm::include_pnm!([u8; 2], "GrayscaleAlpha.p7.pam");
assert_eq!(EXPECTED, P7);
assert_eq!(EXPECTED, PNM);
}
#[test]
fn rgb_alpha() {
const P7: [[[u8; 4]; 9]; 3] = include_pnm::include_ppma!("GrayscaleAlpha.p7.pam");
const RGB_ALPHA_P7: [[[u8; 4]; 9]; 3] =
include_pnm::include_ppma!("GrayscaleAlpha_RgbAlpha.p7.pam");
assert_eq!(P7, RGB_ALPHA_P7);
}
#[test]
fn grayscale_alpha16() {
const P7: [[[u16; 2]; 9]; 3] = include_pnm::include_pgma16!("GrayscaleAlpha.p7.pam");
const GRAYSCALE_ALPHA16_P7: [[[u16; 2]; 9]; 3] =
include_pnm::include_pgma16!("GrayscaleAlpha_GrayscaleAlpha16.p7.pam");
assert_eq!(P7, GRAYSCALE_ALPHA16_P7);
}
#[test]
fn rgb_alpha16() {
const P7: [[[u16; 4]; 9]; 3] = include_pnm::include_ppma16!("GrayscaleAlpha.p7.pam");
const RGB_ALPHA16_P7: [[[u16; 4]; 9]; 3] =
include_pnm::include_ppma16!("GrayscaleAlpha_RgbAlpha16.p7.pam");
assert_eq!(P7, RGB_ALPHA16_P7);
}
}
mod rgb {
const EXPECTED: [[[u8; 3]; 9]; 3] = [
[
[0, 0, 0],
[255, 0, 0],
[0, 0, 0],
[255, 255, 0],
[0, 0, 0],
[0, 127, 0],
[0, 255, 0],
[0, 0, 0],
[0, 85, 85],
],
[
[0, 170, 170],
[0, 255, 255],
[0, 0, 0],
[0, 0, 51],
[0, 0, 102],
[0, 0, 153],
[0, 0, 204],
[0, 0, 255],
[0, 0, 0],
],
[
[32, 0, 32],
[64, 0, 64],
[96, 0, 96],
[128, 0, 128],
[159, 0, 159],
[191, 0, 191],
[223, 0, 223],
[255, 0, 255],
[0, 0, 0],
],
];
#[test]
fn rgb() {
const P3: [[[u8; 3]; 9]; 3] = include_pnm::include_ppm!("Rgb.p3.ppm");
const P6: [[[u8; 3]; 9]; 3] = include_pnm::include_ppm!("Rgb.p6.ppm");
const P7: [[[u8; 3]; 9]; 3] = include_pnm::include_ppm!("Rgb.p7.pam");
const PNM: [[[u8; 3]; 9]; 3] = include_pnm::include_pnm!([u8; 3], "Rgb.p7.pam");
assert_eq!(EXPECTED, P3);
assert_eq!(EXPECTED, P6);
assert_eq!(EXPECTED, P7);
assert_eq!(EXPECTED, PNM);
}
#[test]
fn rgb_alpha() {
const P3: [[[u8; 4]; 9]; 3] = include_pnm::include_ppma!("Rgb.p3.ppm");
const RGB_ALPHA_P7: [[[u8; 4]; 9]; 3] = include_pnm::include_ppma!("Rgb_RgbAlpha.p7.pam");
assert_eq!(P3, RGB_ALPHA_P7);
}
#[test]
fn rgb16() {
const P3: [[[u16; 3]; 9]; 3] = include_pnm::include_ppm16!("Rgb.p3.ppm");
const RGB16_P3: [[[u16; 3]; 9]; 3] = include_pnm::include_ppm16!("Rgb_Rgb16.p3.ppm");
const RGB16_P6: [[[u16; 3]; 9]; 3] = include_pnm::include_ppm16!("Rgb_Rgb16.p6.ppm");
const RGB16_P7: [[[u16; 3]; 9]; 3] = include_pnm::include_ppm16!("Rgb_Rgb16.p7.pam");
assert_eq!(P3, RGB16_P3);
assert_eq!(P3, RGB16_P6);
assert_eq!(P3, RGB16_P7);
}
#[test]
fn rgb_alpha16() {
const P3: [[[u16; 4]; 9]; 3] = include_pnm::include_ppma16!("Rgb.p3.ppm");
const RGB_ALPHA16_P7: [[[u16; 4]; 9]; 3] =
include_pnm::include_ppma16!("Rgb_RgbAlpha16.p7.pam");
assert_eq!(P3, RGB_ALPHA16_P7);
}
}
mod rbg_alpha {
const EXPECTED: [[[u8; 4]; 9]; 3] = [
[
[0, 0, 0, 0],
[255, 0, 0, 255],
[0, 0, 0, 0],
[255, 255, 0, 255],
[0, 0, 0, 0],
[0, 127, 0, 255],
[0, 255, 0, 255],
[0, 0, 0, 0],
[0, 85, 85, 255],
],
[
[0, 170, 170, 255],
[0, 255, 255, 255],
[0, 0, 0, 0],
[0, 0, 51, 255],
[0, 0, 102, 255],
[0, 0, 153, 255],
[0, 0, 204, 255],
[0, 0, 255, 255],
[0, 0, 0, 0],
],
[
[32, 0, 32, 255],
[64, 0, 64, 255],
[96, 0, 96, 255],
[128, 0, 128, 255],
[159, 0, 159, 255],
[191, 0, 191, 255],
[223, 0, 223, 255],
[255, 0, 255, 255],
[0, 0, 0, 0],
],
];
#[test]
fn rgb_alpha() {
const P7: [[[u8; 4]; 9]; 3] = include_pnm::include_ppma!("RgbAlpha.p7.pam");
const PNM: [[[u8; 4]; 9]; 3] = include_pnm::include_pnm!([u8; 4], "RgbAlpha.p7.pam");
assert_eq!(EXPECTED, P7);
assert_eq!(EXPECTED, PNM);
}
#[test]
fn rgb_alpha16() {
const P7: [[[u16; 4]; 9]; 3] = include_pnm::include_ppma16!("RgbAlpha.p7.pam");
const RGB_ALPHA16_P7: [[[u16; 4]; 9]; 3] =
include_pnm::include_ppma16!("RgbAlpha_RgbAlpha16.p7.pam");
assert_eq!(P7, RGB_ALPHA16_P7);
}
}
mod grayscale16 {
const EXPECTED: [[u16; 9]; 3] = [
[0, 65535, 0, 65535, 0, 32767, 65535, 0, 21845],
[43690, 65535, 0, 13107, 26214, 39321, 52428, 65535, 0],
[8192, 16384, 24576, 32767, 40959, 49151, 57343, 65535, 0],
];
#[test]
fn grayscale16() {
const P2: [[u16; 9]; 3] = include_pnm::include_pgm16!("Grayscale16.p2.pgm");
const P5: [[u16; 9]; 3] = include_pnm::include_pgm16!("Grayscale16.p5.pgm");
const P7: [[u16; 9]; 3] = include_pnm::include_pgm16!("Grayscale16.p7.pam");
const PNM: [[[u16; 1]; 9]; 3] = include_pnm::include_pnm!([u16; 1], "Grayscale16.p7.pam");
assert_eq!(EXPECTED, P2);
assert_eq!(EXPECTED, P5);
assert_eq!(EXPECTED, P7);
assert_eq!(EXPECTED, PNM.map(|row| row.map(|col| col[0])));
}
#[test]
fn grayscale_alpha16() {
const P2: [[[u16; 2]; 9]; 3] = include_pnm::include_pgma16!("Grayscale16.p2.pgm");
const GRAYSCALE_ALPHA16_P7: [[[u16; 2]; 9]; 3] =
include_pnm::include_pgma16!("Grayscale16_GrayscaleAlpha16.p7.pam");
assert_eq!(P2, GRAYSCALE_ALPHA16_P7);
}
#[test]
fn rgb16() {
const P2: [[[u16; 3]; 9]; 3] = include_pnm::include_ppm16!("Grayscale16.p2.pgm");
const RGB16_P3: [[[u16; 3]; 9]; 3] =
include_pnm::include_ppm16!("Grayscale16_Rgb16.p3.ppm");
const RGB16_P6: [[[u16; 3]; 9]; 3] =
include_pnm::include_ppm16!("Grayscale16_Rgb16.p6.ppm");
const RGB16_P7: [[[u16; 3]; 9]; 3] =
include_pnm::include_ppm16!("Grayscale16_Rgb16.p7.pam");
assert_eq!(P2, RGB16_P3);
assert_eq!(P2, RGB16_P6);
assert_eq!(P2, RGB16_P7);
}
#[test]
fn rgb_alpha16() {
const P2: [[[u16; 4]; 9]; 3] = include_pnm::include_ppma16!("Grayscale16.p2.pgm");
const RGB_ALPHA16_P7: [[[u16; 4]; 9]; 3] =
include_pnm::include_ppma16!("Grayscale16_RgbAlpha16.p7.pam");
assert_eq!(P2, RGB_ALPHA16_P7);
}
}
mod grayscale_alpha16 {
const EXPECTED: [[[u16; 2]; 9]; 3] = [
[
[0, 0],
[65535, 65535],
[0, 0],
[65535, 65535],
[0, 0],
[32767, 65535],
[65535, 65535],
[0, 0],
[21845, 65535],
],
[
[43690, 65535],
[65535, 65535],
[0, 0],
[13107, 65535],
[26214, 65535],
[39321, 65535],
[52428, 65535],
[65535, 65535],
[0, 0],
],
[
[8192, 65535],
[16384, 65535],
[24576, 65535],
[32767, 65535],
[40959, 65535],
[49151, 65535],
[57343, 65535],
[65535, 65535],
[0, 0],
],
];
#[test]
fn grayscale_alpha16() {
const P7: [[[u16; 2]; 9]; 3] = include_pnm::include_pgma16!("GrayscaleAlpha16.p7.pam");
const PNM: [[[u16; 2]; 9]; 3] = include_pnm::include_pnm!([u16; 2], "GrayscaleAlpha16.p7.pam");
assert_eq!(EXPECTED, P7);
assert_eq!(EXPECTED, PNM);
}
#[test]
fn rgb_alpha16() {
const P7: [[[u16; 4]; 9]; 3] = include_pnm::include_ppma16!("GrayscaleAlpha16.p7.pam");
const RGB_ALPHA16_P7: [[[u16; 4]; 9]; 3] =
include_pnm::include_ppma16!("GrayscaleAlpha16_RgbAlpha16.p7.pam");
assert_eq!(P7, RGB_ALPHA16_P7);
}
}
mod rgb16 {
const EXPECTED: [[[u16; 3]; 9]; 3] = [
[
[0, 0, 0],
[65535, 0, 0],
[0, 0, 0],
[65535, 65535, 0],
[0, 0, 0],
[0, 32767, 0],
[0, 65535, 0],
[0, 0, 0],
[0, 21845, 21845],
],
[
[0, 43690, 43690],
[0, 65535, 65535],
[0, 0, 0],
[0, 0, 13107],
[0, 0, 26214],
[0, 0, 39321],
[0, 0, 52428],
[0, 0, 65535],
[0, 0, 0],
],
[
[8192, 0, 8192],
[16384, 0, 16384],
[24576, 0, 24576],
[32767, 0, 32767],
[40959, 0, 40959],
[49151, 0, 49151],
[57343, 0, 57343],
[65535, 0, 65535],
[0, 0, 0],
],
];
#[test]
fn rgb16() {
const P3: [[[u16; 3]; 9]; 3] = include_pnm::include_ppm16!("Rgb16.p3.ppm");
const P6: [[[u16; 3]; 9]; 3] = include_pnm::include_ppm16!("Rgb16.p6.ppm");
const P7: [[[u16; 3]; 9]; 3] = include_pnm::include_ppm16!("Rgb16.p7.pam");
const PNM: [[[u16; 3]; 9]; 3] = include_pnm::include_pnm!([u16; 3], "Rgb16.p7.pam");
assert_eq!(EXPECTED, P3);
assert_eq!(EXPECTED, P6);
assert_eq!(EXPECTED, P7);
assert_eq!(EXPECTED, PNM);
}
#[test]
fn rgb16_alpha() {
const P3: [[[u16; 4]; 9]; 3] = include_pnm::include_ppma16!("Rgb16.p3.ppm");
const RGB_ALPHA16_P7: [[[u16; 4]; 9]; 3] =
include_pnm::include_ppma16!("Rgb16_RgbAlpha16.p7.pam");
assert_eq!(P3, RGB_ALPHA16_P7);
}
}
mod rgb_alpha16 {
const EXPECTED: [[[u16; 4]; 9]; 3] = [
[
[0, 0, 0, 0],
[65535, 0, 0, 65535],
[0, 0, 0, 0],
[65535, 65535, 0, 65535],
[0, 0, 0, 0],
[0, 32767, 0, 65535],
[0, 65535, 0, 65535],
[0, 0, 0, 0],
[0, 21845, 21845, 65535],
],
[
[0, 43690, 43690, 65535],
[0, 65535, 65535, 65535],
[0, 0, 0, 0],
[0, 0, 13107, 65535],
[0, 0, 26214, 65535],
[0, 0, 39321, 65535],
[0, 0, 52428, 65535],
[0, 0, 65535, 65535],
[0, 0, 0, 0],
],
[
[8192, 0, 8192, 65535],
[16384, 0, 16384, 65535],
[24576, 0, 24576, 65535],
[32767, 0, 32767, 65535],
[40959, 0, 40959, 65535],
[49151, 0, 49151, 65535],
[57343, 0, 57343, 65535],
[65535, 0, 65535, 65535],
[0, 0, 0, 0],
],
];
#[test]
fn rgb_alpha16() {
const P7: [[[u16; 4]; 9]; 3] = include_pnm::include_ppma16!("RgbAlpha16.p7.pam");
const PNM: [[[u16; 4]; 9]; 3] = include_pnm::include_pnm!([u16; 4], "RgbAlpha16.p7.pam");
assert_eq!(EXPECTED, P7);
assert_eq!(EXPECTED, PNM);
}
}