Skip to content

Commit

Permalink
update format
Browse files Browse the repository at this point in the history
Signed-off-by: ylzh10 <[email protected]>
  • Loading branch information
ylzh10 committed Feb 18, 2025
1 parent a7f91c7 commit 5d5d67c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

### Added

- Added `available()` API in `AddressAllocator` to allow getting the
available memories after `allocate/free()`s
- Added `available()` API in `AddressAllocator` to allow
getting the available memories after `allocate/free()`s

### Changed
### Fixed
Expand Down
6 changes: 3 additions & 3 deletions src/address_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,17 +250,17 @@ mod tests {
fn test_tree_allocate_address_free_and_realloc() {
let mut pool = AddressAllocator::new(0x1000, 0x1000).unwrap();
assert_eq!(pool.available(), 0x1000);

// Allocate 0x800
assert_eq!(
pool.allocate(0x800, 0x100, AllocPolicy::FirstMatch)
.unwrap(),
RangeInclusive::new(0x1000, 0x17FF).unwrap()
);
assert_eq!(pool.available(), 0x1000 - 0x800);

// Free 0x800
let _ = pool.free(&RangeInclusive::new(0x1000, 0x17FF).unwrap());
assert_eq!(pool.available(), 0x1000);

// Allocate 0x800 again
assert_eq!(
pool.allocate(0x800, 0x100, AllocPolicy::FirstMatch)
.unwrap(),
Expand Down

0 comments on commit 5d5d67c

Please sign in to comment.