aboutsummaryrefslogtreecommitdiff
path: root/lvc/src/bin/test.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lvc/src/bin/test.rs')
-rw-r--r--lvc/src/bin/test.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/lvc/src/bin/test.rs b/lvc/src/bin/test.rs
index 0f630d3..f4e0ed4 100644
--- a/lvc/src/bin/test.rs
+++ b/lvc/src/bin/test.rs
@@ -1,7 +1,7 @@
#[cfg(test)]
mod test {
- use lvc::huff::{read_huffman, write_huffman, BitIO};
+ use lvc::huff::{read_huff, write_huff, BitIO};
use std::io::Cursor;
#[test]
@@ -19,26 +19,27 @@ mod test {
b.wbit(true).unwrap();
b.wbit(true).unwrap();
b.wbit(true).unwrap();
+ b.wbyte(0xff).unwrap();
b.flush().unwrap();
}
{
let mut b = BitIO::new(Cursor::new(&mut buf));
- for _ in 0..9 {
- eprintln!("{:?}", b.rbit().unwrap())
+ for _ in 0..17 {
+ let _v = b.rbit().unwrap();
+ // eprintln!("{:?}", _v)
}
}
}
#[test]
fn test_huff() {
- let a = vec![1; 10000];
+ let a = vec![1, 2, 3, 4, 5, 1, 3, 6, 3, 2, 4, 6, 7, 4, 3, 2, 1, 3, 4];
let mut b = vec![];
let mut buf = Vec::<u8>::new();
- write_huffman(&a, &mut Cursor::new(&mut buf)).unwrap();
- eprintln!("out {buf:x?}");
- read_huffman(&mut Cursor::new(&mut buf), &mut b).unwrap();
-
+ write_huff(&a, &mut Cursor::new(&mut buf)).unwrap();
+ read_huff(&mut Cursor::new(&mut buf), &mut b).unwrap();
+
assert_eq!(a, b)
}
}