use of org.broadinstitute.hdf5.HDF5File in project gatk-protected by broadinstitute.
the class HDF5LibraryUnitTest method testCreateGroup.
@Test()
public void testCreateGroup() {
final File testFile = BaseTest.createTempFile("hdf5", ".hd5");
final HDF5File file = new HDF5File(testFile, HDF5File.OpenMode.CREATE);
Assert.assertTrue(file.makeGroup("test-group/lola-run"));
Assert.assertFalse(file.makeGroup("test-group"));
Assert.assertFalse(file.makeGroup("test-group/lola-run"));
Assert.assertTrue(file.makeGroup("test-group/peter-pan"));
file.close();
}
use of org.broadinstitute.hdf5.HDF5File in project gatk-protected by broadinstitute.
the class HDF5LibraryUnitTest method testMakeDoubleArray.
@Test()
public void testMakeDoubleArray() throws IOException {
final File testFile = File.createTempFile("hdf5", ".hd5");
HDF5File file = new HDF5File(testFile, HDF5File.OpenMode.CREATE);
file.makeGroup("test-group/double-group");
final double[] testValues = new double[] { 1.1, -2.2, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, 0.0111e10 - 10 };
Assert.assertTrue(file.makeDoubleArray("test-group/double-group/my-double", testValues));
System.err.println(testFile);
file.close();
final long time = System.currentTimeMillis();
Assert.assertTrue(testFile.length() > 0);
Assert.assertTrue(testFile.lastModified() <= time);
file = new HDF5File(testFile, HDF5File.OpenMode.READ_ONLY);
final double[] theDoubles = file.readDoubleArray("test-group/double-group/my-double");
Assert.assertEquals(theDoubles, testValues.clone());
file.close();
}
use of org.broadinstitute.hdf5.HDF5File in project gatk-protected by broadinstitute.
the class HDF5LibraryUnitTest method testCreateHDF5File.
@Test()
public void testCreateHDF5File() {
final File testFile = BaseTest.createTempFile("hdf5", ".hd5");
testFile.delete();
final HDF5File file = new HDF5File(testFile, HDF5File.OpenMode.CREATE);
file.close();
}
use of org.broadinstitute.hdf5.HDF5File in project gatk-protected by broadinstitute.
the class HDF5LibraryUnitTest method testMakeStringArray.
@Test()
public void testMakeStringArray() throws IOException {
final File testFile = File.createTempFile("hdf5", ".hd5");
HDF5File file = new HDF5File(testFile, HDF5File.OpenMode.CREATE);
file.makeGroup("test-group/double-group");
final String[] testValues = new String[] { "0", "1", "absdsd12 sdsad121 sdasadsad 1212sdasdas", StringUtils.repeat("x", 2000) };
Assert.assertTrue(file.makeStringArray("test-group/double-group/my-double", testValues));
System.err.println(testFile);
file.close();
FileUtils.copyFile(testFile, new File("/tmp/3.hd5"));
final long time = System.currentTimeMillis();
Assert.assertTrue(testFile.length() > 0);
Assert.assertTrue(testFile.lastModified() <= time);
file = new HDF5File(testFile, HDF5File.OpenMode.READ_ONLY);
final String[] theStrings = file.readStringArray("test-group/double-group/my-double");
Assert.assertEquals(theStrings, testValues.clone());
file.close();
}
use of org.broadinstitute.hdf5.HDF5File in project gatk-protected by broadinstitute.
the class HDF5LibraryUnitTest method testOpenReadOnlyOnBadFile.
@Test(expectedExceptions = HDF5LibException.class)
public void testOpenReadOnlyOnBadFile() {
final HDF5File reader = new HDF5File(new File("/tmp/no-file"));
reader.close();
}
Aggregations