mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-23 03:32:32 +00:00
Added my first failing test: delay is incorrect when resetting outside of the play area.
This commit is contained in:
parent
cd90118a0f
commit
dd17459687
@ -29,6 +29,15 @@ static void receive_line(uint8_t *next_line)
|
||||
std::function<void(uint8_t *)> function = receive_line;
|
||||
_tia.reset(new Atari2600::TIA(function));
|
||||
line = nullptr;
|
||||
|
||||
_tia->set_playfield(0, 0x00);
|
||||
_tia->set_playfield(1, 0x00);
|
||||
_tia->set_playfield(2, 0x00);
|
||||
_tia->set_player_graphic(0, 0x00);
|
||||
_tia->set_player_graphic(1, 0x00);
|
||||
_tia->set_ball_enable(false);
|
||||
_tia->set_missile_enable(0, false);
|
||||
_tia->set_missile_enable(1, false);
|
||||
}
|
||||
|
||||
- (void)testReflectedPlayfield
|
||||
@ -60,8 +69,8 @@ static void receive_line(uint8_t *next_line)
|
||||
_tia->set_playfield(0, 0x10);
|
||||
_tia->set_playfield(1, 0xf0);
|
||||
_tia->set_playfield(2, 0x0e);
|
||||
_tia->run_for_cycles(228);
|
||||
|
||||
_tia->run_for_cycles(228);
|
||||
XCTAssert(line != nullptr, @"228 cycles should have ended the line");
|
||||
|
||||
uint8_t expected_line[] = {
|
||||
@ -75,4 +84,36 @@ static void receive_line(uint8_t *next_line)
|
||||
XCTAssert(!memcmp(expected_line, line, sizeof(expected_line)));
|
||||
}
|
||||
|
||||
- (void)testSinglePlayer
|
||||
{
|
||||
// set a player graphic, reset position so that it'll appear from column 1
|
||||
_tia->set_player_graphic(0, 0xff);
|
||||
_tia->set_player_position(0);
|
||||
|
||||
_tia->run_for_cycles(228);
|
||||
uint8_t first_expected_line[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
XCTAssert(line != nullptr, @"228 cycles should have ended the line");
|
||||
XCTAssert(!memcmp(first_expected_line, line, sizeof(first_expected_line)));
|
||||
line = nullptr;
|
||||
|
||||
_tia->run_for_cycles(228);
|
||||
uint8_t second_expected_line[] = {
|
||||
0, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
XCTAssert(line != nullptr, @"228 cycles should have ended the line");
|
||||
XCTAssert(!memcmp(second_expected_line, line, sizeof(second_expected_line)));
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user