Skip to content

Commit

Permalink
Add testcase for issue #275
Browse files Browse the repository at this point in the history
  • Loading branch information
weiqiushi committed Jun 14, 2023
1 parent 9eaf33f commit e030188
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/component/cyfs-base/src/objects/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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);
}
}

0 comments on commit e030188

Please sign in to comment.