Skip to content

Commit 178875d

Browse files
committed
SPS to tests
1 parent 91e45bc commit 178875d

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

tests/src/block.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#[derive(Debug, PartialEq)]
2+
pub enum Block {
3+
T, J, Z, O, S, L, I, Unknown(u8)
4+
}
5+
6+
impl From<u8> for Block {
7+
fn from(value: u8) -> Self {
8+
match value {
9+
0x2 => Block::T,
10+
0x7 => Block::J,
11+
0x8 => Block::Z,
12+
0xA => Block::O,
13+
0xB => Block::S,
14+
0xE => Block::L,
15+
0x12 => Block::I,
16+
_ => Block::Unknown(value),
17+
}
18+
}
19+
}

tests/src/main.rs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
mod labels;
2-
mod util;
32
mod pushdown;
3+
mod util;
4+
mod block;
45

56
use gumdrop::Options;
67

78
#[derive(Debug, Options)]
89
struct TestOptions {
910
help: bool,
10-
#[options(help="run tests")]
11+
#[options(help = "run tests")]
1112
test: bool,
1213
}
1314

@@ -21,6 +22,24 @@ fn main() {
2122

2223
let mut emu = util::emulator(None);
2324

24-
emu.memory.iram_raw[labels::get("practiseType") as usize] = labels::get("MODE_SEED") as u8;
25+
let seed_0 = 0x88;
26+
let seed_1 = 0x88;
27+
let seed_2 = 0x88;
28+
29+
emu.memory.iram_raw[(labels::get("set_seed_input") + 0) as usize] = seed_0;
30+
emu.memory.iram_raw[(labels::get("set_seed") + 0) as usize] = seed_0;
31+
emu.memory.iram_raw[(labels::get("set_seed_input") + 1) as usize] = seed_1;
32+
emu.memory.iram_raw[(labels::get("set_seed") + 1) as usize] = seed_1;
33+
emu.memory.iram_raw[(labels::get("set_seed_input") + 2) as usize] = seed_2;
34+
emu.memory.iram_raw[(labels::get("set_seed") + 2) as usize] = seed_2;
35+
2536

37+
for i in 0..12 {
38+
emu.registers.pc = labels::get("pickTetriminoSeed");
39+
util::run_to_return(&mut emu, false);
40+
41+
let block: block::Block = emu.memory.iram_raw[labels::get("spawnID") as usize].into();
42+
43+
println!("{:#?}", block);
44+
}
2645
}

0 commit comments

Comments
 (0)