Updated for multiple logical disks and added test cases for UniDOS

formatted disks.
This commit is contained in:
Robert Greene 2002-12-14 05:46:03 +00:00
parent 6a59567b16
commit 18e9cd0450

View File

@ -51,11 +51,11 @@ public class DiskHelperTest extends TestCase {
} }
public void testLoadDos33() throws IOException { public void testLoadDos33() throws IOException {
FormattedDisk disk = showDirectory("C:/My Apple2/Disks/DOS 3.3.po"); FormattedDisk[] disks = showDirectory("C:/My Apple2/Disks/DOS 3.3.po");
assertApplesoftFile(disk, "HELLO"); assertApplesoftFile(disks[0], "HELLO");
assertIntegerFile(disk, "ANIMALS"); assertIntegerFile(disks[0], "ANIMALS");
assertTextFile(disk, "APPLE PROMS"); assertTextFile(disks[0], "APPLE PROMS");
assertBinaryFile(disk, "BOOT13"); assertBinaryFile(disks[0], "BOOT13");
} }
public void testLoadMaster() throws IOException { public void testLoadMaster() throws IOException {
@ -67,10 +67,10 @@ public class DiskHelperTest extends TestCase {
} }
public void testLoadProdos() throws IOException { public void testLoadProdos() throws IOException {
FormattedDisk disk = showDirectory("C:/My Apple2/Disks/Prodos.dsk"); FormattedDisk[] disks = showDirectory("C:/My Apple2/Disks/Prodos.dsk");
assertApplesoftFile(disk, "COPY.ME"); assertApplesoftFile(disks[0], "COPY.ME");
assertBinaryFile(disk, "SETTINGS"); assertBinaryFile(disks[0], "SETTINGS");
assertBinaryFile(disk, "PRODOS"); assertBinaryFile(disks[0], "PRODOS");
} }
public void testLoadMarbleMadness() throws IOException { public void testLoadMarbleMadness() throws IOException {
@ -90,11 +90,11 @@ public class DiskHelperTest extends TestCase {
} }
public void testPhan2d1() throws IOException { public void testPhan2d1() throws IOException {
FormattedDisk disk = showDirectory("C:/My Apple2/Disks/phan2d1.dsk"); FormattedDisk[] disks = showDirectory("C:/My Apple2/Disks/phan2d1.dsk");
assertApplesoftFile(disk, "PHANTASIE II"); assertApplesoftFile(disks[0], "PHANTASIE II");
assertBinaryFile(disk, "TWN21"); assertBinaryFile(disks[0], "TWN21");
assertTextFile(disk, "ITEM"); assertTextFile(disks[0], "ITEM");
assertGraphicsFile(disk, "ICE DRAGON"); assertGraphicsFile(disks[0], "ICE DRAGON");
} }
public void testPhan2d2() throws IOException { public void testPhan2d2() throws IOException {
@ -110,29 +110,39 @@ public class DiskHelperTest extends TestCase {
} }
public void testCavernsOfFreitag() throws IOException { public void testCavernsOfFreitag() throws IOException {
FormattedDisk disk = showDirectory("C:/My Apple2/Disks/CavernsOfFreitag.dsk"); FormattedDisk[] disks = showDirectory("C:/My Apple2/Disks/CavernsOfFreitag.dsk");
assertGraphicsFile(disk, "TITLE.PIC"); assertGraphicsFile(disks[0], "TITLE.PIC");
} }
protected FormattedDisk showDirectory(String imageName) throws IOException { public void testUniDosD3110() throws IOException {
showDirectory("C:/My Apple2/Disks/UniDOS/D3110.dsk");
}
public void testUniDosD3151() throws IOException {
showDirectory("C:/My Apple2/Disks/UniDOS/D3151.dsk");
}
protected FormattedDisk[] showDirectory(String imageName) throws IOException {
Disk disk = new Disk(imageName); Disk disk = new Disk(imageName);
FormattedDisk formattedDisk = disk.getFormattedDisk(); FormattedDisk[] formattedDisks = disk.getFormattedDisks();
System.out.println(); for (int i=0; i<formattedDisks.length; i++) {
System.out.println(formattedDisk.getDiskName()); FormattedDisk formattedDisk = formattedDisks[i];
List files = formattedDisk.getFiles(); System.out.println();
if (files != null) { System.out.println(formattedDisk.getDiskName());
showFiles(files, ""); List files = formattedDisk.getFiles();
if (files != null) {
showFiles(files, "");
}
System.out.println(formattedDisk.getFreeSpace() + " bytes free.");
System.out.println(formattedDisk.getUsedSpace() + " bytes used.");
System.out.println("This disk " + (formattedDisk.canHaveDirectories() ? "does" : "does not") +
" support directories.");
System.out.println("This disk is formatted in the " + formattedDisk.getFormat() + " format.");
System.out.println();
showDiskUsage(formattedDisk);
} }
System.out.println(formattedDisk.getFreeSpace() + " bytes free."); return formattedDisks;
System.out.println(formattedDisk.getUsedSpace() + " bytes used.");
System.out.println("This disk " + (formattedDisk.canHaveDirectories() ? "does" : "does not") +
" support directories.");
System.out.println("This disk is formatted in the " + formattedDisk.getFormat() + " format.");
System.out.println();
showDiskUsage(formattedDisk);
return formattedDisk;
} }
protected void showFiles(List files, String indent) { protected void showFiles(List files, String indent) {