44 lines
927 B
Rust
44 lines
927 B
Rust
use maraiah::{durandal::image::Color8, marathon::{machdr, pict}};
|
|
|
|
include!("data/rand.rs");
|
|
|
|
#[test]
|
|
fn get_clut_must_process()
|
|
{
|
|
const INPUT: &[u8] = include_bytes!("data/clut.in");
|
|
const OUTPUT: [Color8; 256] = include!("data/clut.out");
|
|
|
|
assert_eq!(pict::get_clut(INPUT).unwrap(), (OUTPUT.to_vec(), 2056));
|
|
}
|
|
|
|
#[test]
|
|
fn get_clut_must_not_process()
|
|
{
|
|
for inp in &RANDOM {
|
|
assert!(pict::get_clut(inp).is_err());
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn machdr_must_process()
|
|
{
|
|
const INPUT: &[u8] = include_bytes!("data/macbin.in");
|
|
|
|
assert_eq!(machdr::check_macbin(INPUT), Some(128));
|
|
assert_eq!(machdr::try_mac_header(INPUT), 128);
|
|
|
|
// TODO: missing test data for applesingle
|
|
}
|
|
|
|
#[test]
|
|
fn machdr_must_not_process()
|
|
{
|
|
for inp in &RANDOM {
|
|
assert_eq!(machdr::check_macbin(inp), None);
|
|
assert_eq!(machdr::check_apple_single(inp), None);
|
|
assert_eq!(machdr::try_mac_header(inp), 0);
|
|
}
|
|
}
|
|
|
|
// EOF
|