painter.rs
672 B · rust · 20 lines
1pub use crate::dim::paint;23#[cfg(test)]4mod tests {5 use super::*;6 use crate::two::designs;7 use mrlycore::colors::{BLACK, WHITE};8 #[test]9 fn default_paint_is_black_on_white() {10 let c = paint(designs::carpet(3, 1).unwrap(), None, None);11 let colors = c.cell.colors.as_ref().unwrap();12 assert_eq!(colors[0], [BLACK.r, BLACK.g, BLACK.b, 255]);13 assert_eq!(colors[4], [WHITE.r, WHITE.g, WHITE.b, 255]);14 let blacks = colors15 .iter()16 .filter(|c| **c == [BLACK.r, BLACK.g, BLACK.b, 255])17 .count();18 assert_eq!(blacks as u64, designs::carpet(3, 1).unwrap().types().sum());19 }20}