Update TypedArena tests
This commit is contained in:
parent
54eb222c40
commit
bf3d40aa7e
3 changed files with 13 additions and 13 deletions
|
@ -500,7 +500,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
pub fn test_unused() {
|
||||
let arena: TypedArena<Point> = TypedArena::new();
|
||||
let arena: TypedArena<Point> = TypedArena::default();
|
||||
assert!(arena.chunks.borrow().is_empty());
|
||||
}
|
||||
|
||||
|
@ -538,7 +538,7 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
let arena = Wrap(TypedArena::new());
|
||||
let arena = Wrap(TypedArena::default());
|
||||
|
||||
let result = arena.alloc_outer(|| Outer {
|
||||
inner: arena.alloc_inner(|| Inner { value: 10 }),
|
||||
|
@ -549,7 +549,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
pub fn test_copy() {
|
||||
let arena = TypedArena::new();
|
||||
let arena = TypedArena::default();
|
||||
for _ in 0..100000 {
|
||||
arena.alloc(Point { x: 1, y: 2, z: 3 });
|
||||
}
|
||||
|
@ -557,7 +557,7 @@ mod tests {
|
|||
|
||||
#[bench]
|
||||
pub fn bench_copy(b: &mut Bencher) {
|
||||
let arena = TypedArena::new();
|
||||
let arena = TypedArena::default();
|
||||
b.iter(|| arena.alloc(Point { x: 1, y: 2, z: 3 }))
|
||||
}
|
||||
|
||||
|
@ -576,7 +576,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
pub fn test_noncopy() {
|
||||
let arena = TypedArena::new();
|
||||
let arena = TypedArena::default();
|
||||
for _ in 0..100000 {
|
||||
arena.alloc(Noncopy {
|
||||
string: "hello world".to_string(),
|
||||
|
@ -587,7 +587,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
pub fn test_typed_arena_zero_sized() {
|
||||
let arena = TypedArena::new();
|
||||
let arena = TypedArena::default();
|
||||
for _ in 0..100000 {
|
||||
arena.alloc(());
|
||||
}
|
||||
|
@ -595,7 +595,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
pub fn test_typed_arena_clear() {
|
||||
let mut arena = TypedArena::new();
|
||||
let mut arena = TypedArena::default();
|
||||
for _ in 0..10 {
|
||||
arena.clear();
|
||||
for _ in 0..10000 {
|
||||
|
@ -620,7 +620,7 @@ mod tests {
|
|||
fn test_typed_arena_drop_count() {
|
||||
let counter = Cell::new(0);
|
||||
{
|
||||
let arena: TypedArena<DropCounter> = TypedArena::new();
|
||||
let arena: TypedArena<DropCounter> = TypedArena::default();
|
||||
for _ in 0..100 {
|
||||
// Allocate something with drop glue to make sure it doesn't leak.
|
||||
arena.alloc(DropCounter { count: &counter });
|
||||
|
@ -632,7 +632,7 @@ mod tests {
|
|||
#[test]
|
||||
fn test_typed_arena_drop_on_clear() {
|
||||
let counter = Cell::new(0);
|
||||
let mut arena: TypedArena<DropCounter> = TypedArena::new();
|
||||
let mut arena: TypedArena<DropCounter> = TypedArena::default();
|
||||
for i in 0..10 {
|
||||
for _ in 0..100 {
|
||||
// Allocate something with drop glue to make sure it doesn't leak.
|
||||
|
@ -659,7 +659,7 @@ mod tests {
|
|||
fn test_typed_arena_drop_small_count() {
|
||||
DROP_COUNTER.with(|c| c.set(0));
|
||||
{
|
||||
let arena: TypedArena<SmallDroppable> = TypedArena::new();
|
||||
let arena: TypedArena<SmallDroppable> = TypedArena::default();
|
||||
for _ in 0..100 {
|
||||
// Allocate something with drop glue to make sure it doesn't leak.
|
||||
arena.alloc(SmallDroppable);
|
||||
|
@ -671,7 +671,7 @@ mod tests {
|
|||
|
||||
#[bench]
|
||||
pub fn bench_noncopy(b: &mut Bencher) {
|
||||
let arena = TypedArena::new();
|
||||
let arena = TypedArena::default();
|
||||
b.iter(|| {
|
||||
arena.alloc(Noncopy {
|
||||
string: "hello world".to_string(),
|
||||
|
|
|
@ -122,6 +122,6 @@ fn f<'a>(arena: &'a TypedArena<C<'a>>) {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let arena = TypedArena::new();
|
||||
let arena = TypedArena::default();
|
||||
f(&arena);
|
||||
} //~^ ERROR `arena` does not live long enough
|
||||
|
|
|
@ -47,7 +47,7 @@ impl<'a> HasId for &'a usize { fn count(&self) -> usize { 1 } }
|
|||
fn f<'a>(_arena: &'a TypedArena<C<'a>>) {}
|
||||
|
||||
fn main() {
|
||||
let arena: TypedArena<C> = TypedArena::new();
|
||||
let arena: TypedArena<C> = TypedArena::default();
|
||||
f(&arena);
|
||||
} //~^ ERROR `arena` does not live long enough
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue