1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-11-01 04:04:28 +00:00

Add tests for read/write

This commit is contained in:
Peter Evans 2017-12-15 21:01:49 -06:00
parent 4cc79b1ba8
commit 047d9eabd0

View File

@ -133,3 +133,33 @@ Test(apple2dd, shift)
// this should be the mod of sector_pos and MAX_SECTOR_POS
cr_assert_eq(drive->sector_pos, 7);
}
Test(apple2dd, read_byte)
{
drive->data = vm_segment_create(_140K_);
vm_segment_set(drive->data, 0, 123);
vm_segment_set(drive->data, 1, 234);
cr_assert_eq(apple2dd_read_byte(drive), 123);
cr_assert_eq(drive->track_pos, 0);
cr_assert_eq(drive->sector_pos, 1);
cr_assert_eq(apple2dd_read_byte(drive), 234);
cr_assert_eq(drive->track_pos, 0);
cr_assert_eq(drive->sector_pos, 2);
}
Test(apple2dd, write_byte)
{
drive->data = vm_segment_create(_140K_);
apple2dd_write_byte(drive, 123);
cr_assert_eq(vm_segment_get(drive->data, 0), 123);
cr_assert_eq(drive->track_pos, 0);
cr_assert_eq(drive->sector_pos, 1);
apple2dd_write_byte(drive, 234);
cr_assert_eq(vm_segment_get(drive->data, 1), 234);
cr_assert_eq(drive->track_pos, 0);
cr_assert_eq(drive->sector_pos, 2);
}