diff options
Diffstat (limited to 'libhitomezashi/src/lib.rs')
-rw-r--r-- | libhitomezashi/src/lib.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/libhitomezashi/src/lib.rs b/libhitomezashi/src/lib.rs index b07057a..c2f302e 100644 --- a/libhitomezashi/src/lib.rs +++ b/libhitomezashi/src/lib.rs @@ -1,5 +1,5 @@ mod pixel_buffer; -pub use bitvec::vec::BitVec; +use bitvec::prelude::*; use pixel_buffer::PixelBuffer; pub fn get_hitomezashi_pattern( @@ -52,12 +52,10 @@ mod tests { #[test] fn test() { - let mut x_pattern = BitVec::new(); - x_pattern.resize(40, false); - x_pattern.set(1, true); - let mut y_pattern = BitVec::new(); - y_pattern.resize(40, false); - y_pattern.set(1, true); - println!("{}", get_hitomezashi_pattern(x_pattern, y_pattern, 3, 1)); + let x_pattern = bitvec![1, 1, 0, 1, 1, 1]; + let y_pattern = bitvec![0, 1, 1, 0, 0, 0]; + let result = format!("{}", get_hitomezashi_pattern(x_pattern, y_pattern, 3, 1)); + println!("{}", result); + assert!(result == "███ ███ ███ \n █ \n █ \n█ ████ ████ ███\n█ █ █ █ █ \n█ █ █ █ █ \n ████ ████ ███\n █ \n █ \n████ ████ ████ \n█ █ █ █ █ \n█ █ █ █ █ \n████ ████ ████ \n █ \n █ \n████ ████ ████ \n█ █ █ █ █ \n█ █ █ █ █ \n") } } |