Revision: 5867 http://jnode.svn.sourceforge.net/jnode/?rev=5867&view=rev Author: galatnm Date: 2011-10-25 14:21:29 +0000 (Tue, 25 Oct 2011) Log Message: ----------- Add some tests on partition table entry implementation.
Added Paths: ----------- trunk/fs/src/test/org/jnode/partitions/ trunk/fs/src/test/org/jnode/partitions/ibm/ trunk/fs/src/test/org/jnode/partitions/ibm/IBMPartitionTableEntryTest.java Added: trunk/fs/src/test/org/jnode/partitions/ibm/IBMPartitionTableEntryTest.java =================================================================== --- trunk/fs/src/test/org/jnode/partitions/ibm/IBMPartitionTableEntryTest.java (rev 0) +++ trunk/fs/src/test/org/jnode/partitions/ibm/IBMPartitionTableEntryTest.java 2011-10-25 14:21:29 UTC (rev 5867) @@ -0,0 +1,55 @@ +package org.jnode.partitions.ibm; + +import static org.junit.Assert.*; + +import org.jnode.util.LittleEndian; +import org.junit.Before; +import org.junit.Test; + +public class IBMPartitionTableEntryTest { + + @Test + public void testhasChildPartitionTable(){ + byte[] bootSector = getBootSector(); + LittleEndian.setInt8(bootSector, 450, 0x85); + IBMPartitionTableEntry pte = new IBMPartitionTableEntry(null,bootSector,0); + assertTrue(pte.hasChildPartitionTable()); + } + + @Test + public void testhasNoChildPartitionTable(){ + byte[] bootSector = getBootSector(); + LittleEndian.setInt8(bootSector, 450, 0x84); + IBMPartitionTableEntry pte = new IBMPartitionTableEntry(null,bootSector,0); + assertFalse(pte.hasChildPartitionTable()); + } + + @Test + public void testIsValid() { + byte[] bootSector = getBootSector(); + LittleEndian.setInt8(bootSector, 450, 0x85); + IBMPartitionTableEntry pte = new IBMPartitionTableEntry(null,bootSector,0); + assertTrue(pte.isValid()); + } + + @Test + public void testIsNotValidEmptyBootSector() { + IBMPartitionTableEntry pte = new IBMPartitionTableEntry(null,getBootSector(),0); + assertFalse(pte.isValid()); + } + + @Test + public void testIsEmpty() { + IBMPartitionTableEntry pte = new IBMPartitionTableEntry(null,getBootSector(),0); + assertTrue(pte.isEmpty()); + } + + private byte[] getBootSector(){ + byte[] bs = new byte[500]; + for (int i = 0; i < bs.length; i++) { + bs[i] = 0; + } + return bs; + } + +} Property changes on: trunk/fs/src/test/org/jnode/partitions/ibm/IBMPartitionTableEntryTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev _______________________________________________ Jnode-svn-commits mailing list Jnode-svn-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jnode-svn-commits