Skip to content

Commit

Permalink
add test to add & remove an value
Browse files Browse the repository at this point in the history
  • Loading branch information
rezural committed Sep 29, 2021
1 parent 31edb23 commit 6d59978
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/object/contiguous_arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,17 @@ impl<Idx, T> AsMut<[T]> for ContiguousArena<Idx, T> {
&mut self.objects
}
}

#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_add_remove() {
let mut ca: ContiguousArena<Index, usize> = ContiguousArena::new();
let val = 5434;
let h = ca.insert(val);

let out = ca.remove(h);
assert_eq!(out, Some(val));
}
}

0 comments on commit 6d59978

Please sign in to comment.