Skip to content

Commit 281054d

Browse files
committed
Add a test case involving used()
1 parent df8e527 commit 281054d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

examples/tlsf_integration_test.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ pub type TestTable<'a> = &'a [(fn() -> (), &'static str)];
3333

3434
fn test_global_heap() {
3535
const ELEMS: usize = 250;
36+
assert_eq!(HEAP_SIZE, HEAP.free() + HEAP.used());
37+
let initial_free = HEAP.free();
3638

3739
let mut allocated = LinkedList::new();
3840
for _ in 0..ELEMS {
@@ -51,6 +53,8 @@ fn test_global_heap() {
5153
for i in 0..ELEMS {
5254
assert_eq!(allocated.pop_front().unwrap(), i as i32);
5355
}
56+
assert_eq!(HEAP_SIZE, HEAP.free() + HEAP.used());
57+
assert_eq!(initial_free, HEAP.free());
5458
}
5559

5660
fn test_allocator_api() {

0 commit comments

Comments
 (0)