cmm: add color-management module
This commit is contained in:
parent
ed1955d3d1
commit
82085a3858
27 changed files with 1182 additions and 20 deletions
40
src/utils/free_list/tests.rs
Normal file
40
src/utils/free_list/tests.rs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
use crate::utils::free_list::FreeList;
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
let list = FreeList::<u32, 3>::default();
|
||||
for i in 0..4097 {
|
||||
assert_eq!(list.acquire(), i);
|
||||
}
|
||||
list.release(100);
|
||||
assert_eq!(list.acquire(), 100);
|
||||
assert_eq!(list.acquire(), 4097);
|
||||
for i in 1..22 {
|
||||
list.release(i);
|
||||
}
|
||||
for i in 1..22 {
|
||||
assert_eq!(list.acquire(), i);
|
||||
}
|
||||
assert_eq!(list.acquire(), 4098);
|
||||
for i in 64..128 {
|
||||
list.release(i);
|
||||
}
|
||||
for i in 64..128 {
|
||||
assert_eq!(list.acquire(), i);
|
||||
}
|
||||
assert_eq!(list.acquire(), 4099);
|
||||
for i in 0..4100 {
|
||||
list.release(i);
|
||||
}
|
||||
for i in 0..4101 {
|
||||
assert_eq!(list.acquire(), i);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn release_out_of_bounds() {
|
||||
let list = FreeList::<u32, 3>::default();
|
||||
list.acquire();
|
||||
list.release(500);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue