add tests

This commit is contained in:
Corwin Kuiper 2021-06-04 18:35:49 +01:00
parent 8bf59e0f20
commit c208b6528a

View file

@ -22,3 +22,12 @@ impl<const N: usize> Bitarray<N> {
self.a[index / N] = self.a[index / N] & !mask | value_mask
}
}
#[test_case]
fn write_and_read(_gba: &mut crate::Gba) {
let mut a: Bitarray<2> = Bitarray::new();
assert_eq!(a.get(55).unwrap(), false, "expect unset values to be false");
a.set(62, true);
assert_eq!(a.get(62).unwrap(), true, "expect set value to be true");
assert_eq!(a.get(120), None, "expect out of range to give None");
}