From 2752d820446031fa1b9ccd023f9fd1596973b17b Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Sun, 4 Feb 2018 01:11:09 -0600 Subject: [PATCH] Add phaser test --- tests/apple2.dd.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/apple2.dd.c b/tests/apple2.dd.c index f45ffa2..6516611 100644 --- a/tests/apple2.dd.c +++ b/tests/apple2.dd.c @@ -198,4 +198,24 @@ Test(apple2_dd, decode) // in some other capacity /* Test(apple2_dd, save) */ +Test(apple2_dd, phaser) +{ + drive->phase_state = 1; + drive->last_phase = 0; + apple2_dd_phaser(drive); + + cr_assert_eq(drive->track_pos, 1); + cr_assert_eq(drive->last_phase, 1); + + // This shouldn't work--we should stay at the track_pos we begin + // with + drive->phase_state = 0x4; + apple2_dd_phaser(drive); + cr_assert_eq(drive->track_pos, 1); + + // And test that we can go backward + drive->phase_state = 0; + apple2_dd_phaser(drive); + cr_assert_eq(drive->track_pos, 0); +}