Skip to content

Commit

Permalink
Uncomment test_schunk_basic
Browse files Browse the repository at this point in the history
  • Loading branch information
milesgranger committed Apr 6, 2024
1 parent f4d550e commit f5dd6b6
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1852,38 +1852,38 @@ mod tests {
Ok(())
}

// #[test]
// fn test_schunk_basic() -> Result<()> {
// let input = b"some data";
// let storage = schunk::Storage::default()
// .set_contiguous(true)
// .set_cparams(&mut CParams::from(&input[0]))
// .set_dparams(&mut DParams::default());
// let mut schunk = schunk::SChunk::new(storage);
#[test]
fn test_schunk_basic() -> Result<()> {
let input = b"some data";
let storage = schunk::Storage::default()
.set_contiguous(true)
.set_cparams(&mut CParams::from(&input[0]))
.set_dparams(&mut DParams::default());
let mut schunk = schunk::SChunk::new(storage);

// assert!(schunk.is_contiguous());
// assert_eq!(schunk.typesize(), 1);
// assert!(schunk.path().is_none());
assert!(schunk.is_contiguous());
assert_eq!(schunk.typesize(), 1);
assert!(schunk.path().is_none());

// let mut decompressed = vec![0u8; input.len()];
let mut decompressed = vec![0u8; input.len()];

// let n = schunk.append_buffer(input)?;
// schunk.decompress_chunk(n - 1, &mut decompressed)?;
// assert_eq!(input, decompressed.as_slice());
let n = schunk.append_buffer(input)?;
schunk.decompress_chunk(n - 1, &mut decompressed)?;
assert_eq!(input, decompressed.as_slice());

// {
// // ensure clone then drop doesn't free the schunk ptr, original still needs is
// let _cloned = schunk.clone();
// }
// assert_eq!(schunk.n_chunks(), 1);
{
// ensure clone then drop doesn't free the schunk ptr, original still needs is
let _cloned = schunk.clone();
}
assert_eq!(schunk.n_chunks(), 1);

// // Reconstruct thru vec
// let v = schunk.into_vec()?;
// schunk = schunk::SChunk::from_vec(v)?;
// assert_eq!(schunk.n_chunks(), 1);
// Reconstruct thru vec
let v = schunk.into_vec()?;
schunk = schunk::SChunk::from_vec(v)?;
assert_eq!(schunk.n_chunks(), 1);

// Ok(())
// }
Ok(())
}

// #[test]
// fn test_schunk_write() -> Result<()> {
Expand Down

0 comments on commit f5dd6b6

Please sign in to comment.