implement_memory_manager_tests

Macro implement_memory_manager_tests 

Source
macro_rules! implement_memory_manager_tests {
    ($manager:expr) => { ... };
}
Expand description

Macro to implement all memory manager tests for a given ManagerTrait implementation.

This macro generates individual test functions for each test category, making it easy to integrate comprehensive memory manager testing into your test suite.

§Usage

use memory::implement_memory_manager_tests;

mod tests {
    use super::*;
    use memory::{Manager, ManagerTrait};
     
    struct MyAllocator;
    impl ManagerTrait for MyAllocator {
        // ... implementation ...
    }
     
    static ALLOCATOR: MyAllocator = MyAllocator;
     
    implement_memory_manager_tests! {
        Manager::new(&ALLOCATOR)
    }
}

This will generate individual #[test] functions for each test category:

  • test_basic_allocation
  • test_zero_sized_allocation
  • test_aligned_allocation
  • test_allocation_with_capabilities
  • test_deallocation
  • test_reallocation_grow
  • test_reallocation_shrink
  • test_reallocation_same_size
  • test_multiple_allocations
  • test_memory_statistics
  • test_page_size
  • test_cache_flush_operations
  • test_large_allocation
  • test_allocation_pattern