diff --git a/src/component/cyfs-base/src/objects/chunk.rs b/src/component/cyfs-base/src/objects/chunk.rs index 3f5730e6..7bb5f378 100644 --- a/src/component/cyfs-base/src/objects/chunk.rs +++ b/src/component/cyfs-base/src/objects/chunk.rs @@ -422,6 +422,7 @@ mod test { use std::convert::TryFrom; use std::str::FromStr; use generic_array::typenum::{marker_traits::Unsigned, U32}; + use rand::RngCore; #[test] fn chunk() { @@ -448,4 +449,15 @@ mod test { assert_eq!(U32::to_usize(), 32); } + + #[test] + fn chunk2() { + let mut chunk_data = [0u8;1024*1024]; + let chunk_len = chunk_data.len(); + rand::thread_rng().fill_bytes(&mut chunk_data); + let chunk_hash = hash_data(&chunk_data); + println!("{:?}", chunk_hash); + let chunkid = ChunkId::new(&chunk_hash, chunk_len as u32); + println!("{:?}", chunkid); + } }