summaryrefslogtreecommitdiff
path: root/src/tests/bitmap.rs
blob: 9b21b6f6457e67baa297b870beaf1bf35e0a2d5f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use crate::tests::common;

#[test]
fn test_allocate() {
    let mut fs = common::setup();
    for _ in 0..10 {
        fs.data_bitmap.allocate().unwrap();
    }
    assert!(fs.data_bitmap.deallocate(5));
    assert_eq!(fs.data_bitmap.allocate().unwrap(), 5);
    assert_eq!(fs.data_bitmap.allocate().unwrap(), 11);
}

#[test]
fn test_query() {
    let mut fs = common::setup();
    for _ in 0..10 {
        fs.data_bitmap.allocate().unwrap();
    }
    assert_eq!(fs.data_bitmap.query(0), false);
    assert_eq!(fs.data_bitmap.query(5), true);
    assert_eq!(fs.data_bitmap.query(11), false);
}