Switching unit tests to JUnit 4. #12

This commit is contained in:
Rob Greene 2018-03-03 11:42:26 -06:00
parent da3f22aa47
commit dcc2aa4d9e
6 changed files with 79 additions and 81 deletions

View File

@ -21,7 +21,7 @@ package com.webcodepro.applecommander.compiler;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import junit.framework.TestCase; import org.junit.Test;
import com.webcodepro.applecommander.storage.Disk; import com.webcodepro.applecommander.storage.Disk;
import com.webcodepro.applecommander.storage.FileEntry; import com.webcodepro.applecommander.storage.FileEntry;
@ -32,20 +32,10 @@ import com.webcodepro.applecommander.testconfig.TestConfig;
* Test the ApplesoftCompiler. * Test the ApplesoftCompiler.
* @author Rob * @author Rob
*/ */
public class ApplesoftCompilerTest extends TestCase { public class ApplesoftCompilerTest {
private TestConfig config = TestConfig.getInstance(); private TestConfig config = TestConfig.getInstance();
/**
* Constructor for ApplesoftCompilerTest.
* @param arg0
*/
public ApplesoftCompilerTest(String arg0) {
super(arg0);
}
public static void main(String[] args) {
junit.textui.TestRunner.run(ApplesoftCompilerTest.class);
}
@Test
public void testCompileColors() throws Exception { public void testCompileColors() throws Exception {
DosFormatDisk disk = (DosFormatDisk) DosFormatDisk disk = (DosFormatDisk)
new Disk(config.getDiskDir() + "/MASTER.DSK").getFormattedDisks()[0]; //$NON-NLS-1$ new Disk(config.getDiskDir() + "/MASTER.DSK").getFormattedDisks()[0]; //$NON-NLS-1$

View File

@ -19,10 +19,13 @@
*/ */
package com.webcodepro.applecommander.storage; package com.webcodepro.applecommander.storage;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import junit.framework.TestCase; import org.junit.Test;
import com.webcodepro.applecommander.storage.FormattedDisk.DiskUsage; import com.webcodepro.applecommander.storage.FormattedDisk.DiskUsage;
import com.webcodepro.applecommander.storage.filters.ApplesoftFileFilter; import com.webcodepro.applecommander.storage.filters.ApplesoftFileFilter;
@ -38,17 +41,10 @@ import com.webcodepro.applecommander.testconfig.TestConfig;
* Date created: Oct 3, 2002 11:35:26 PM * Date created: Oct 3, 2002 11:35:26 PM
* @author Rob Greene * @author Rob Greene
*/ */
public class DiskHelperTest extends TestCase { public class DiskHelperTest {
private TestConfig config = TestConfig.getInstance(); private TestConfig config = TestConfig.getInstance();
public DiskHelperTest(String name) { @Test
super(name);
}
public static void main(String[] args) {
junit.textui.TestRunner.run(DiskHelperTest.class);
}
public void testLoadDos33() throws IOException, DiskException { public void testLoadDos33() throws IOException, DiskException {
FormattedDisk[] disks = showDirectory(config.getDiskDir() + FormattedDisk[] disks = showDirectory(config.getDiskDir() +
"/DOS 3.3.po"); //$NON-NLS-1$ "/DOS 3.3.po"); //$NON-NLS-1$
@ -58,14 +54,17 @@ public class DiskHelperTest extends TestCase {
assertBinaryFile(disks[0], "BOOT13"); //$NON-NLS-1$ assertBinaryFile(disks[0], "BOOT13"); //$NON-NLS-1$
} }
@Test
public void testLoadMaster() throws IOException, DiskException { public void testLoadMaster() throws IOException, DiskException {
showDirectory(config.getDiskDir() + "/MASTER.DSK"); //$NON-NLS-1$ showDirectory(config.getDiskDir() + "/MASTER.DSK"); //$NON-NLS-1$
} }
@Test
public void testLoadGalacticAttack1() throws IOException, DiskException { public void testLoadGalacticAttack1() throws IOException, DiskException {
showDirectory(config.getDiskDir() + "/galatt.dsk"); //$NON-NLS-1$ showDirectory(config.getDiskDir() + "/galatt.dsk"); //$NON-NLS-1$
} }
@Test
public void testLoadProdos() throws IOException, DiskException { public void testLoadProdos() throws IOException, DiskException {
FormattedDisk[] disks = showDirectory(config.getDiskDir() + "/Prodos.dsk"); //$NON-NLS-1$ FormattedDisk[] disks = showDirectory(config.getDiskDir() + "/Prodos.dsk"); //$NON-NLS-1$
assertApplesoftFile(disks[0], "COPY.ME"); //$NON-NLS-1$ assertApplesoftFile(disks[0], "COPY.ME"); //$NON-NLS-1$
@ -73,19 +72,23 @@ public class DiskHelperTest extends TestCase {
assertBinaryFile(disks[0], "PRODOS"); //$NON-NLS-1$ assertBinaryFile(disks[0], "PRODOS"); //$NON-NLS-1$
} }
@Test
public void testLoadMarbleMadness() throws IOException, DiskException { public void testLoadMarbleMadness() throws IOException, DiskException {
showDirectory(config.getDiskDir() showDirectory(config.getDiskDir()
+ "/Marble Madness (1985)(Electronic Arts).2mg"); //$NON-NLS-1$ + "/Marble Madness (1985)(Electronic Arts).2mg"); //$NON-NLS-1$
} }
@Test
public void testRdosBoot() throws IOException, DiskException { public void testRdosBoot() throws IOException, DiskException {
showDirectory(config.getDiskDir() + "/RDOSboot.dsk"); //$NON-NLS-1$ showDirectory(config.getDiskDir() + "/RDOSboot.dsk"); //$NON-NLS-1$
} }
@Test
public void testSsiSave() throws IOException, DiskException { public void testSsiSave() throws IOException, DiskException {
showDirectory(config.getDiskDir() + "/SSIsave.dsk"); //$NON-NLS-1$ showDirectory(config.getDiskDir() + "/SSIsave.dsk"); //$NON-NLS-1$
} }
@Test
public void testPhan2d1() throws IOException, DiskException { public void testPhan2d1() throws IOException, DiskException {
FormattedDisk[] disks = showDirectory(config.getDiskDir() FormattedDisk[] disks = showDirectory(config.getDiskDir()
+ "/phan2d1.dsk"); //$NON-NLS-1$ + "/phan2d1.dsk"); //$NON-NLS-1$
@ -95,29 +98,35 @@ public class DiskHelperTest extends TestCase {
assertGraphicsFile(disks[0], "ICE DRAGON"); //$NON-NLS-1$ assertGraphicsFile(disks[0], "ICE DRAGON"); //$NON-NLS-1$
} }
@Test
public void testPhan2d2() throws IOException, DiskException { public void testPhan2d2() throws IOException, DiskException {
showDirectory(config.getDiskDir() + "/phan2d2.dsk"); //$NON-NLS-1$ showDirectory(config.getDiskDir() + "/phan2d2.dsk"); //$NON-NLS-1$
} }
@Test
public void testPhantasie1() throws IOException, DiskException { public void testPhantasie1() throws IOException, DiskException {
showDirectory(config.getDiskDir() + "/Phantasie1.dsk"); //$NON-NLS-1$ showDirectory(config.getDiskDir() + "/Phantasie1.dsk"); //$NON-NLS-1$
} }
@Test
public void testPhantasie2() throws IOException, DiskException { public void testPhantasie2() throws IOException, DiskException {
showDirectory(config.getDiskDir() + "/Phantasie2.dsk"); //$NON-NLS-1$ showDirectory(config.getDiskDir() + "/Phantasie2.dsk"); //$NON-NLS-1$
} }
@Test
public void testCavernsOfFreitag() throws IOException, DiskException { public void testCavernsOfFreitag() throws IOException, DiskException {
FormattedDisk[] disks = showDirectory(config.getDiskDir() FormattedDisk[] disks = showDirectory(config.getDiskDir()
+ "/CavernsOfFreitag.dsk"); //$NON-NLS-1$ + "/CavernsOfFreitag.dsk"); //$NON-NLS-1$
assertGraphicsFile(disks[0], "TITLE.PIC"); //$NON-NLS-1$ assertGraphicsFile(disks[0], "TITLE.PIC"); //$NON-NLS-1$
} }
@Test
public void testUniDosD3110() throws IOException, DiskException { public void testUniDosD3110() throws IOException, DiskException {
showDirectory(config.getDiskDir() showDirectory(config.getDiskDir()
+ "/D3110.dsk"); //$NON-NLS-1$ + "/D3110.dsk"); //$NON-NLS-1$
} }
@Test
public void testUniDosD3151() throws IOException, DiskException { public void testUniDosD3151() throws IOException, DiskException {
showDirectory(config.getDiskDir() showDirectory(config.getDiskDir()
+ "/D3151.dsk"); //$NON-NLS-1$ + "/D3151.dsk"); //$NON-NLS-1$

View File

@ -19,10 +19,13 @@
*/ */
package com.webcodepro.applecommander.storage; package com.webcodepro.applecommander.storage;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import junit.framework.TestCase; import org.junit.Test;
import com.webcodepro.applecommander.storage.FormattedDisk.DiskUsage; import com.webcodepro.applecommander.storage.FormattedDisk.DiskUsage;
import com.webcodepro.applecommander.storage.os.dos33.DosFormatDisk; import com.webcodepro.applecommander.storage.os.dos33.DosFormatDisk;
@ -42,30 +45,17 @@ import com.webcodepro.applecommander.storage.physical.ProdosOrder;
* Date created: Oct 3, 2002 11:35:26 PM * Date created: Oct 3, 2002 11:35:26 PM
* @author Rob Greene * @author Rob Greene
*/ */
public class DiskWriterTest extends TestCase { public class DiskWriterTest {
/** /**
* Determine if the created disk images should be saved for later * Determine if the created disk images should be saved for later
* perusal. * perusal.
*/ */
private boolean saveImage = false; private boolean saveImage = false;
/**
* Create the DiskWriterTest.
*/
public DiskWriterTest(String name) {
super(name);
}
/**
* Run the test in text mode.
*/
public static void main(String[] args) {
junit.textui.TestRunner.run(DiskWriterTest.class);
}
/** /**
* Test writing and reading random files to a DOS 3.3 140K disk. * Test writing and reading random files to a DOS 3.3 140K disk.
*/ */
@Test
public void testWriteToDos33() throws IOException, DiskException { public void testWriteToDos33() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
ImageOrder imageOrder = new DosOrder(imageLayout); ImageOrder imageOrder = new DosOrder(imageLayout);
@ -77,6 +67,7 @@ public class DiskWriterTest extends TestCase {
/** /**
* Test writing and reading random files to a DOS 3.3 140K nibbilized disk. * Test writing and reading random files to a DOS 3.3 140K nibbilized disk.
*/ */
@Test
public void testWriteToDos33Nibble() throws IOException, DiskException { public void testWriteToDos33Nibble() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_NIBBLE_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_NIBBLE_DISK);
ImageOrder imageOrder = new NibbleOrder(imageLayout); ImageOrder imageOrder = new NibbleOrder(imageLayout);
@ -88,6 +79,7 @@ public class DiskWriterTest extends TestCase {
/** /**
* Test writing and reading random files to a ProDOS 140K disk. * Test writing and reading random files to a ProDOS 140K disk.
*/ */
@Test
public void testWriteToPascal140kDisk() throws IOException, DiskException { public void testWriteToPascal140kDisk() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
ImageOrder imageOrder = new ProdosOrder(imageLayout); ImageOrder imageOrder = new ProdosOrder(imageLayout);
@ -100,6 +92,7 @@ public class DiskWriterTest extends TestCase {
/** /**
* Test writing and reading random files to a ProDOS 140K disk. * Test writing and reading random files to a ProDOS 140K disk.
*/ */
@Test
public void testWriteToPascal800kDisk() throws DiskFullException, IOException { public void testWriteToPascal800kDisk() throws DiskFullException, IOException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
ImageOrder imageOrder = new ProdosOrder(imageLayout); ImageOrder imageOrder = new ProdosOrder(imageLayout);
@ -112,6 +105,7 @@ public class DiskWriterTest extends TestCase {
/** /**
* Test writing and reading random files to a ProDOS 140K disk. * Test writing and reading random files to a ProDOS 140K disk.
*/ */
@Test
public void testWriteToProdos140kDisk() throws IOException, DiskException { public void testWriteToProdos140kDisk() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
ImageOrder imageOrder = new ProdosOrder(imageLayout); ImageOrder imageOrder = new ProdosOrder(imageLayout);
@ -124,6 +118,7 @@ public class DiskWriterTest extends TestCase {
/** /**
* Test writing and reading random files to a ProDOS 800K disk. * Test writing and reading random files to a ProDOS 800K disk.
*/ */
@Test
public void testWriteToProdos800kDisk() throws IOException, DiskException { public void testWriteToProdos800kDisk() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
ImageOrder imageOrder = new ProdosOrder(imageLayout); ImageOrder imageOrder = new ProdosOrder(imageLayout);
@ -136,6 +131,7 @@ public class DiskWriterTest extends TestCase {
/** /**
* Test writing and reading random files to a ProDOS 5MB disk. * Test writing and reading random files to a ProDOS 5MB disk.
*/ */
@Test
public void testWriteToProdos5mbDisk() throws IOException, DiskException { public void testWriteToProdos5mbDisk() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_5MB_HARDDISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_5MB_HARDDISK);
ImageOrder imageOrder = new ProdosOrder(imageLayout); ImageOrder imageOrder = new ProdosOrder(imageLayout);
@ -148,6 +144,7 @@ public class DiskWriterTest extends TestCase {
/** /**
* Test creating and deleting many files on a DOS 3.3 140K disk. * Test creating and deleting many files on a DOS 3.3 140K disk.
*/ */
@Test
public void testCreateAndDeleteDos33() throws IOException, DiskException { public void testCreateAndDeleteDos33() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
ImageOrder imageOrder = new DosOrder(imageLayout); ImageOrder imageOrder = new DosOrder(imageLayout);
@ -160,6 +157,7 @@ public class DiskWriterTest extends TestCase {
/** /**
* Test creating and deleting many files on an OzDOS 800K disk. * Test creating and deleting many files on an OzDOS 800K disk.
*/ */
@Test
public void testCreateAndDeleteOzDos() throws IOException, DiskException { public void testCreateAndDeleteOzDos() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
ImageOrder imageOrder = new ProdosOrder(imageLayout); ImageOrder imageOrder = new ProdosOrder(imageLayout);
@ -172,6 +170,7 @@ public class DiskWriterTest extends TestCase {
/** /**
* Test creating and deleting many files on a UniDOS 800K disk. * Test creating and deleting many files on a UniDOS 800K disk.
*/ */
@Test
public void testCreateAndDeleteUniDos() throws IOException, DiskException { public void testCreateAndDeleteUniDos() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
ImageOrder imageOrder = new DosOrder(imageLayout); ImageOrder imageOrder = new DosOrder(imageLayout);
@ -184,6 +183,7 @@ public class DiskWriterTest extends TestCase {
/** /**
* Test creating and deleting many files on a Pascal 140K disk. * Test creating and deleting many files on a Pascal 140K disk.
*/ */
@Test
public void testCreateAndDeletePascal140kDisk() throws IOException, DiskException { public void testCreateAndDeletePascal140kDisk() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
ImageOrder imageOrder = new ProdosOrder(imageLayout); ImageOrder imageOrder = new ProdosOrder(imageLayout);
@ -197,6 +197,7 @@ public class DiskWriterTest extends TestCase {
/** /**
* Test creating and deleting many files on a Pascal 800K disk. * Test creating and deleting many files on a Pascal 800K disk.
*/ */
@Test
public void testCreateAndDeletePascal800kDisk() throws IOException, DiskException { public void testCreateAndDeletePascal800kDisk() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
ImageOrder imageOrder = new ProdosOrder(imageLayout); ImageOrder imageOrder = new ProdosOrder(imageLayout);
@ -210,6 +211,7 @@ public class DiskWriterTest extends TestCase {
/** /**
* Test creating and deleting many files on a ProDOS 140K disk. * Test creating and deleting many files on a ProDOS 140K disk.
*/ */
@Test
public void testCreateAndDeleteProdos140kDisk() throws IOException, DiskException { public void testCreateAndDeleteProdos140kDisk() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
ImageOrder imageOrder = new DosOrder(imageLayout); ImageOrder imageOrder = new DosOrder(imageLayout);
@ -223,6 +225,7 @@ public class DiskWriterTest extends TestCase {
/** /**
* Test creating and deleting many files on a ProDOS 800K disk. * Test creating and deleting many files on a ProDOS 800K disk.
*/ */
@Test
public void testCreateAndDeleteProdos800kDisk() throws IOException, DiskException { public void testCreateAndDeleteProdos800kDisk() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
ImageOrder imageOrder = new ProdosOrder(imageLayout); ImageOrder imageOrder = new ProdosOrder(imageLayout);
@ -237,8 +240,8 @@ public class DiskWriterTest extends TestCase {
* Test creating, deleting, and then creating another file which re-uses * Test creating, deleting, and then creating another file which re-uses
* the old directory entry on a DOS 3.3 140K disk. * the old directory entry on a DOS 3.3 140K disk.
*/ */
public void testCreateDeleteCreateDosDisk() @Test
throws IOException, DiskException { public void testCreateDeleteCreateDosDisk() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
ImageOrder imageOrder = new DosOrder(imageLayout); ImageOrder imageOrder = new DosOrder(imageLayout);
FormattedDisk[] disks = DosFormatDisk.create( FormattedDisk[] disks = DosFormatDisk.create(
@ -251,8 +254,8 @@ public class DiskWriterTest extends TestCase {
* Test creating, deleting, and then creating another file which re-uses * Test creating, deleting, and then creating another file which re-uses
* the old directory entry on a OzDOS 800K disk. * the old directory entry on a OzDOS 800K disk.
*/ */
public void testCreateDeleteCreateOzdosDisk() @Test
throws IOException, DiskException { public void testCreateDeleteCreateOzdosDisk() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
ImageOrder imageOrder = new ProdosOrder(imageLayout); ImageOrder imageOrder = new ProdosOrder(imageLayout);
FormattedDisk[] disks = OzDosFormatDisk.create( FormattedDisk[] disks = OzDosFormatDisk.create(
@ -265,8 +268,8 @@ public class DiskWriterTest extends TestCase {
* Test creating, deleting, and then creating another file which re-uses * Test creating, deleting, and then creating another file which re-uses
* the old directory entry on a UniDOS 800K disk. * the old directory entry on a UniDOS 800K disk.
*/ */
public void testCreateDeleteCreateUnidosDisk() @Test
throws IOException, DiskException { public void testCreateDeleteCreateUnidosDisk() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
ImageOrder imageOrder = new DosOrder(imageLayout); ImageOrder imageOrder = new DosOrder(imageLayout);
FormattedDisk[] disks = UniDosFormatDisk.create( FormattedDisk[] disks = UniDosFormatDisk.create(
@ -279,8 +282,8 @@ public class DiskWriterTest extends TestCase {
* Test creating, deleting, and then creating another file which re-uses * Test creating, deleting, and then creating another file which re-uses
* the old directory entry on a Pascal 140K disk. * the old directory entry on a Pascal 140K disk.
*/ */
public void testCreateDeleteCreatePascalDisk() @Test
throws IOException, DiskException { public void testCreateDeleteCreatePascalDisk() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
ImageOrder imageOrder = new ProdosOrder(imageLayout); ImageOrder imageOrder = new ProdosOrder(imageLayout);
FormattedDisk[] disks = PascalFormatDisk.create( FormattedDisk[] disks = PascalFormatDisk.create(
@ -294,8 +297,8 @@ public class DiskWriterTest extends TestCase {
* Test creating, deleting, and then creating another file which re-uses * Test creating, deleting, and then creating another file which re-uses
* the old directory entry on a ProDOS 140K disk. * the old directory entry on a ProDOS 140K disk.
*/ */
public void testCreateDeleteCreateProdosDisk() @Test
throws IOException, DiskException { public void testCreateDeleteCreateProdosDisk() throws IOException, DiskException {
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
ImageOrder imageOrder = new ProdosOrder(imageLayout); ImageOrder imageOrder = new ProdosOrder(imageLayout);
FormattedDisk[] disks = ProdosFormatDisk.create( FormattedDisk[] disks = ProdosFormatDisk.create(
@ -497,8 +500,7 @@ public class DiskWriterTest extends TestCase {
* Test a create file, delete file, create file sequence. * Test a create file, delete file, create file sequence.
* The expected result is that the deleted file entry is reused. * The expected result is that the deleted file entry is reused.
*/ */
protected void createDeleteCreate(FormattedDisk[] disks, String filetype) protected void createDeleteCreate(FormattedDisk[] disks, String filetype) throws DiskException {
throws DiskException {
for (int d=0; d<disks.length; d++) { for (int d=0; d<disks.length; d++) {
FormattedDisk disk = disks[d]; FormattedDisk disk = disks[d];
System.out.println("Exercising create, delete, create sequence " //$NON-NLS-1$ System.out.println("Exercising create, delete, create sequence " //$NON-NLS-1$

View File

@ -1,48 +1,41 @@
package com.webcodepro.applecommander.storage.filters.imagehandlers; package com.webcodepro.applecommander.storage.filters.imagehandlers;
import com.webcodepro.applecommander.storage.filters.imagehandlers.SwtImage;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import junit.framework.TestCase; import org.junit.Test;
/** /**
* Excersize the SwtImage class for all known types. * Exercise the SwtImage class for all known types.
* @author Rob * @author Rob
*/ */
public class SwtImageTest extends TestCase { public class SwtImageTest {
/** @Test
* Constructor for SwtImageTest.
*/
public SwtImageTest(String arg0) {
super(arg0);
}
public static void main(String[] args) {
junit.textui.TestRunner.run(SwtImageTest.class);
}
public void testPNG() throws Exception { public void testPNG() throws Exception {
performTest("PNG"); //$NON-NLS-1$ performTest("PNG"); //$NON-NLS-1$
} }
@Test
public void testJPEG() throws Exception { public void testJPEG() throws Exception {
performTest("JPEG"); //$NON-NLS-1$ performTest("JPEG"); //$NON-NLS-1$
} }
@Test
public void testBMP() throws Exception { public void testBMP() throws Exception {
performTest("BMP"); //$NON-NLS-1$ performTest("BMP"); //$NON-NLS-1$
} }
@Test
public void testBMP_RLE() throws Exception { public void testBMP_RLE() throws Exception {
performTest("RLE"); //$NON-NLS-1$ performTest("RLE"); //$NON-NLS-1$
} }
@Test
public void testGIF() throws Exception { public void testGIF() throws Exception {
performTest("GIF"); //$NON-NLS-1$ performTest("GIF"); //$NON-NLS-1$
} }
@Test
public void testICO() throws Exception { public void testICO() throws Exception {
performTest("ICO"); //$NON-NLS-1$ performTest("ICO"); //$NON-NLS-1$
} }

View File

@ -1,9 +1,15 @@
package com.webcodepro.applecommander.util; package com.webcodepro.applecommander.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import org.junit.Test;
import com.webcodepro.applecommander.storage.Disk; import com.webcodepro.applecommander.storage.Disk;
import com.webcodepro.applecommander.storage.DiskException; import com.webcodepro.applecommander.storage.DiskException;
import com.webcodepro.applecommander.storage.FileEntry; import com.webcodepro.applecommander.storage.FileEntry;
@ -12,11 +18,10 @@ import com.webcodepro.applecommander.storage.os.prodos.ProdosFileEntry;
import com.webcodepro.applecommander.ui.ac; import com.webcodepro.applecommander.ui.ac;
import com.webcodepro.applecommander.util.AppleSingle.ProdosFileInfo; import com.webcodepro.applecommander.util.AppleSingle.ProdosFileInfo;
import junit.framework.TestCase; public class AppleSingleTest {
public class AppleSingleTest extends TestCase {
private static final String AS_HELLO_BIN = "/hello.applesingle.bin"; private static final String AS_HELLO_BIN = "/hello.applesingle.bin";
@Test
public void testSampleFromCc65() throws IOException { public void testSampleFromCc65() throws IOException {
AppleSingle as = new AppleSingle(getClass().getResourceAsStream(AS_HELLO_BIN)); AppleSingle as = new AppleSingle(getClass().getResourceAsStream(AS_HELLO_BIN));
@ -31,6 +36,7 @@ public class AppleSingleTest extends TestCase {
assertEquals(0x0803, info.getAuxType()); assertEquals(0x0803, info.getAuxType());
} }
@Test
public void testViaAcTool() throws IOException, DiskException { public void testViaAcTool() throws IOException, DiskException {
// Create a file that the JVM *should* delete for us. // Create a file that the JVM *should* delete for us.
File tmpDiskImage = File.createTempFile("deleteme-", ".po"); File tmpDiskImage = File.createTempFile("deleteme-", ".po");

View File

@ -19,33 +19,29 @@
*/ */
package com.webcodepro.applecommander.util; package com.webcodepro.applecommander.util;
import junit.framework.TestCase; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
import com.webcodepro.applecommander.storage.Disk; import com.webcodepro.applecommander.storage.Disk;
import com.webcodepro.applecommander.storage.DiskFullException; import com.webcodepro.applecommander.storage.DiskFullException;
import com.webcodepro.applecommander.storage.FileEntry; import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.os.dos33.DosFormatDisk; import com.webcodepro.applecommander.storage.os.dos33.DosFormatDisk;
import com.webcodepro.applecommander.storage.os.prodos.ProdosFormatDisk;
import com.webcodepro.applecommander.storage.physical.ByteArrayImageLayout; import com.webcodepro.applecommander.storage.physical.ByteArrayImageLayout;
import com.webcodepro.applecommander.storage.physical.DosOrder; import com.webcodepro.applecommander.storage.physical.DosOrder;
import com.webcodepro.applecommander.storage.physical.NibbleOrder; import com.webcodepro.applecommander.storage.physical.NibbleOrder;
import com.webcodepro.applecommander.storage.physical.ProdosOrder; import com.webcodepro.applecommander.storage.physical.ProdosOrder;
import com.webcodepro.applecommander.storage.os.prodos.ProdosFormatDisk;
/** /**
* Test AppleUtil. * Test AppleUtil.
*/ */
public class AppleUtilTest extends TestCase { public class AppleUtilTest {
public AppleUtilTest(String name) {
super(name);
}
public static void main(String[] args) {
junit.textui.TestRunner.run(AppleUtilTest.class);
}
/** /**
* These constants were pulled from Applesoft itself. * These constants were pulled from Applesoft itself.
*/ */
@Test
public void testApplesoftFloat() { public void testApplesoftFloat() {
testApplesoftFloat(1.0, 0x8100000000L); testApplesoftFloat(1.0, 0x8100000000L);
testApplesoftFloat(10.0, 0x8420000000L); testApplesoftFloat(10.0, 0x8420000000L);
@ -80,6 +76,7 @@ public class AppleUtilTest extends TestCase {
} }
} }
@Test
public void testChangeDosImageOrder() throws DiskFullException { public void testChangeDosImageOrder() throws DiskFullException {
// Straight DOS disk in standard DOS order // Straight DOS disk in standard DOS order
DosFormatDisk dosDiskDosOrder = DosFormatDisk.create("dostemp.dsk", //$NON-NLS-1$ DosFormatDisk dosDiskDosOrder = DosFormatDisk.create("dostemp.dsk", //$NON-NLS-1$
@ -97,6 +94,7 @@ public class AppleUtilTest extends TestCase {
assertTrue(AppleUtil.disksEqualByTrackAndSector(dosDiskDosOrder, dosDiskNibbleOrder)); assertTrue(AppleUtil.disksEqualByTrackAndSector(dosDiskDosOrder, dosDiskNibbleOrder));
} }
@Test
public void testChangeProdosImageOrder() throws DiskFullException { public void testChangeProdosImageOrder() throws DiskFullException {
// Straight ProDOS disk in standard ProDOS block order // Straight ProDOS disk in standard ProDOS block order
ProdosFormatDisk prodosDiskDosOrder = ProdosFormatDisk.create("prodostemp.po", //$NON-NLS-1$ ProdosFormatDisk prodosDiskDosOrder = ProdosFormatDisk.create("prodostemp.po", //$NON-NLS-1$