Skip to content

Commit 0e9969b

Browse files
CopilotAsakuraMizu
andcommitted
Remove redundant bitmap init tests
Co-authored-by: AsakuraMizu <17076564+AsakuraMizu@users.noreply.github.com>
1 parent 25886e7 commit 0e9969b

File tree

1 file changed

+0
-48
lines changed

1 file changed

+0
-48
lines changed

src/bitmap.rs

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -349,54 +349,6 @@ mod tests {
349349
}
350350
}
351351

352-
#[test]
353-
fn test_init_nonzero_start_address() {
354-
// Test with non-zero start address that fits within capacity.
355-
// With BitAlloc1M in test mode (CAP = 1M pages = 4GB), a small offset
356-
// and 4MB allocation should work fine.
357-
let mut allocator = BitmapPageAllocator::<PAGE_SIZE>::new();
358-
let size = 4 * 1024 * 1024; // 4 MB size
359-
let start_addr = 40960; // non-zero address (10 pages offset from 0)
360-
361-
allocator.init(start_addr, size);
362-
363-
// Verify the allocator is properly initialized
364-
assert_eq!(allocator.total_pages(), size / PAGE_SIZE);
365-
assert_eq!(allocator.used_pages(), 0);
366-
assert_eq!(allocator.available_pages(), size / PAGE_SIZE);
367-
368-
// Test basic allocation
369-
let addr = allocator.alloc_pages(1, PAGE_SIZE).unwrap();
370-
assert_eq!(addr, start_addr);
371-
assert_eq!(allocator.used_pages(), 1);
372-
373-
// Test deallocation
374-
allocator.dealloc_pages(addr, 1);
375-
assert_eq!(allocator.used_pages(), 0);
376-
}
377-
378-
#[test]
379-
fn test_init_with_1gb_aligned_start() {
380-
const SIZE_1G: usize = 1024 * 1024 * 1024;
381-
382-
// Test with 1GB-aligned start address
383-
let mut allocator = BitmapPageAllocator::<PAGE_SIZE>::new();
384-
let size = 4 * 1024 * 1024; // 4 MB
385-
let start_addr = SIZE_1G; // 1GB-aligned
386-
387-
allocator.init(start_addr, size);
388-
389-
// Should still support allocations with various alignments
390-
let addr = allocator.alloc_pages(1, PAGE_SIZE).unwrap();
391-
assert_eq!(addr, start_addr);
392-
allocator.dealloc_pages(addr, 1);
393-
394-
// Test with larger alignment
395-
let addr = allocator.alloc_pages(1, 1024 * 1024).unwrap(); // 1MB alignment
396-
assert_eq!(addr % (1024 * 1024), 0);
397-
allocator.dealloc_pages(addr, 1);
398-
}
399-
400352
#[test]
401353
#[should_panic(expected = "bitmap capacity exceeded")]
402354
fn test_init_capacity_exceeded() {

0 commit comments

Comments
 (0)