Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Dzejkop committed Apr 11, 2024
1 parent 89eed2e commit 35e434e
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/generic_storage/mmap_vec.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use std::{
fs::{File, OpenOptions},
ops::{Deref, DerefMut},
path::Path,
};
use std::fs::{File, OpenOptions};
use std::ops::{Deref, DerefMut};
use std::path::Path;

use bytemuck::Pod;
use color_eyre::eyre::bail;
Expand Down Expand Up @@ -242,17 +240,29 @@ mod tests {
#[test]
fn test_mmap_vec() {
let f = tempfile::tempfile().unwrap();

let mut storage: MmapVec<u32> = unsafe { MmapVec::create(f.try_clone().unwrap()).unwrap() };

println!("{storage:?}");
storage.resize(2);
println!("{storage:?}");

storage.push(u32::MAX);
println!("{storage:?}");
storage.push(2);
println!("{storage:?}");

storage.resize(4);
println!("{storage:?}");

storage.push(42);
println!("{storage:?}");
storage.push(4);
println!("{storage:?}");

assert_eq!(storage.len(), 4);

println!("{storage:?}");
assert_eq!(storage[0], u32::MAX);
assert_eq!(storage[1], 2);
assert_eq!(storage[2], 42);
Expand Down

0 comments on commit 35e434e

Please sign in to comment.