mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-22 23:26:33 +11:00
add new test
This commit is contained in:
parent
1d9d6e4ac2
commit
a17b37c2b7
1 changed files with 21 additions and 0 deletions
|
@ -31,3 +31,24 @@ fn write_and_read(_gba: &mut crate::Gba) {
|
||||||
assert_eq!(a.get(62).unwrap(), true, "expect set value to be 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");
|
assert_eq!(a.get(120), None, "expect out of range to give None");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test_case]
|
||||||
|
fn test_everything(_gba: &mut crate::Gba) {
|
||||||
|
for i in 0..64 {
|
||||||
|
let mut a: Bitarray<2> = Bitarray::new();
|
||||||
|
a.set(i, true);
|
||||||
|
for j in 0..64 {
|
||||||
|
let expected = if i == j { true } else { false };
|
||||||
|
assert_eq!(
|
||||||
|
a.get(j).unwrap(),
|
||||||
|
expected,
|
||||||
|
"set index {} and read {}, expected {} but got {}. u32 of this is {:#b}",
|
||||||
|
i,
|
||||||
|
j,
|
||||||
|
expected,
|
||||||
|
a.get(j).unwrap(),
|
||||||
|
a.a[j / 32],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue