From 5fcb91bb16cc6fd1fec6fe5aba3fde0d3f760f62 Mon Sep 17 00:00:00 2001 From: Blindspot22 Date: Wed, 7 Aug 2024 09:05:20 +0100 Subject: [PATCH] updated test for heap allocation --- tests/heap_allocation.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/heap_allocation.rs b/tests/heap_allocation.rs index 8e8f6c7..4b15401 100644 --- a/tests/heap_allocation.rs +++ b/tests/heap_allocation.rs @@ -61,3 +61,13 @@ fn many_boxes() { assert_eq!(*x, i); } } + +#[test_case] +fn many_boxes_long_lived() { + let long_lived = Box::new(1); // new + for i in 0..HEAP_SIZE { + let x = Box::new(i); + assert_eq!(*x, i); + } + assert_eq!(*long_lived, 1); // new +} \ No newline at end of file