add test for affine matrix getting

This commit is contained in:
Corwin Kuiper 2021-06-04 22:29:27 +01:00
parent 8867c5c9f1
commit 33738c0f93

View file

@ -344,18 +344,40 @@ impl ObjectControl {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
#[test_case] #[test_case]
fn get_and_release(gba: &mut crate::Gba) { fn get_and_release_object(gba: &mut crate::Gba) {
let gfx = gba.display.video.tiled0(); let gfx = gba.display.video.tiled0();
let objs = gfx.object; let objs = gfx.object;
{ let _o1 = {
let o0 = objs.get_object_standard(); let o0 = objs.get_object_standard();
let o1 = objs.get_object_standard(); let o1 = objs.get_object_standard();
assert_eq!(o0.loan.index, 0); assert_eq!(o0.loan.index, 0);
assert_eq!(o1.loan.index, 1); assert_eq!(o1.loan.index, 1);
} o1
};
let o0 = objs.get_object_standard(); let o0 = objs.get_object_standard();
assert_eq!(o0.loan.index, 0); assert_eq!(o0.loan.index, 0);
let o2 = objs.get_object_affine();
assert_eq!(o2.loan.index, 2);
}
#[test_case]
fn get_and_release_affine(gba: &mut crate::Gba) {
let gfx = gba.display.video.tiled0();
let objs = gfx.object;
let _a1 = {
let a0 = objs.get_affine();
let a1 = objs.get_affine();
assert_eq!(a0.loan.index, 0);
assert_eq!(a1.loan.index, 1);
a1
};
let a0 = objs.get_affine();
assert_eq!(a0.loan.index, 0);
let a2 = objs.get_affine();
assert_eq!(a2.loan.index, 2);
} }
} }