From a48bc05bd00b6626522bede44c498132571a0927 Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Thu, 14 Dec 2017 23:09:32 -0600 Subject: [PATCH] Further testing --- tests/apple2.dd.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/apple2.dd.c b/tests/apple2.dd.c index 39e853b..4203e7b 100644 --- a/tests/apple2.dd.c +++ b/tests/apple2.dd.c @@ -47,3 +47,48 @@ Test(apple2dd, step) apple2dd_step(drive, -1000); cr_assert_eq(drive->track_pos, 0); } + +Test(apple2dd, set_mode) +{ + apple2dd_set_mode(drive, DD_WRITE); + cr_assert_eq(drive->mode, DD_WRITE); + apple2dd_set_mode(drive, DD_READ); + cr_assert_eq(drive->mode, DD_READ); + + // let's try shenanigans + apple2dd_set_mode(drive, 111111111); + cr_assert_eq(drive->mode, DD_READ); +} + +Test(apple2dd, turn_on) +{ + apple2dd_turn_on(drive, true); + cr_assert(drive->online); + apple2dd_turn_on(drive, false); + cr_assert(!drive->online); + + // I mean, ok + apple2dd_turn_on(drive, 1111333); + cr_assert(drive->online); +} + +Test(apple2dd, write_protect) +{ + apple2dd_write_protect(drive, true); + cr_assert(drive->write_protect); + apple2dd_write_protect(drive, false); + cr_assert(!drive->write_protect); + apple2dd_write_protect(drive, 2222); + cr_assert(drive->write_protect); +} + +Test(apple2dd, position) +{ + // Without any data, the drive should return a null position + // regardless of track position + drive->track_pos = 3; + drive->sector_pos = 44; + cr_assert_eq(apple2dd_position(drive), 0); + + // FIXME: we need some dummy data for the drive... +}