Skip to content

Commit f4a88e0

Browse files
committed
Testing: Added turtle tests and did some reorg
1 parent 911c2ac commit f4a88e0

File tree

6 files changed

+82
-63
lines changed

6 files changed

+82
-63
lines changed

TESTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,12 @@ A documentation of all hardware tests tested on `mizu`.
877877
| win9_b | :x: |
878878
| 000-write_to_x8000 | :x: |
879879

880+
## [TurtleTests]
881+
882+
| Test | State |
883+
| ---------------- | ----- |
884+
| window_y_trigger | :x: |
885+
| window_y_trigger_wx_offscreen | :+1: |
880886

881887
## Extra
882888
These are valuable tests, they come in a single rom, so they were grouped into
@@ -903,4 +909,5 @@ a single table
903909
[bullyGB]: https://github.com/Hacktix/BullyGB
904910
[GBMicrotest]: https://github.com/aappleby/GBMicrotest
905911
[MBC3-Tester]: https://github.com/EricKirschenmann/MBC3-Tester-gb
912+
[TurtleTests]: https://github.com/Powerlated/TurtleTests
906913

mizu-core/src/tests/acid2_test.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

mizu-core/src/tests/mbc3_tester.rs

Lines changed: 0 additions & 25 deletions
This file was deleted.

mizu-core/src/tests/mod.rs

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,29 @@ use super::GameBoyConfig;
77

88
use std::path::Path;
99

10+
enum ClockType {
11+
InfiniteLoop,
12+
Breakpoint,
13+
FrameCount(usize),
14+
}
15+
1016
macro_rules! gb_tests {
1117
// clock until infinite loop
1218
(inf; $($test_name: ident $(for $emu: ident)?, $file_path: expr, $dmg_crc: expr, $cgb_crc: expr;)*) => {
13-
gb_tests!($($test_name $(for $emu)?, $file_path, $dmg_crc, $cgb_crc;)*, clock_until_infinte_loop);
19+
gb_tests!($($test_name $(for $emu)?, $file_path, $dmg_crc, $cgb_crc;)*, super::ClockType::InfiniteLoop);
1420
};
1521

1622
// clock until breakpoint
1723
(brk; $($test_name: ident $(for $emu: ident)?, $file_path: expr, $dmg_crc: expr, $cgb_crc: expr;)*) => {
18-
gb_tests!($($test_name $(for $emu)?, $file_path, $dmg_crc, $cgb_crc;)*, clock_until_breakpoint);
24+
gb_tests!($($test_name $(for $emu)?, $file_path, $dmg_crc, $cgb_crc;)*, super::ClockType::Breakpoint);
25+
};
26+
27+
// clock for a number of frames
28+
(frames $n: expr; $($test_name: ident $(for $emu: ident)?, $file_path: expr, $dmg_crc: expr, $cgb_crc: expr;)*) => {
29+
gb_tests!($($test_name $(for $emu)?, $file_path, $dmg_crc, $cgb_crc;)*, super::ClockType::FrameCount($n));
1930
};
2031

21-
($($test_name: ident $(for $emu: ident)?, $file_path: expr, $dmg_crc: expr, $cgb_crc: expr;)*, $looping_statement: tt) => {
32+
($($test_name: ident $(for $emu: ident)?, $file_path: expr, $dmg_crc: expr, $cgb_crc: expr;)*, $clock_type: expr) => {
2233
$(
2334
/// Run the test and check the checksum of the screen buffer
2435
#[test]
@@ -28,7 +39,19 @@ macro_rules! gb_tests {
2839
fn test(file_path: &str, is_dmg: bool, crc_checksum: u64) {
2940
let mut gb = crate::tests::TestingGameBoy::new(file_path, is_dmg).unwrap();
3041

31-
gb.$looping_statement();
42+
match $clock_type {
43+
super::ClockType::InfiniteLoop => {
44+
gb.clock_until_infinte_loop();
45+
}
46+
super::ClockType::Breakpoint => {
47+
gb.clock_until_breakpoint();
48+
}
49+
super::ClockType::FrameCount(frame_count) => {
50+
for _ in 0..frame_count {
51+
gb.clock_for_frame();
52+
}
53+
}
54+
}
3255

3356
let screen_buffer = gb.raw_screen_buffer();
3457
gb.print_screen_buffer();
@@ -60,15 +83,13 @@ macro_rules! gb_tests {
6083
}
6184

6285
// defined after the macro so that it can use it
63-
mod acid2_test;
6486
mod blargg_tests;
6587
mod gbmicrotest;
66-
mod mbc3_tester;
6788
mod mooneye_tests;
68-
mod rtc3;
6989
mod samesuite_tests;
7090
mod save_state_tests;
7191
mod scribbltests;
92+
mod small_tests;
7293

7394
#[derive(save_state::Savable)]
7495
struct TestingGameBoy {

mizu-core/src/tests/rtc3.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

mizu-core/src/tests/small_tests.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
gb_tests!(
2+
brk; // clock until break
3+
4+
dmg_acid2_test,
5+
"dmg-acid2/dmg-acid2.gb",
6+
13523824884037480967,
7+
13523824884037480967;
8+
9+
cgb_acid2_test for cgb,
10+
"cgb-acid2/cgb-acid2.gbc",
11+
0,
12+
4378550468433865064;
13+
14+
rtc3test_1,
15+
"../rtc3test/rtc3test-1.gb",
16+
5668068657756263343,
17+
13700459787635561240;
18+
19+
rtc3test_2,
20+
"../rtc3test/rtc3test-2.gb",
21+
9943343428460028138,
22+
14288417446659987136;
23+
24+
rtc3test_3,
25+
"../rtc3test/rtc3test-3.gb",
26+
11694994367292180084,
27+
2728978286698242625;
28+
);
29+
30+
gb_tests!(
31+
frames 70; // clock for 70 frames
32+
33+
mbc3_tester,
34+
"mbc3-tester/mbc3-tester.gb",
35+
11138354573804784769,
36+
11138354573804784769;
37+
38+
turtle_window_y_trigger_wx_offscreen,
39+
"turtle-tests/window_y_trigger_wx_offscreen/window_y_trigger_wx_offscreen.gb",
40+
7770242352201540162,
41+
7770242352201540162;
42+
43+
// turtle_window_y_trigger,
44+
// "turtle-tests/window_y_trigger/window_y_trigger.gb",
45+
// 0,
46+
// 0;
47+
);

0 commit comments

Comments
 (0)