test.unittests
Class H5ScalarDSTest
java.lang.Object
TestCase
test.unittests.H5ScalarDSTest
public class H5ScalarDSTest
- extends TestCase
TestCase for H5ScalarDS.
This class tests all the public methods in H5ScalarDS class.
The test file contains the following objects.
/dataset_byte Dataset {50, 10}
/dataset_comp Dataset {50, 10}
/dataset_enum Dataset {50, 10}
/dataset_float Dataset {50, 10}
/dataset_image Dataset {50, 10}
/dataset_int Dataset {50, 10}
/dataset_str Dataset {50, 10}
/g0 Group
/g0/dataset_comp Dataset {50, 10}
/g0/dataset_int Dataset {50, 10}
/g0/datatype_float Type
/g0/datatype_int Type
/g0/datatype_str Type
/g0/g00 Group
/g0/g00/dataset_float Dataset {50, 10}
/g0_attr Group
We use the following template to test all the methods:
What to test:
- Test for boundary conditions
- Test for failure
- Test for success on general functionality
|
Method Summary |
protected void |
setUp()
|
protected void |
tearDown()
|
void |
testClear()
Test method for H5ScalarDS.clear(). |
void |
testClose()
Test method for H5ScalarDS.close(int). |
void |
testCopy()
Test method for H5ScalarDS.copy(ncsa.hdf.object.Group, java.lang.String, long[], java.lang.Object). |
void |
testCreate()
Test method for H5ScalarDS.create(java.lang.String, ncsa.hdf.object.Group, ncsa.hdf.object.Datatype, long[], long[], long[], int, java.lang.Object). |
void |
testGetDatatype()
Test method for H5ScalarDS.getDatatype(). |
void |
testGetMetadata()
Test method for H5ScalarDS.getMetadata(). |
void |
testGetPalette()
Test method for H5ScalarDS.getPalette(). |
void |
testGetPaletteRefs()
Test method for H5ScalarDS.getPaletteRefs(). |
void |
testH5ScalarDSFileFormatStringString()
Test method for H5ScalarDS.H5ScalarDS(ncsa.hdf.object.FileFormat, java.lang.String, java.lang.String). |
void |
testH5ScalarDSFileFormatStringStringLongArray()
Test method for H5ScalarDS.H5ScalarDS(ncsa.hdf.object.FileFormat, java.lang.String, java.lang.String, long[]). |
void |
testInit()
Test method for H5ScalarDS.init(). |
void |
testOpen()
Test method for H5ScalarDS.open(). |
void |
testRead()
Test method for H5ScalarDS.read(). |
void |
testReadByRow()
Test method for H5ScalarDS.read(). |
void |
testReadBytes()
Test method for H5ScalarDS.readBytes(). |
void |
testReadPalette()
Test method for H5ScalarDS.readPalette(int). |
void |
testRemoveMetadata()
Test method for H5ScalarDS.removeMetadata(java.lang.Object). |
void |
testSetName()
Test method for H5ScalarDS.setName(java.lang.String). |
void |
testWriteMetadata()
Test method for H5ScalarDS.writeMetadata(java.lang.Object). |
void |
testWriteObject()
Test method for H5ScalarDS.write(java.lang.Object). |
void |
testWriteSubset()
Test method for H5ScalarDS.write(java.lang.Object). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
H5ScalarDSTest
public H5ScalarDSTest(java.lang.String arg0)
- Parameters:
arg0 -
setUp
protected void setUp()
throws java.lang.Exception
- Throws:
java.lang.Exception
tearDown
protected void tearDown()
throws java.lang.Exception
- Throws:
java.lang.Exception
testSetName
public final void testSetName()
- Test method for
H5ScalarDS.setName(java.lang.String).
What to test:
- Test for boundary conditions
- Test for failure
- Set a name that already exists in file.
- Test for general functionality
- change the dataset name
- close/re-open the file
- get the dataset with the new name
- failure test: get the dataset with the original name
- set the name back to the original name
testOpen
public final void testOpen()
- Test method for
H5ScalarDS.open().
What to test:
- open a dataset identifier
- get datatype and dataspace identifier for the dataset
- Repeat all above
testClose
public final void testClose()
- Test method for
H5ScalarDS.close(int).
What to test:
- open a dataset identifier
- get datatype and dataspace identifier for the dataset
- close dataset
- failure test for the closed did
- Repeat all above
testClear
public final void testClear()
- Test method for
H5ScalarDS.clear().
What to test:
- Read data/attributes from file
- clear the dataet
- make sure that the data is empty
- make sure that the attribute list is empty
testInit
public final void testInit()
- Test method for
H5ScalarDS.init().
What to test:
- call init()
- Select a subset
- Repeat all above
testRead
public final void testRead()
- Test method for
H5ScalarDS.read().
What to test:
- Read the whole dataset of the test dataset
- read a subset of the test dataset
- Repeat all above
- Read all types scalar datasets
testReadByRow
public final void testReadByRow()
- Test method for
H5ScalarDS.read().
What to test:
- Read data row by row
- Repeat all above
testReadBytes
public final void testReadBytes()
- Test method for
H5ScalarDS.readBytes().
What to test:
- Read the whole dataset in a byte buffer
- check the data size
testWriteObject
public final void testWriteObject()
- Test method for
H5ScalarDS.write(java.lang.Object).
What to test:
- Read/write the whole dataset
- Repeat all above
- write the original data back to file
testWriteSubset
public final void testWriteSubset()
- Test method for
H5ScalarDS.write(java.lang.Object).
What to test:
- Read/write a subset of dataset
- Repeat all above
- write the original data back to file
testCopy
public final void testCopy()
- Test method for
H5ScalarDS.copy(ncsa.hdf.object.Group, java.lang.String, long[], java.lang.Object).
What to test:
- Copy all scalar datasets to a new file
- Check the content of new datasts
- Repeat all above
testGetDatatype
public final void testGetDatatype()
- Test method for
H5ScalarDS.getDatatype().
What to test:
- Get datatype
- Check the class and size of the datatype
testGetPalette
public final void testGetPalette()
- Test method for
H5ScalarDS.getPalette().
What to test:
- Get the palette from an image
- Check the content of the palette
testReadPalette
public final void testReadPalette()
- Test method for
H5ScalarDS.readPalette(int).
What to test:
- Get the palette from an image
- Check the content of the palette
testGetPaletteRefs
public final void testGetPaletteRefs()
- Test method for
H5ScalarDS.getPaletteRefs().
What to test:
- Get an array of palette references from an image
- Check the content of the palette references
testH5ScalarDSFileFormatStringString
public final void testH5ScalarDSFileFormatStringString()
- Test method for
H5ScalarDS.H5ScalarDS(ncsa.hdf.object.FileFormat, java.lang.String, java.lang.String).
What to test:
- Construct an H5ScalarDS object that exits in file
- new H5ScalarDS (file, null, fullpath)
- new H5ScalarDS (file, fullname, null)
- new H5ScalarDS (file, name, path)
- Construct an H5ScalarDS object that does not exist in file
testH5ScalarDSFileFormatStringStringLongArray
public final void testH5ScalarDSFileFormatStringStringLongArray()
- Test method for
H5ScalarDS.H5ScalarDS(ncsa.hdf.object.FileFormat, java.lang.String, java.lang.String, long[]).
What to test:
- Construct an H5ScalarDS object that exits in file
- new H5ScalarDS (file, null, fullpath, oid)
- new H5ScalarDS (file, fullname, null, oid)
- new H5ScalarDS (file, name, path, oid)
- Construct an H5ScalarDS object that does not exist in file
testGetMetadata
public final void testGetMetadata()
- Test method for
H5ScalarDS.getMetadata().
What to test:
- Get all the attributes
- Check the content of the attributes
testWriteMetadata
public final void testWriteMetadata()
- Test method for
H5ScalarDS.writeMetadata(java.lang.Object).
What to test:
- Update the value of an existing attribute
- Attach a new attribute
- Close and re-open file to check if the change is made in file
- Restore to the orginal state
testRemoveMetadata
public final void testRemoveMetadata()
- Test method for
H5ScalarDS.removeMetadata(java.lang.Object).
What to test:
- Remove all existing attributes
- Close and reopen file to check if all attribute are removed from file
- Restore to the orginal state
testCreate
public final void testCreate()
- Test method for
H5ScalarDS.create(java.lang.String, ncsa.hdf.object.Group, ncsa.hdf.object.Datatype, long[], long[], long[], int, java.lang.Object).
What to test:
- Create a new dataset of 32-bit float with level-9 gzip compression
- Close and reopen the file
- Check the content of the new dataset
- Restore to the orginal file (remove the new dataset)