summaryrefslogtreecommitdiffstats
path: root/java/test
diff options
context:
space:
mode:
Diffstat (limited to 'java/test')
-rw-r--r--java/test/CMakeLists.txt6
-rw-r--r--java/test/Makefile.am2
-rw-r--r--java/test/TestAll.java4
-rw-r--r--java/test/TestH5Arw.java449
-rw-r--r--java/test/TestH5Drw.java378
-rw-r--r--java/test/junit.sh.in46
-rw-r--r--java/test/testfiles/JUnit-TestH5Arw.txt13
-rw-r--r--java/test/testfiles/JUnit-TestH5Drw.txt13
8 files changed, 909 insertions, 2 deletions
diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt
index 10f9d52..ffaf5f5 100644
--- a/java/test/CMakeLists.txt
+++ b/java/test/CMakeLists.txt
@@ -23,6 +23,7 @@ set (HDF5_JAVA_TEST_SOURCES
TestH5Dparams
TestH5D
TestH5Dplist
+ TestH5Drw
TestH5Lparams
TestH5Lbasic
TestH5Lcreate
@@ -34,6 +35,7 @@ set (HDF5_JAVA_TEST_SOURCES
TestH5Pvirtual
TestH5Plist
TestH5A
+ TestH5Arw
TestH5Oparams
TestH5Obasic
TestH5Ocreate
@@ -98,6 +100,8 @@ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5" "${PROJECT_BINARY_
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5" "${PROJECT_BINARY_DIR}/trefer_attr.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tdatareg.h5" "${PROJECT_BINARY_DIR}/tdatareg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tattrreg.h5" "${PROJECT_BINARY_DIR}/tattrreg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
+HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tintsattrs.h5" "${PROJECT_BINARY_DIR}/tintsattrs.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
+HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.h5" "${PROJECT_BINARY_DIR}/tfloatsattrs.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_files_list})
@@ -217,6 +221,8 @@ if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL)
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5" "${PROJECT_BINARY_DIR}/${voltest}/trefer_attr.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tdatareg.h5" "${PROJECT_BINARY_DIR}/${voltest}/tdatareg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tattrreg.h5" "${PROJECT_BINARY_DIR}/${voltest}/tattrreg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tintsattrs.h5" "${PROJECT_BINARY_DIR}/${voltest}/tintsattrs.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.h5" "${PROJECT_BINARY_DIR}/${voltest}/tfloatsattrs.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files_list})
diff --git a/java/test/Makefile.am b/java/test/Makefile.am
index 732e1d2..ac3b619 100644
--- a/java/test/Makefile.am
+++ b/java/test/Makefile.am
@@ -52,6 +52,7 @@ noinst_JAVA = \
TestH5T.java \
TestH5Dparams.java \
TestH5D.java \
+ TestH5Drw.java \
TestH5Dplist.java \
TestH5Lparams.java \
TestH5Lbasic.java \
@@ -66,6 +67,7 @@ noinst_JAVA = \
TestH5Pvirtual.java \
TestH5Plist.java \
TestH5A.java \
+ TestH5Arw.java \
TestH5Oparams.java \
TestH5Obasic.java \
TestH5Ocreate.java \
diff --git a/java/test/TestAll.java b/java/test/TestAll.java
index 3950072..16414e4 100644
--- a/java/test/TestAll.java
+++ b/java/test/TestAll.java
@@ -22,12 +22,12 @@ import org.junit.runners.Suite;
TestH5Gbasic.class, TestH5G.class, TestH5Giterate.class,
TestH5Sbasic.class, TestH5S.class,
TestH5Tparams.class, TestH5Tbasic.class, TestH5T.class,
- TestH5Dparams.class, TestH5D.class, TestH5Dplist.class,
+ TestH5Dparams.class, TestH5D.class, TestH5Dplist.class, TestH5Drw.class,
TestH5Lparams.class, TestH5Lbasic.class, TestH5Lcreate.class,
TestH5R.class, TestH5Rref.class,
TestH5P.class, TestH5PData.class, TestH5Pfapl.class, TestH5Pvirtual.class, TestH5Plist.class,
TestH5Pfapls3.class, TestH5Pfaplhdfs.class,
- TestH5A.class,
+ TestH5A.class, TestH5Arw.class,
TestH5Oparams.class, TestH5Obasic.class, TestH5Ocopy.class, TestH5Ocreate.class,
TestH5PL.class, TestH5Z.class
})
diff --git a/java/test/TestH5Arw.java b/java/test/TestH5Arw.java
new file mode 100644
index 0000000..282b736
--- /dev/null
+++ b/java/test/TestH5Arw.java
@@ -0,0 +1,449 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+
+import hdf.hdf5lib.H5;
+import hdf.hdf5lib.HDF5Constants;
+import hdf.hdf5lib.HDFNativeData;
+import hdf.hdf5lib.callbacks.H5A_iterate_cb;
+import hdf.hdf5lib.callbacks.H5A_iterate_t;
+import hdf.hdf5lib.exceptions.HDF5Exception;
+import hdf.hdf5lib.exceptions.HDF5LibraryException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+
+public class TestH5Arw {
+ @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 {
+ if (H5aid >= 0)
+ try {H5.H5Aclose(H5aid);} catch (Exception ex) {}
+ if (H5did >= 0)
+ try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ if (H5fid > 0)
+ 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);
+ }
+
+ @After
+ public void closeH5file() throws HDF5LibraryException {
+ if (H5aid >= 0)
+ try {H5.H5Aclose(H5aid);} catch (Exception ex) {}
+ if (H5did >= 0)
+ try {H5.H5Aclose(H5did);} catch (Exception ex) {}
+ if (H5fid > 0)
+ try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ H5fid = HDF5Constants.H5I_INVALID_HID;
+ H5did = HDF5Constants.H5I_INVALID_HID;
+ H5aid = HDF5Constants.H5I_INVALID_HID;
+ System.out.println();
+ }
+
+ @Before
+ 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() {
+ byte[][] attr_data = new byte[DIM_X][DIM8_Y];
+
+ try {
+ openH5file(H5_INTS_FILE, DATASETU08);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Aread_8bit_ints: openH5file: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_UINT8, attr_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_8bit_ints: H5Aread: " + err);
+ }
+
+ // End access to the attribute and release resources used by it.
+ try {
+ H5.H5Aclose(H5aid);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ // End access to the dataset and release resources used by it.
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ // Open an existing dataset.
+ try {
+ H5did = H5.H5Dopen(H5fid, DATASETS08, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_8bit_ints: H5Dopen: " + err);
+ }
+
+ // Open an existing attribute.
+ try {
+ H5aid = H5.H5Aopen(H5did, DATASETS08, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_8bit_ints: H5Aopen: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_INT8, attr_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_8bit_ints: H5Aread: " + err);
+ }
+ }
+
+ @Test
+ public void testH5Aread_16bit_ints() {
+ short[][] attr_data = new short[DIM_X][DIM16_Y];
+
+ try {
+ openH5file(H5_INTS_FILE, DATASETU16);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Aread_16bit_ints: openH5file: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_UINT16, attr_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_16bit_ints: H5Aread: " + err);
+ }
+
+ // End access to the attribute and release resources used by it.
+ try {
+ H5.H5Aclose(H5aid);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ // End access to the dataset and release resources used by it.
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ // Open an existing dataset.
+ try {
+ H5did = H5.H5Dopen(H5fid, DATASETS16, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_16bit_ints: H5Dopen: " + err);
+ }
+
+ // Open an existing attribute.
+ try {
+ H5aid = H5.H5Aopen(H5did, DATASETS16, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_16bit_ints: H5Aopen: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_INT16, attr_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_16bit_ints: H5Aread: " + err);
+ }
+ }
+
+ @Test
+ public void testH5Aread_32bit_ints() {
+ int[][] attr_data = new int[DIM_X][DIM16_Y];
+
+ try {
+ openH5file(H5_INTS_FILE, DATASETU32);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Aread_32bit_ints: openH5file: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_UINT32, attr_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_32bit_ints: H5Aread: " + err);
+ }
+
+ // End access to the attribute and release resources used by it.
+ try {
+ H5.H5Aclose(H5aid);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ // End access to the dataset and release resources used by it.
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ // Open an existing dataset.
+ try {
+ H5did = H5.H5Dopen(H5fid, DATASETS32, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_32bit_ints: H5Dopen: " + err);
+ }
+
+ // Open an existing attribute.
+ try {
+ H5aid = H5.H5Aopen(H5did, DATASETS32, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_32bit_ints: H5Aopen: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_INT32, attr_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_32bit_ints: H5Aread: " + err);
+ }
+ }
+
+ @Test
+ public void testH5Aread_64bit_ints() {
+ long[][] attr_data = new long[DIM_X][DIM64_Y];
+
+ try {
+ openH5file(H5_INTS_FILE, DATASETU64);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Aread_64bit_ints: openH5file: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_UINT64, attr_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_64bit_ints: H5Aread: " + err);
+ }
+
+ // End access to the attribute and release resources used by it.
+ try {
+ H5.H5Aclose(H5aid);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ // End access to the dataset and release resources used by it.
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ // Open an existing dataset.
+ try {
+ H5did = H5.H5Dopen(H5fid, DATASETS64, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_64bit_ints: H5Dopen: " + err);
+ }
+
+ // Open an existing attribute.
+ try {
+ H5aid = H5.H5Aopen(H5did, DATASETS64, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_64bit_ints: H5Aopen: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_INT64, attr_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_64bit_ints: H5Aread: " + err);
+ }
+ }
+
+ @Test
+ public void testH5Aread_32bit_floats() {
+ float[][] attr_data = new float[DIM_X][DIM32_Y];
+
+ try {
+ openH5file(H5_FLTS_FILE, DATASETF32);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Aread_32bit_floats: openH5file: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_FLOAT, attr_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_32bit_floats: H5Aread: " + err);
+ }
+ for (int i = 0; i < DIM_X; i++)
+ assertTrue("testH5Aread_32bit_floats - H5.H5Aread: ", attr_data[i][0] == (32 - i));
+ }
+
+ @Test
+ public void testH5Aread_64bit_floats() {
+ double[][] attr_data = new double[DIM_X][DIM64_Y];
+
+ try {
+ openH5file(H5_FLTS_FILE, DATASETF64);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Aread_64bit_floats: openH5file: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_DOUBLE, attr_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_64bit_floats: H5Aread: " + err);
+ }
+ for (int i = 0; i < DIM_X; i++)
+ assertTrue("testH5Aread_64bit_floats - H5.H5Aread: ", attr_data[i][0] == (64 - i));
+ }
+
+ @Test
+ public void testH5Aread_128bit_floats() {
+ byte[][][] attr_data = new byte[DIM_X][DIM128_Y][8];
+
+ try {
+ openH5file(H5_FLTS_FILE, DATASETF128);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Aread_128bit_floats: openH5file: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_LDOUBLE, attr_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Aread_128bit_floats: H5Aread: " + err);
+ }
+ }
+
+}
diff --git a/java/test/TestH5Drw.java b/java/test/TestH5Drw.java
new file mode 100644
index 0000000..69fb9d7
--- /dev/null
+++ b/java/test/TestH5Drw.java
@@ -0,0 +1,378 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+
+import hdf.hdf5lib.H5;
+import hdf.hdf5lib.HDF5Constants;
+import hdf.hdf5lib.HDFNativeData;
+import hdf.hdf5lib.callbacks.H5D_iterate_cb;
+import hdf.hdf5lib.callbacks.H5D_iterate_t;
+import hdf.hdf5lib.exceptions.HDF5Exception;
+import hdf.hdf5lib.exceptions.HDF5LibraryException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+
+public class TestH5Drw {
+ @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 H5did = HDF5Constants.H5I_INVALID_HID;
+
+ private final void _closeH5file() throws HDF5LibraryException {
+ if (H5did >= 0)
+ try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ if (H5fid > 0)
+ 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("TestH5Drw._openH5file: " + err);
+ }
+ assertTrue("TestH5Drw._openH5file: H5.H5Fopen: ", H5fid >= 0);
+ try {
+ H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5Drw._openH5file: " + err);
+ }
+ assertTrue("TestH5Drw._openH5file: H5.H5Dopen: ", H5did >= 0);
+ }
+
+ @After
+ public void closeH5file() throws HDF5LibraryException {
+ if (H5did >= 0)
+ try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ if (H5fid > 0)
+ try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ H5fid = HDF5Constants.H5I_INVALID_HID;
+ H5did = HDF5Constants.H5I_INVALID_HID;
+ System.out.println();
+ }
+
+ @Before
+ public void verifyCount()
+ throws NullPointerException, HDF5Exception {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0);
+ System.out.print(testname.getMethodName());
+ }
+
+ @Test
+ public void testH5Dread_8bit_ints() {
+ byte[][] dset_data = new byte[DIM_X][DIM8_Y];
+
+ try {
+ openH5file(H5_INTS_FILE, DATASETU08);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Dread_8bit_ints: openH5file: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Dread_8bit_ints: H5Dread: " + err);
+ }
+
+ // End access to the dataset and release resources used by it.
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ // Open an existing dataset.
+ try {
+ H5did = H5.H5Dopen(H5fid, DATASETS08, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Dread_8bit_ints: H5Dopen: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Dread_8bit_ints: H5Dread: " + err);
+ }
+ }
+
+ @Test
+ public void testH5Dread_16bit_ints() {
+ short[][] dset_data = new short[DIM_X][DIM16_Y];
+
+ try {
+ openH5file(H5_INTS_FILE, DATASETU16);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Dread_16bit_ints: openH5file: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT16, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Dread_16bit_ints: H5Dread: " + err);
+ }
+
+ // End access to the dataset and release resources used by it.
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ // Open an existing dataset.
+ try {
+ H5did = H5.H5Dopen(H5fid, DATASETS16, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Dread_16bit_ints: H5Dopen: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT16, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Dread_16bit_ints: H5Dread: " + err);
+ }
+ }
+
+ @Test
+ public void testH5Dread_32bit_ints() {
+ int[][] dset_data = new int[DIM_X][DIM16_Y];
+
+ try {
+ openH5file(H5_INTS_FILE, DATASETU32);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Dread_32bit_ints: openH5file: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT32, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Dread_32bit_ints: H5Dread: " + err);
+ }
+
+ // End access to the dataset and release resources used by it.
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ // Open an existing dataset.
+ try {
+ H5did = H5.H5Dopen(H5fid, DATASETS32, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Dread_32bit_ints: H5Dopen: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT32, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Dread_32bit_ints: H5Dread: " + err);
+ }
+ }
+
+ @Test
+ public void testH5Dread_64bit_ints() {
+ long[][] dset_data = new long[DIM_X][DIM64_Y];
+
+ try {
+ openH5file(H5_INTS_FILE, DATASETU64);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Dread_64bit_ints: openH5file: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT64, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Dread_64bit_ints: H5Dread: " + err);
+ }
+
+ // End access to the dataset and release resources used by it.
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ // Open an existing dataset.
+ try {
+ H5did = H5.H5Dopen(H5fid, DATASETS64, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Dread_64bit_ints: H5Dopen: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT64, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Dread_64bit_ints: H5Dread: " + err);
+ }
+ }
+
+ @Test
+ public void testH5Dread_32bit_floats() {
+ float[][] dset_data = new float[DIM_X][DIM32_Y];
+
+ try {
+ openH5file(H5_FLTS_FILE, DATASETF32);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Dread_32bit_floats: openH5file: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_FLOAT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Dread_32bit_floats: H5Dread: " + err);
+ }
+ for (int i = 0; i < DIM_X; i++)
+ assertTrue("testH5Dread_32bit_floats - H5.H5Dread: ", dset_data[i][0] == (32 - i));
+ }
+
+ @Test
+ public void testH5Dread_64bit_floats() {
+ double[][] dset_data = new double[DIM_X][DIM64_Y];
+
+ try {
+ openH5file(H5_FLTS_FILE, DATASETF64);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Dread_64bit_floats: openH5file: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Dread_64bit_floats: H5Dread: " + err);
+ }
+ for (int i = 0; i < DIM_X; i++)
+ assertTrue("testH5Dread_64bit_floats - H5.H5Dread: ", dset_data[i][0] == (64 - i));
+ }
+
+ @Test
+ public void testH5Dread_128bit_floats() {
+ byte[][][] dset_data = new byte[DIM_X][DIM128_Y][8];
+
+ try {
+ openH5file(H5_FLTS_FILE, DATASETF128);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Dread_128bit_floats: openH5file: " + err);
+ }
+
+ // Read data.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_LDOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Dread_128bit_floats: H5Dread: " + err);
+ }
+ }
+
+}
diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in
index 3774cbd..39db296 100644
--- a/java/test/junit.sh.in
+++ b/java/test/junit.sh.in
@@ -90,6 +90,7 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5T.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Dparams.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5D.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Dplist.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Drw.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Lparams.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Lbasic.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Lcreate.txt
@@ -103,6 +104,7 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5Pfaplhdfs.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Pvirtual.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Plist.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5A.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Arw.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Oparams.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Obasic.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Ocreate.txt
@@ -254,6 +256,8 @@ COPY_DATAFILES_TO_BLDDIR()
$CP -f $TOOLS_TESTFILES/trefer_attr.h5 $BLDDIR/trefer_attr.h5
$CP -f $TOOLS_TESTFILES/tdatareg.h5 $BLDDIR/tdatareg.h5
$CP -f $TOOLS_TESTFILES/tattrreg.h5 $BLDDIR/tattrreg.h5
+ $CP -f $TOOLS_TESTFILES/tintsattrs.h5 $BLDDIR/tintsattrs.h5
+ $CP -f $TOOLS_TESTFILES/tfloatsattrs.h5 $BLDDIR/tfloatsattrs.h5
}
CLEAN_DATAFILES_AND_BLDDIR()
@@ -669,6 +673,27 @@ else
test yes = "$verbose" && $DIFF JUnit-TestH5D.txt JUnit-TestH5D.out |sed 's/^/ /'
fi
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Drw"
+TESTING JUnit-TestH5Drw
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Drw > JUnit-TestH5Drw.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Drw.ext > JUnit-TestH5Drw.out
+
+if diff JUnit-TestH5Drw.out JUnit-TestH5Drw.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Drw"
+else
+ echo "**FAILED** JUnit-TestH5Drw"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Drw.txt JUnit-TestH5Drw.out |sed 's/^/ /'
+fi
+
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dplist"
TESTING JUnit-TestH5Dplist
($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dplist > JUnit-TestH5Dplist.ext)
@@ -921,6 +946,27 @@ else
test yes = "$verbose" && $DIFF JUnit-TestH5A.txt JUnit-TestH5A.out |sed 's/^/ /'
fi
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Arw"
+TESTING JUnit-TestH5Arw
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Arw > JUnit-TestH5Arw.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Arw.ext > JUnit-TestH5Arw.out
+
+if diff JUnit-TestH5Arw.out JUnit-TestH5Arw.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Arw"
+else
+ echo "**FAILED** JUnit-TestH5Arw"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Arw.txt JUnit-TestH5Arw.out |sed 's/^/ /'
+fi
+
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Oparams"
TESTING JUnit-TestH5Oparams
($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Oparams > JUnit-TestH5Oparams.ext)
diff --git a/java/test/testfiles/JUnit-TestH5Arw.txt b/java/test/testfiles/JUnit-TestH5Arw.txt
new file mode 100644
index 0000000..49d3b1c
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Arw.txt
@@ -0,0 +1,13 @@
+JUnit version 4.11
+.testH5Aread_128bit_floats
+.testH5Aread_64bit_floats
+.testH5Aread_8bit_ints
+.testH5Aread_32bit_ints
+.testH5Aread_64bit_ints
+.testH5Aread_32bit_floats
+.testH5Aread_16bit_ints
+
+Time: XXXX
+
+OK (7 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Drw.txt b/java/test/testfiles/JUnit-TestH5Drw.txt
new file mode 100644
index 0000000..6b854cf
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Drw.txt
@@ -0,0 +1,13 @@
+JUnit version 4.11
+.testH5Dread_32bit_floats
+.testH5Dread_32bit_ints
+.testH5Dread_64bit_ints
+.testH5Dread_64bit_floats
+.testH5Dread_8bit_ints
+.testH5Dread_128bit_floats
+.testH5Dread_16bit_ints
+
+Time: XXXX
+
+OK (7 tests)
+