31 lines
677 B
OCaml
31 lines
677 B
OCaml
open OUnit2
|
|
|
|
|
|
let test_interrupt _ =
|
|
let input_refs = [
|
|
( 0b00000000, [] );
|
|
( 0b00000001, [ Interrupt.V_Blank ] );
|
|
( 0b00000010, [ Interrupt.LCD_Stat ] );
|
|
( 0b00000100, [ Interrupt.Timer ] );
|
|
( 0b00001000, [ Interrupt.Serial ] );
|
|
( 0b00010000, [ Interrupt.Joypad ] );
|
|
] in
|
|
|
|
let test =
|
|
function ( byte, ref_flags ) ->
|
|
let computed_flags = Interrupt.get_flags byte in
|
|
List.iter2 (fun f1 f2 -> assert_equal f1 f2) ref_flags computed_flags in
|
|
|
|
List.iter test input_refs
|
|
|
|
|
|
(* Name the test cases and group them together *)
|
|
let suite =
|
|
"suite">:::
|
|
[
|
|
"test interrupt parsing">:: test_interrupt
|
|
]
|
|
|
|
let () =
|
|
run_test_tt_main suite
|