summaryrefslogtreecommitdiffstats
path: root/java/test/TestH5Arw.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/test/TestH5Arw.java')
-rw-r--r--java/test/TestH5Arw.java169
1 files changed, 101 insertions, 68 deletions
diff --git a/java/test/TestH5Arw.java b/java/test/TestH5Arw.java
index 8ce2fee..56ac7f4 100644
--- a/java/test/TestH5Arw.java
+++ b/java/test/TestH5Arw.java
@@ -33,76 +33,103 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Arw {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_INTS_FILE = "tintsattrs.h5";
private static final String H5_FLTS_FILE = "tfloatsattrs.h5";
- private static final int DIM_X = 8;
- private static final int DIM8_Y = 8;
- private static final int DIM16_Y = 16;
- private static final int DIM32_Y = 32;
- private static final int DIM64_Y = 64;
- private static final int DIM128_Y = 128;
- private static final String DATASETU08 = "DU08BITS";
- private static final String DATASETS08 = "DS08BITS";
- private static final String DATASETU16 = "DU16BITS";
- private static final String DATASETS16 = "DS16BITS";
- private static final String DATASETU32 = "DU32BITS";
- private static final String DATASETS32 = "DS32BITS";
- private static final String DATASETU64 = "DU64BITS";
- private static final String DATASETS64 = "DS64BITS";
- private static final String DATASETF32 = "DS32BITS";
- private static final String DATASETF64 = "DS64BITS";
- private static final String DATASETF128 = "DS128BITS";
- private static final int RANK = 2;
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5aid = HDF5Constants.H5I_INVALID_HID;
- long H5did = HDF5Constants.H5I_INVALID_HID;
-
- private final void _closeH5file() throws HDF5LibraryException {
+ private static final int DIM_X = 8;
+ private static final int DIM8_Y = 8;
+ private static final int DIM16_Y = 16;
+ private static final int DIM32_Y = 32;
+ private static final int DIM64_Y = 64;
+ private static final int DIM128_Y = 128;
+ private static final String DATASETU08 = "DU08BITS";
+ private static final String DATASETS08 = "DS08BITS";
+ private static final String DATASETU16 = "DU16BITS";
+ private static final String DATASETS16 = "DS16BITS";
+ private static final String DATASETU32 = "DU32BITS";
+ private static final String DATASETS32 = "DS32BITS";
+ private static final String DATASETU64 = "DU64BITS";
+ private static final String DATASETS64 = "DS64BITS";
+ private static final String DATASETF32 = "DS32BITS";
+ private static final String DATASETF64 = "DS64BITS";
+ private static final String DATASETF128 = "DS128BITS";
+ private static final int RANK = 2;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5aid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+
+ private final void _closeH5file() throws HDF5LibraryException
+ {
if (H5aid >= 0)
- try {H5.H5Aclose(H5aid);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(H5aid);
+ }
+ catch (Exception ex) {
+ }
if (H5did >= 0)
- try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception ex) {
+ }
if (H5fid > 0)
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
}
- public void openH5file(String filename, String dsetname) {
- try {
- H5fid = H5.H5Fopen(filename,
- HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("TestH5Arw._openH5file: " + err);
- }
- assertTrue("TestH5Arw._openH5file: H5.H5Fopen: ", H5fid >= 0);
- try {
- H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("TestH5Arw._openH5file: " + err);
- }
- assertTrue("TestH5Arw._openH5file: H5.H5Dopen: ", H5did >= 0);
- try {
- H5aid = H5.H5Aopen(H5did, dsetname, HDF5Constants.H5P_DEFAULT);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("TestH5Arw._openH5file: " + err);
- }
- assertTrue("TestH5Arw._openH5file: H5.H5Aopen: ", H5aid >= 0);
+ public void openH5file(String filename, String dsetname)
+ {
+ try {
+ H5fid = H5.H5Fopen(filename, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5Arw._openH5file: " + err);
+ }
+ assertTrue("TestH5Arw._openH5file: H5.H5Fopen: ", H5fid >= 0);
+ try {
+ H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5Arw._openH5file: " + err);
+ }
+ assertTrue("TestH5Arw._openH5file: H5.H5Dopen: ", H5did >= 0);
+ try {
+ H5aid = H5.H5Aopen(H5did, dsetname, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5Arw._openH5file: " + err);
+ }
+ assertTrue("TestH5Arw._openH5file: H5.H5Aopen: ", H5aid >= 0);
}
@After
- public void closeH5file() throws HDF5LibraryException {
+ public void closeH5file() throws HDF5LibraryException
+ {
if (H5aid >= 0)
- try {H5.H5Aclose(H5aid);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(H5aid);
+ }
+ catch (Exception ex) {
+ }
if (H5did >= 0)
- try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception ex) {
+ }
if (H5fid > 0)
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
H5fid = HDF5Constants.H5I_INVALID_HID;
H5did = HDF5Constants.H5I_INVALID_HID;
H5aid = HDF5Constants.H5I_INVALID_HID;
@@ -110,14 +137,15 @@ public class TestH5Arw {
}
@Before
- public void verifyCount()
- throws NullPointerException, HDF5Exception {
- assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0);
+ public void verifyCount() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
}
@Test
- public void testH5Aread_8bit_ints() {
+ public void testH5Aread_8bit_ints()
+ {
byte[][] attr_data = new byte[DIM_X][DIM8_Y];
try {
@@ -182,7 +210,8 @@ public class TestH5Arw {
}
@Test
- public void testH5Aread_16bit_ints() {
+ public void testH5Aread_16bit_ints()
+ {
short[][] attr_data = new short[DIM_X][DIM16_Y];
try {
@@ -247,7 +276,8 @@ public class TestH5Arw {
}
@Test
- public void testH5Aread_32bit_ints() {
+ public void testH5Aread_32bit_ints()
+ {
int[][] attr_data = new int[DIM_X][DIM16_Y];
try {
@@ -312,7 +342,8 @@ public class TestH5Arw {
}
@Test
- public void testH5Aread_64bit_ints() {
+ public void testH5Aread_64bit_ints()
+ {
long[][] attr_data = new long[DIM_X][DIM64_Y];
try {
@@ -377,7 +408,8 @@ public class TestH5Arw {
}
@Test
- public void testH5Aread_32bit_floats() {
+ public void testH5Aread_32bit_floats()
+ {
float[][] attr_data = new float[DIM_X][DIM32_Y];
try {
@@ -401,7 +433,8 @@ public class TestH5Arw {
}
@Test
- public void testH5Aread_64bit_floats() {
+ public void testH5Aread_64bit_floats()
+ {
double[][] attr_data = new double[DIM_X][DIM64_Y];
try {
@@ -425,7 +458,8 @@ public class TestH5Arw {
}
@Test
- public void testH5Aread_128bit_floats() {
+ public void testH5Aread_128bit_floats()
+ {
byte[][][] attr_data = new byte[DIM_X][DIM128_Y][8];
try {
@@ -445,5 +479,4 @@ public class TestH5Arw {
fail("testH5Aread_128bit_floats: H5Aread: " + err);
}
}
-
}