summaryrefslogtreecommitdiffstats
path: root/java/test
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2022-04-22 15:24:27 (GMT)
committerGitHub <noreply@github.com>2022-04-22 15:24:27 (GMT)
commit974aefb8416d78b0687a54e5f72f21d0ca72ae2d (patch)
tree0fe4e4327b95c38f362ceace220d59cb08aa88a3 /java/test
parentf5042fd4d3549e9e3453ab99d81bb46f1688b240 (diff)
downloadhdf5-974aefb8416d78b0687a54e5f72f21d0ca72ae2d.zip
hdf5-974aefb8416d78b0687a54e5f72f21d0ca72ae2d.tar.gz
hdf5-974aefb8416d78b0687a54e5f72f21d0ca72ae2d.tar.bz2
Add java clang-format (#1672)
Diffstat (limited to 'java/test')
-rw-r--r--java/test/CMakeLists.txt7
-rw-r--r--java/test/TestAll.java26
-rw-r--r--java/test/TestH5.java397
-rw-r--r--java/test/TestH5A.java1028
-rw-r--r--java/test/TestH5Arw.java169
-rw-r--r--java/test/TestH5D.java555
-rw-r--r--java/test/TestH5Dparams.java69
-rw-r--r--java/test/TestH5Dplist.java268
-rw-r--r--java/test/TestH5Drw.java161
-rw-r--r--java/test/TestH5E.java125
-rw-r--r--java/test/TestH5Edefault.java161
-rw-r--r--java/test/TestH5Eparams.java71
-rw-r--r--java/test/TestH5Eregister.java27
-rw-r--r--java/test/TestH5F.java173
-rw-r--r--java/test/TestH5Fbasic.java110
-rw-r--r--java/test/TestH5Fparams.java112
-rw-r--r--java/test/TestH5Fswmr.java49
-rw-r--r--java/test/TestH5G.java317
-rw-r--r--java/test/TestH5Gbasic.java311
-rw-r--r--java/test/TestH5Giterate.java71
-rw-r--r--java/test/TestH5Lbasic.java234
-rw-r--r--java/test/TestH5Lcreate.java550
-rw-r--r--java/test/TestH5Lparams.java129
-rw-r--r--java/test/TestH5Obasic.java480
-rw-r--r--java/test/TestH5Ocopy.java352
-rw-r--r--java/test/TestH5OcopyOld.java391
-rw-r--r--java/test/TestH5Ocreate.java329
-rw-r--r--java/test/TestH5Oparams.java111
-rw-r--r--java/test/TestH5P.java694
-rw-r--r--java/test/TestH5PData.java151
-rw-r--r--java/test/TestH5PL.java142
-rw-r--r--java/test/TestH5Pfapl.java790
-rw-r--r--java/test/TestH5Pfaplhdfs.java64
-rw-r--r--java/test/TestH5Pfapls3.java67
-rw-r--r--java/test/TestH5Plist.java752
-rw-r--r--java/test/TestH5Pvirtual.java364
-rw-r--r--java/test/TestH5R.java414
-rw-r--r--java/test/TestH5Rref.java797
-rw-r--r--java/test/TestH5S.java313
-rw-r--r--java/test/TestH5Sbasic.java279
-rw-r--r--java/test/TestH5T.java429
-rw-r--r--java/test/TestH5Tbasic.java99
-rw-r--r--java/test/TestH5Tparams.java231
-rw-r--r--java/test/TestH5VL.java70
-rw-r--r--java/test/TestH5Z.java58
45 files changed, 7584 insertions, 4913 deletions
diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt
index 9362b42..3e18d35 100644
--- a/java/test/CMakeLists.txt
+++ b/java/test/CMakeLists.txt
@@ -86,6 +86,13 @@ foreach (test_file ${HDF5_JAVA_TEST_SOURCES})
add_dependencies (${HDF5_JAVA_TEST_LIB_TARGET}_${test_file} ${HDF5_JAVA_HDF5_LIB_TARGET})
set_target_properties (${HDF5_JAVA_TEST_LIB_TARGET}_${test_file} PROPERTIES FOLDER test/java)
+
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_JAVA_TEST_${test_file}_SRC_FORMAT ${test_file}.java)
+ endif ()
endforeach ()
foreach (h5_file ${HDF5_JAVA_TEST_SOURCES})
diff --git a/java/test/TestAll.java b/java/test/TestAll.java
index 16414e4..c22fbfe 100644
--- a/java/test/TestAll.java
+++ b/java/test/TestAll.java
@@ -16,21 +16,17 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
-@Suite.SuiteClasses( { TestH5.class,
- TestH5Eparams.class, TestH5Eregister.class, TestH5Edefault.class, TestH5E.class,
- TestH5Fparams.class, TestH5Fbasic.class, TestH5F.class, TestH5Fswmr.class,
- TestH5Gbasic.class, TestH5G.class, TestH5Giterate.class,
- TestH5Sbasic.class, TestH5S.class,
- TestH5Tparams.class, TestH5Tbasic.class, TestH5T.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, TestH5Arw.class,
- TestH5Oparams.class, TestH5Obasic.class, TestH5Ocopy.class, TestH5Ocreate.class,
- TestH5PL.class, TestH5Z.class
-})
+@Suite.SuiteClasses({TestH5.class, TestH5Eparams.class, TestH5Eregister.class, TestH5Edefault.class,
+ TestH5E.class, TestH5Fparams.class, TestH5Fbasic.class, TestH5F.class,
+ TestH5Fswmr.class, TestH5Gbasic.class, TestH5G.class, TestH5Giterate.class,
+ TestH5Sbasic.class, TestH5S.class, TestH5Tparams.class, TestH5Tbasic.class,
+ TestH5T.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, TestH5Arw.class, TestH5Oparams.class,
+ TestH5Obasic.class, TestH5Ocopy.class, TestH5Ocreate.class, TestH5PL.class,
+ TestH5Z.class})
public class TestAll {
}
diff --git a/java/test/TestH5.java b/java/test/TestH5.java
index 9ea3069..3d3d741 100644
--- a/java/test/TestH5.java
+++ b/java/test/TestH5.java
@@ -20,9 +20,9 @@ import static org.junit.Assert.fail;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -46,45 +46,53 @@ import org.junit.rules.TestName;
*
*/
public class TestH5 {
- @Rule public TestName testname = new TestName();
- private static final String H5_FILE = "testData.h5";
- private static final String EXPORT_FILE = "testExport.txt";
- private static final String H5_REGION_FILE = "trefer_reg.h5";
+ @Rule
+ public TestName testname = new TestName();
+ private static final String H5_FILE = "testData.h5";
+ private static final String EXPORT_FILE = "testExport.txt";
+ private static final String H5_REGION_FILE = "trefer_reg.h5";
private static final String EXPORT_REGION_FILE = "testExportReg.txt";
- private static final String H5_ATTR_FILE = "trefer_attr.h5";
- private static final String EXPORT_ATTR_FILE = "testExportAttr.txt";
- private static final String H5_DREG_FILE = "tdatareg.h5";
- private static final String EXPORT_DREG_FILE = "testExportDReg.txt";
- private static final String H5_AREG_FILE = "tattrreg.h5";
- private static final String EXPORT_AREG_FILE = "testExportAReg.txt";
- private static final int DIM_X = 4;
- private static final int DIM_Y = 6;
- private static final int DIM_BLKS = 36;
- private static final int DIM_PNTS = 10;
- private static final int DIM_ATTR = 12;
- private static final int RANK = 2;
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5dsid = HDF5Constants.H5I_INVALID_HID;
- long H5did = HDF5Constants.H5I_INVALID_HID;
- long[] H5dims = { DIM_X, DIM_Y };
-
- private final void _deleteFile(String filename) {
+ private static final String H5_ATTR_FILE = "trefer_attr.h5";
+ private static final String EXPORT_ATTR_FILE = "testExportAttr.txt";
+ private static final String H5_DREG_FILE = "tdatareg.h5";
+ private static final String EXPORT_DREG_FILE = "testExportDReg.txt";
+ private static final String H5_AREG_FILE = "tattrreg.h5";
+ private static final String EXPORT_AREG_FILE = "testExportAReg.txt";
+ private static final int DIM_X = 4;
+ private static final int DIM_Y = 6;
+ private static final int DIM_BLKS = 36;
+ private static final int DIM_PNTS = 10;
+ private static final int DIM_ATTR = 12;
+ private static final int RANK = 2;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long[] H5dims = {DIM_X, DIM_Y};
+
+ private final void _deleteFile(String filename)
+ {
File file = null;
try {
file = new File(filename);
}
- catch (Throwable err) {}
+ catch (Throwable err) {
+ }
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
- private final long _createDataset(long fid, long dsid, String name, long dapl) {
+ private final long _createDataset(long fid, long dsid, String name, long dapl)
+ {
long did = HDF5Constants.H5I_INVALID_HID;
try {
- did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32LE, dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
+ did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32LE, dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, dapl);
}
catch (Throwable err) {
err.printStackTrace();
@@ -95,12 +103,13 @@ public class TestH5 {
return did;
}
- private final void _createH5File() {
+ private final void _createH5File()
+ {
try {
- H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5dsid = H5.H5Screate_simple(2, H5dims, null);
- H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
+ H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -118,62 +127,77 @@ public class TestH5 {
}
}
- private final void _closeH5File() {
+ private final void _closeH5File()
+ {
if (H5did >= 0)
- try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception ex) {
+ }
if (H5dsid > 0)
- try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid);
+ }
+ catch (Exception ex) {
+ }
if (H5fid > 0)
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = HDF5Constants.H5I_INVALID_HID;
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
+ H5fid = HDF5Constants.H5I_INVALID_HID;
H5dsid = HDF5Constants.H5I_INVALID_HID;
- H5did = HDF5Constants.H5I_INVALID_HID;
+ H5did = HDF5Constants.H5I_INVALID_HID;
}
- 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("TestH5._openH5file: " + err);
- }
- assertTrue("TestH5._openH5file: H5.H5Fopen: ", H5fid >= 0);
- try {
- H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("TestH5._openH5file: " + err);
- }
- assertTrue("TestH5._openH5file: H5.H5Dopen: ", H5did >= 0);
- try {
- H5dsid = H5.H5Dget_space(H5did);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("TestH5._openH5file: " + err);
- }
- assertTrue("TestH5._openH5file: H5.H5Screate_simple: ",H5dsid > 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("TestH5._openH5file: " + err);
+ }
+ assertTrue("TestH5._openH5file: H5.H5Fopen: ", H5fid >= 0);
+ try {
+ H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5._openH5file: " + err);
+ }
+ assertTrue("TestH5._openH5file: H5.H5Dopen: ", H5did >= 0);
+ try {
+ H5dsid = H5.H5Dget_space(H5did);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5._openH5file: " + err);
+ }
+ assertTrue("TestH5._openH5file: H5.H5Screate_simple: ", H5dsid > 0);
}
- public final void _deleteH5file() {
+ public final void _deleteH5file()
+ {
_closeH5File();
_deleteFile(H5_FILE);
}
@After
- public void closeH5File() throws HDF5LibraryException {
+ public void closeH5File() throws HDF5LibraryException
+ {
_closeH5File();
- assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0);
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.println();
}
@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());
}
@@ -184,33 +208,30 @@ public class TestH5 {
* being retained hdf java does not access the symbol.
*/
@Test
- public void testJ2C() {
- int H5F_ACC_RDONLY = 0x0000;
- int H5F_ACC_RDWR = 0x0001;
- int H5F_ACC_TRUNC = 0x0002;
- int H5F_ACC_EXCL = 0x0004;
- int H5F_ACC_CREAT = 0x0010;
- int H5F_OBJ_FILE = 0x0001;
- int H5F_OBJ_DATASET = 0x0002;
- int H5F_OBJ_GROUP = 0x0004;
+ public void testJ2C()
+ {
+ int H5F_ACC_RDONLY = 0x0000;
+ int H5F_ACC_RDWR = 0x0001;
+ int H5F_ACC_TRUNC = 0x0002;
+ int H5F_ACC_EXCL = 0x0004;
+ int H5F_ACC_CREAT = 0x0010;
+ int H5F_OBJ_FILE = 0x0001;
+ int H5F_OBJ_DATASET = 0x0002;
+ int H5F_OBJ_GROUP = 0x0004;
int H5F_OBJ_DATATYPE = 0x0008;
- int H5F_OBJ_ATTR = 0x0010;
- int H5F_OBJ_ALL = H5F_OBJ_FILE | H5F_OBJ_DATASET | H5F_OBJ_GROUP
- | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR;
+ int H5F_OBJ_ATTR = 0x0010;
+ int H5F_OBJ_ALL = H5F_OBJ_FILE | H5F_OBJ_DATASET | H5F_OBJ_GROUP | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR;
int H5F_OBJ_LOCAL = 0x0020;
- int definedValues[] = { H5F_ACC_RDONLY, H5F_ACC_RDWR, H5F_ACC_TRUNC,
- H5F_ACC_EXCL, H5F_ACC_CREAT, H5F_OBJ_FILE,
- H5F_OBJ_DATASET, H5F_OBJ_GROUP, H5F_OBJ_DATATYPE, H5F_OBJ_ATTR,
- H5F_OBJ_ALL, H5F_OBJ_LOCAL };
+ int definedValues[] = {H5F_ACC_RDONLY, H5F_ACC_RDWR, H5F_ACC_TRUNC, H5F_ACC_EXCL,
+ H5F_ACC_CREAT, H5F_OBJ_FILE, H5F_OBJ_DATASET, H5F_OBJ_GROUP,
+ H5F_OBJ_DATATYPE, H5F_OBJ_ATTR, H5F_OBJ_ALL, H5F_OBJ_LOCAL};
- int j2cValues[] = { HDF5Constants.H5F_ACC_RDONLY,
- HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5F_ACC_EXCL,
- HDF5Constants.H5F_ACC_CREAT, HDF5Constants.H5F_OBJ_FILE,
- HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP,
- HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR,
- HDF5Constants.H5F_OBJ_ALL, HDF5Constants.H5F_OBJ_LOCAL };
+ int j2cValues[] = {
+ HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5F_ACC_EXCL, HDF5Constants.H5F_ACC_CREAT, HDF5Constants.H5F_OBJ_FILE,
+ HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP, HDF5Constants.H5F_OBJ_DATATYPE,
+ HDF5Constants.H5F_OBJ_ATTR, HDF5Constants.H5F_OBJ_ALL, HDF5Constants.H5F_OBJ_LOCAL};
for (int i = 0; i < definedValues.length; i++) {
assertEquals(definedValues[i], j2cValues[i]);
@@ -224,7 +245,8 @@ public class TestH5 {
* Test method for {@link hdf.hdf5lib.H5#H5error_off()}.
*/
@Test
- public void testH5error_off() {
+ public void testH5error_off()
+ {
try {
H5.H5error_off();
}
@@ -237,7 +259,8 @@ public class TestH5 {
* Test method for {@link hdf.hdf5lib.H5#H5open()}.
*/
@Test
- public void testH5open() {
+ public void testH5open()
+ {
try {
H5.H5open();
}
@@ -250,7 +273,8 @@ public class TestH5 {
* Test method for {@link hdf.hdf5lib.H5#H5garbage_collect()}.
*/
@Test
- public void testH5garbage_collect() {
+ public void testH5garbage_collect()
+ {
try {
H5.H5garbage_collect();
}
@@ -265,17 +289,18 @@ public class TestH5 {
* .
*/
@Test
- public void testH5set_free_list_limits() {
+ public void testH5set_free_list_limits()
+ {
int reg_global_lim = 1;
- int reg_list_lim = 1;
+ int reg_list_lim = 1;
int arr_global_lim = 1;
- int arr_list_lim = 1;
+ int arr_list_lim = 1;
int blk_global_lim = 1;
- int blk_list_lim = 1;
+ int blk_list_lim = 1;
try {
- H5.H5set_free_list_limits(reg_global_lim, reg_list_lim,
- arr_global_lim, arr_list_lim, blk_global_lim, blk_list_lim);
+ H5.H5set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim,
+ blk_global_lim, blk_list_lim);
}
catch (Throwable err) {
fail("H5.H5set_free_list_limits failed: " + err);
@@ -286,8 +311,9 @@ public class TestH5 {
* Test method for {@link hdf.hdf5lib.H5#H5get_libversion(int[])}.
*/
@Test
- public void testH5get_libversion() {
- int libversion[] = { 1, 12, 3 };
+ public void testH5get_libversion()
+ {
+ int libversion[] = {1, 12, 3};
try {
H5.H5get_libversion(libversion);
@@ -309,7 +335,8 @@ public class TestH5 {
* fail.
*/
@Test
- public void testH5get_libversion_null_param() {
+ public void testH5get_libversion_null_param()
+ {
try {
H5.H5get_libversion(null);
}
@@ -325,7 +352,8 @@ public class TestH5 {
* {@link hdf.hdf5lib.H5#H5check_version(int, int, int)}.
*/
@Test
- public void testH5check_version() {
+ public void testH5check_version()
+ {
int majnum = 1, minnum = 12, relnum = 3;
try {
@@ -344,8 +372,9 @@ public class TestH5 {
}
@Test
- public void testIsSerializable() {
- H5 test = new H5();
+ public void testIsSerializable()
+ {
+ H5 test = new H5();
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream oos;
try {
@@ -358,7 +387,6 @@ public class TestH5 {
fail("ObjectOutputStream failed: " + err);
}
assertTrue(out.toByteArray().length > 0);
-
}
@SuppressWarnings("static-access")
@@ -368,7 +396,7 @@ public class TestH5 {
try {
H5 test = new H5();
- FileOutputStream fos = new FileOutputStream("temph5.ser");
+ FileOutputStream fos = new FileOutputStream("temph5.ser");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(test);
oos.close();
@@ -378,14 +406,14 @@ public class TestH5 {
}
try {
- FileInputStream fis = new FileInputStream("temph5.ser");
+ FileInputStream fis = new FileInputStream("temph5.ser");
ObjectInputStream ois = new ObjectInputStream(fis);
- H5 test = (hdf.hdf5lib.H5) ois.readObject();
+ H5 test = (hdf.hdf5lib.H5)ois.readObject();
ois.close();
- assertTrue("H5.LIB_VERSION[0]", test.LIB_VERSION[0]==H5.LIB_VERSION[0]);
- assertTrue("H5.LIB_VERSION[1]", test.LIB_VERSION[1]==H5.LIB_VERSION[1]);
-// assertTrue("H5.LIB_VERSION[2]", test.LIB_VERSION[2]==H5.LIB_VERSION[2]);
+ assertTrue("H5.LIB_VERSION[0]", test.LIB_VERSION[0] == H5.LIB_VERSION[0]);
+ assertTrue("H5.LIB_VERSION[1]", test.LIB_VERSION[1] == H5.LIB_VERSION[1]);
+ // assertTrue("H5.LIB_VERSION[2]", test.LIB_VERSION[2]==H5.LIB_VERSION[2]);
// Clean up the file
new File("temph5.ser").delete();
@@ -396,10 +424,11 @@ public class TestH5 {
}
@Test
- public void testH5export_dataset() {
- int[][] dset_data = new int[DIM_X][DIM_Y];
+ public void testH5export_dataset()
+ {
+ int[][] dset_data = new int[DIM_X][DIM_Y];
int[][] dset_indata = new int[DIM_X][DIM_Y];
- int FILLVAL = 99;
+ int FILLVAL = 99;
_createH5File();
@@ -410,9 +439,8 @@ public class TestH5 {
try {
if (H5did >= 0)
- H5.H5Dwrite(H5did, HDF5Constants.H5T_STD_I32LE,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
+ H5.H5Dwrite(H5did, HDF5Constants.H5T_STD_I32LE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
}
catch (Exception e) {
e.printStackTrace();
@@ -433,12 +461,12 @@ public class TestH5 {
File file = new File(EXPORT_FILE);
try {
- Reader reader = new FileReader(EXPORT_FILE);
+ Reader reader = new FileReader(EXPORT_FILE);
StreamTokenizer streamTokenizer = new StreamTokenizer(reader);
- int indx = 0;
- int jndx = 0;
- while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){
- if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
+ int indx = 0;
+ int jndx = 0;
+ while (streamTokenizer.nextToken() != StreamTokenizer.TT_EOF) {
+ if (streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
dset_indata[indx][jndx] = (int)streamTokenizer.nval;
jndx++;
if (jndx >= DIM_Y) {
@@ -453,21 +481,23 @@ public class TestH5 {
err.printStackTrace();
fail("read file failed: " + err);
}
- for(int row = 0; row < DIM_X; row++)
- for(int col = 0; col < DIM_Y; col++) {
- assertTrue("H5export_dataset: <"+row+","+col+">"+dset_indata[row][col]+"=99", dset_indata[row][col]==99);
+ for (int row = 0; row < DIM_X; row++)
+ for (int col = 0; col < DIM_Y; col++) {
+ assertTrue("H5export_dataset: <" + row + "," + col + ">" + dset_indata[row][col] + "=99",
+ dset_indata[row][col] == 99);
}
_deleteH5file();
}
@Test
- public void testH5export_region() {
- int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108,
- 111, 126, 129, 132, 135, 138, 141, 156, 159, 162, 165, 168, 171,
- 186, 189, 192, 195, 198, 201, 216, 219, 222, 225, 228, 231,
- 207, 66, 252, 48, 84, 96, 12, 14, 213, 99};
- int[] dset_indata = new int[DIM_BLKS+DIM_PNTS];
- String objName = "/Dataset1";
+ public void testH5export_region()
+ {
+ int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108, 111,
+ 126, 129, 132, 135, 138, 141, 156, 159, 162, 165, 168, 171,
+ 186, 189, 192, 195, 198, 201, 216, 219, 222, 225, 228, 231,
+ 207, 66, 252, 48, 84, 96, 12, 14, 213, 99};
+ int[] dset_indata = new int[DIM_BLKS + DIM_PNTS];
+ String objName = "/Dataset1";
_openH5File(H5_REGION_FILE, objName);
@@ -482,11 +512,11 @@ public class TestH5 {
File file = new File(EXPORT_REGION_FILE);
try {
- Reader reader = new FileReader(EXPORT_REGION_FILE);
+ Reader reader = new FileReader(EXPORT_REGION_FILE);
StreamTokenizer streamTokenizer = new StreamTokenizer(reader);
- int indx = 0;
- while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){
- if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
+ int indx = 0;
+ while (streamTokenizer.nextToken() != StreamTokenizer.TT_EOF) {
+ if (streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
dset_indata[indx] = (int)streamTokenizer.nval;
indx++;
}
@@ -497,15 +527,17 @@ public class TestH5 {
err.printStackTrace();
fail("read file failed: " + err);
}
- for(int row = 0; row < DIM_X; row++)
- assertTrue("testH5export_region: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]);
+ for (int row = 0; row < DIM_X; row++)
+ assertTrue("testH5export_region: <" + row + ">" + dset_indata[row],
+ dset_indata[row] == dset_data_expect[row]);
}
@Test
- public void testH5export_attribute() {
+ public void testH5export_attribute()
+ {
int[] dset_data_expect = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11};
- int[] dset_indata = new int[DIM_ATTR];
- String objName = "/Dataset3";
+ int[] dset_indata = new int[DIM_ATTR];
+ String objName = "/Dataset3";
_openH5File(H5_ATTR_FILE, objName);
@@ -520,12 +552,12 @@ public class TestH5 {
File file = new File(EXPORT_ATTR_FILE);
try {
- Reader reader = new FileReader(EXPORT_ATTR_FILE);
+ Reader reader = new FileReader(EXPORT_ATTR_FILE);
StreamTokenizer streamTokenizer = new StreamTokenizer(reader);
- int indx = 0;
- int jndx = 0;
- while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){
- if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
+ int indx = 0;
+ int jndx = 0;
+ while (streamTokenizer.nextToken() != StreamTokenizer.TT_EOF) {
+ if (streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
dset_indata[indx] = (int)streamTokenizer.nval;
indx++;
}
@@ -536,18 +568,20 @@ public class TestH5 {
err.printStackTrace();
fail("read file failed: " + err);
}
- for(int row = 0; row < DIM_X; row++)
- assertTrue("testH5export_attribute: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]);
+ for (int row = 0; row < DIM_X; row++)
+ assertTrue("testH5export_attribute: <" + row + ">" + dset_indata[row],
+ dset_indata[row] == dset_data_expect[row]);
}
@Test
- public void testH5export_regdataset() {
- int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108,
- 111, 126, 129, 132, 135, 138, 141, 156, 159, 162, 165, 168, 171,
- 186, 189, 192, 195, 198, 201, 216, 219, 222, 225, 228, 231,
- 207, 66, 252, 48, 84, 96, 12, 14, 213, 99};
- int[] dset_indata = new int[DIM_BLKS+DIM_PNTS];
- String objName = "/Dataset1";
+ public void testH5export_regdataset()
+ {
+ int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108, 111,
+ 126, 129, 132, 135, 138, 141, 156, 159, 162, 165, 168, 171,
+ 186, 189, 192, 195, 198, 201, 216, 219, 222, 225, 228, 231,
+ 207, 66, 252, 48, 84, 96, 12, 14, 213, 99};
+ int[] dset_indata = new int[DIM_BLKS + DIM_PNTS];
+ String objName = "/Dataset1";
_openH5File(H5_DREG_FILE, objName);
@@ -562,11 +596,11 @@ public class TestH5 {
File file = new File(EXPORT_DREG_FILE);
try {
- Reader reader = new FileReader(EXPORT_DREG_FILE);
+ Reader reader = new FileReader(EXPORT_DREG_FILE);
StreamTokenizer streamTokenizer = new StreamTokenizer(reader);
- int indx = 0;
- while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){
- if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
+ int indx = 0;
+ while (streamTokenizer.nextToken() != StreamTokenizer.TT_EOF) {
+ if (streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
dset_indata[indx] = (int)streamTokenizer.nval;
indx++;
}
@@ -577,19 +611,21 @@ public class TestH5 {
err.printStackTrace();
fail("read file failed: " + err);
}
- for(int row = 0; row < DIM_X; row++)
- assertTrue("testH5export_regdataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]);
+ for (int row = 0; row < DIM_X; row++)
+ assertTrue("testH5export_regdataset: <" + row + ">" + dset_indata[row],
+ dset_indata[row] == dset_data_expect[row]);
}
@Test
- public void testH5export_attrdataset() {
- int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108,
- 111, 126, 129, 132, 135, 138, 141, 156, 159, 162, 165, 168, 171,
- 186, 189, 192, 195, 198, 201, 216, 219, 222, 225, 228, 231,
- 207, 66, 252, 48, 84, 96, 12, 14, 213, 99};
- int[] dset_indata = new int[DIM_BLKS+DIM_PNTS];
- String dsetName = "/Dataset1";
- String objName = "Attribute1";
+ public void testH5export_attrdataset()
+ {
+ int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108, 111,
+ 126, 129, 132, 135, 138, 141, 156, 159, 162, 165, 168, 171,
+ 186, 189, 192, 195, 198, 201, 216, 219, 222, 225, 228, 231,
+ 207, 66, 252, 48, 84, 96, 12, 14, 213, 99};
+ int[] dset_indata = new int[DIM_BLKS + DIM_PNTS];
+ String dsetName = "/Dataset1";
+ String objName = "Attribute1";
_openH5File(H5_AREG_FILE, dsetName);
@@ -604,12 +640,12 @@ public class TestH5 {
File file = new File(EXPORT_AREG_FILE);
try {
- Reader reader = new FileReader(EXPORT_AREG_FILE);
+ Reader reader = new FileReader(EXPORT_AREG_FILE);
StreamTokenizer streamTokenizer = new StreamTokenizer(reader);
- int indx = 0;
- int jndx = 0;
- while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){
- if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
+ int indx = 0;
+ int jndx = 0;
+ while (streamTokenizer.nextToken() != StreamTokenizer.TT_EOF) {
+ if (streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
dset_indata[indx] = (int)streamTokenizer.nval;
indx++;
}
@@ -620,7 +656,8 @@ public class TestH5 {
err.printStackTrace();
fail("read file failed: " + err);
}
- for(int row = 0; row < DIM_X; row++)
- assertTrue("testH5export_attrdataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]);
+ for (int row = 0; row < DIM_X; row++)
+ assertTrue("testH5export_attrdataset: <" + row + ">" + dset_indata[row],
+ dset_indata[row] == dset_data_expect[row]);
}
}
diff --git a/java/test/TestH5A.java b/java/test/TestH5A.java
index f2134d2..fed13ce 100644
--- a/java/test/TestH5A.java
+++ b/java/test/TestH5A.java
@@ -18,9 +18,8 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import java.util.ArrayList;
-
import java.io.File;
+import java.util.ArrayList;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
@@ -38,32 +37,39 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5A {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_FILE = "testA.h5";
- private static final int DIM_X = 4;
- private static final int DIM_Y = 6;
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5dsid = HDF5Constants.H5I_INVALID_HID;
- long H5did = HDF5Constants.H5I_INVALID_HID;
- long[] H5dims = { DIM_X, DIM_Y };
- long type_id = HDF5Constants.H5I_INVALID_HID;
- long space_id = HDF5Constants.H5I_INVALID_HID;
- long lapl_id = HDF5Constants.H5I_INVALID_HID;
- long aapl_id = HDF5Constants.H5I_INVALID_HID;
-
- private final void _deleteFile(String filename) {
+ private static final int DIM_X = 4;
+ private static final int DIM_Y = 6;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long[] H5dims = {DIM_X, DIM_Y};
+ long type_id = HDF5Constants.H5I_INVALID_HID;
+ long space_id = HDF5Constants.H5I_INVALID_HID;
+ long lapl_id = HDF5Constants.H5I_INVALID_HID;
+ long aapl_id = HDF5Constants.H5I_INVALID_HID;
+
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
- private final long _createDataset(long fid, long dsid, String name, long dapl) {
+ private final long _createDataset(long fid, long dsid, String name, long dapl)
+ {
long did = HDF5Constants.H5I_INVALID_HID;
try {
- did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
+ did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, dapl);
}
catch (Throwable err) {
err.printStackTrace();
@@ -75,18 +81,18 @@ public class TestH5A {
}
@Before
- public void createH5file() throws NullPointerException, HDF5Exception {
+ public void createH5file() throws NullPointerException, HDF5Exception
+ {
assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
- H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
assertTrue("TestH5A.createH5file: H5.H5Fcreate: ", H5fid > 0);
H5dsid = H5.H5Screate_simple(2, H5dims, null);
assertTrue("TestH5A.createH5file: H5.H5Screate_simple: ", H5dsid > 0);
- H5did = _createDataset(H5fid, H5dsid, "dset",
- HDF5Constants.H5P_DEFAULT);
+ H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
assertTrue("TestH5A.createH5file: _createDataset: ", H5did > 0);
space_id = H5.H5Screate(HDF5Constants.H5S_NULL);
assertTrue(space_id > 0);
@@ -108,32 +114,63 @@ public class TestH5A {
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5dsid > 0)
- try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid);
+ }
+ 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) {
+ }
_deleteFile(H5_FILE);
if (type_id > 0)
- try {H5.H5Tclose(type_id);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(type_id);
+ }
+ catch (Exception ex) {
+ }
if (space_id > 0)
- try {H5.H5Sclose(space_id);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(space_id);
+ }
+ catch (Exception ex) {
+ }
if (lapl_id > 0)
- try {H5.H5Pclose(lapl_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(lapl_id);
+ }
+ catch (Exception ex) {
+ }
if (aapl_id > 0)
- try {H5.H5Pclose(aapl_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(aapl_id);
+ }
+ catch (Exception ex) {
+ }
System.out.println();
}
@Test
- public void testH5Acreate2() {
+ public void testH5Acreate2()
+ {
long attr_id = HDF5Constants.H5I_INVALID_HID;
try {
- attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
assertTrue("testH5Acreate2", attr_id >= 0);
}
catch (Throwable err) {
@@ -142,34 +179,40 @@ public class TestH5A {
}
finally {
if (attr_id > 0)
- try {H5.H5Aclose(attr_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Acreate2_invalidobject() throws Throwable {
+ public void testH5Acreate2_invalidobject() throws Throwable
+ {
H5.H5Acreate(H5dsid, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = NullPointerException.class)
- public void testH5Acreate2_nullname() throws Throwable {
+ public void testH5Acreate2_nullname() throws Throwable
+ {
H5.H5Acreate(H5did, null, type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Aopen() {
- String attr_name = "dset";
+ public void testH5Aopen()
+ {
+ String attr_name = "dset";
long attribute_id = HDF5Constants.H5I_INVALID_HID;
- long attr_id = HDF5Constants.H5I_INVALID_HID;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
try {
- attr_id = H5.H5Acreate(H5did, attr_name, type_id, space_id,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ attr_id = H5.H5Acreate(H5did, attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
// Opening the existing attribute, attr_name(Created by H5ACreate2)
// attached to an object identifier.
- attribute_id = H5.H5Aopen(H5did, attr_name,
- HDF5Constants.H5P_DEFAULT);
+ attribute_id = H5.H5Aopen(H5did, attr_name, HDF5Constants.H5P_DEFAULT);
assertTrue("testH5Aopen: H5Aopen", attribute_id >= 0);
}
catch (Throwable err) {
@@ -178,35 +221,45 @@ public class TestH5A {
}
finally {
if (attr_id > 0)
- try {H5.H5Aclose(attr_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr_id);
+ }
+ catch (Exception ex) {
+ }
if (attribute_id > 0)
- try {H5.H5Aclose(attribute_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attribute_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Aopen_invalidname() throws Throwable {
+ public void testH5Aopen_invalidname() throws Throwable
+ {
H5.H5Aopen(H5did, "attr_name", HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Aopen_by_idx() {
- long loc_id = H5did;
- String obj_name = ".";
- int idx_type = HDF5Constants.H5_INDEX_CRT_ORDER;
- int order = HDF5Constants.H5_ITER_INC;
- long n = 0;
- long attr_id = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Aopen_by_idx()
+ {
+ long loc_id = H5did;
+ String obj_name = ".";
+ int idx_type = HDF5Constants.H5_INDEX_CRT_ORDER;
+ int order = HDF5Constants.H5_ITER_INC;
+ long n = 0;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
long attribute_id = HDF5Constants.H5I_INVALID_HID;
try {
- attr_id = H5.H5Acreate(H5did, "file", type_id, space_id,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ attr_id = H5.H5Acreate(H5did, "file", type_id, space_id, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
// Opening the existing attribute, obj_name(Created by H5ACreate2)
// by index, attached to an object identifier.
- attribute_id = H5.H5Aopen_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC,
- 0, aapl_id, lapl_id);
+ attribute_id = H5.H5Aopen_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER,
+ HDF5Constants.H5_ITER_INC, 0, aapl_id, lapl_id);
assertTrue("testH5Aopen_by_idx: H5Aopen_by_idx", attribute_id >= 0);
@@ -215,29 +268,29 @@ public class TestH5A {
// with n=5 and we do not have 5 attributes created.
try {
n = 5;
- H5.H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n,
- aapl_id, lapl_id);
+ H5.H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id);
fail("Negative Test Failed:- Error not Thrown when n is invalid.");
}
catch (AssertionError err) {
fail("H5.H5Aopen_by_idx: " + err);
}
- catch (HDF5LibraryException err) {}
+ catch (HDF5LibraryException err) {
+ }
// Negative test- Error should be thrown when H5Aopen_by_idx is
// called
// with an invalid object name(which hasn't been created).
try {
- n = 0;
+ n = 0;
obj_name = "file";
- H5.H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n,
- aapl_id, lapl_id);
+ H5.H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id);
fail("Negative Test Failed:- Error not Thrown when attribute name is invalid.");
}
catch (AssertionError err) {
fail("H5.H5Aopen_by_idx: " + err);
}
- catch (HDF5LibraryException err) {}
+ catch (HDF5LibraryException err) {
+ }
}
catch (Throwable err) {
err.printStackTrace();
@@ -245,32 +298,37 @@ public class TestH5A {
}
finally {
if (attr_id > 0)
- try {H5.H5Aclose(attr_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr_id);
+ }
+ catch (Exception ex) {
+ }
if (attribute_id > 0)
- try {H5.H5Aclose(attribute_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attribute_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Acreate_by_name() {
- String obj_name = ".";
- String attr_name = "DATASET";
+ public void testH5Acreate_by_name()
+ {
+ String obj_name = ".";
+ String attr_name = "DATASET";
long attribute_id = HDF5Constants.H5I_INVALID_HID;
- boolean bool_val = false;
+ boolean bool_val = false;
try {
- attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name,
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- aapl_id, lapl_id);
- assertTrue("testH5Acreate_by_name: H5Acreate_by_name",
- attribute_id >= 0);
+ attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, aapl_id, lapl_id);
+ assertTrue("testH5Acreate_by_name: H5Acreate_by_name", attribute_id >= 0);
// Check if the name of attribute attached to the object specified
// by loc_id and obj_name exists.It should be true.
- bool_val = H5.H5Aexists_by_name(H5fid, obj_name, attr_name,
- lapl_id);
- assertTrue("testH5Acreate_by_name: H5Aexists_by_name",
- bool_val == true);
+ bool_val = H5.H5Aexists_by_name(H5fid, obj_name, attr_name, lapl_id);
+ assertTrue("testH5Acreate_by_name: H5Aexists_by_name", bool_val == true);
}
catch (Throwable err) {
err.printStackTrace();
@@ -278,21 +336,27 @@ public class TestH5A {
}
finally {
if (attribute_id > 0)
- try {H5.H5Aclose(attribute_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attribute_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Arename() throws Throwable, HDF5LibraryException, NullPointerException {
- long loc_id = H5fid;
+ public void testH5Arename() throws Throwable, HDF5LibraryException, NullPointerException
+ {
+ long loc_id = H5fid;
String old_attr_name = "old";
String new_attr_name = "new";
- long attr_id = HDF5Constants.H5I_INVALID_HID;
- int ret_val = -1;
- boolean bool_val = false;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
+ int ret_val = -1;
+ boolean bool_val = false;
try {
- attr_id = H5.H5Acreate(loc_id, old_attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, aapl_id);
+ attr_id =
+ H5.H5Acreate(loc_id, old_attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, aapl_id);
ret_val = H5.H5Arename(loc_id, old_attr_name, new_attr_name);
@@ -315,41 +379,42 @@ public class TestH5A {
}
finally {
if (attr_id > 0)
- try {H5.H5Aclose(attr_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Arename_by_name() {
- long loc_id = H5fid;
- String obj_name = ".";
+ public void testH5Arename_by_name()
+ {
+ long loc_id = H5fid;
+ String obj_name = ".";
String old_attr_name = "old";
String new_attr_name = "new";
- long attr_id = HDF5Constants.H5I_INVALID_HID;
- int ret_val = -1;
- boolean bool_val = false;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
+ int ret_val = -1;
+ boolean bool_val = false;
try {
- attr_id = H5.H5Acreate_by_name(loc_id, obj_name, old_attr_name,
- type_id, space_id, HDF5Constants.H5P_DEFAULT, aapl_id, lapl_id);
+ attr_id = H5.H5Acreate_by_name(loc_id, obj_name, old_attr_name, type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, aapl_id, lapl_id);
- ret_val = H5.H5Arename_by_name(loc_id, obj_name, old_attr_name,
- new_attr_name, lapl_id);
+ ret_val = H5.H5Arename_by_name(loc_id, obj_name, old_attr_name, new_attr_name, lapl_id);
// Check the return value.It should be non negative.
assertTrue("testH5Arename_by_name: H5Arename_by_name", ret_val >= 0);
// Check if the new name of attribute attached to the object
// specified by loc_id and obj_name exists.It should be true.
- bool_val = H5.H5Aexists_by_name(loc_id, obj_name, new_attr_name,
- lapl_id);
- assertTrue("testH5Arename_by_name: H5Aexists_by_name",
- bool_val == true);
+ bool_val = H5.H5Aexists_by_name(loc_id, obj_name, new_attr_name, lapl_id);
+ assertTrue("testH5Arename_by_name: H5Aexists_by_name", bool_val == true);
// Check if the old name of attribute attached to the object
// specified by loc_id and obj_name exists. It should equal false.
- bool_val = H5.H5Aexists_by_name(loc_id, obj_name, old_attr_name,
- lapl_id);
+ bool_val = H5.H5Aexists_by_name(loc_id, obj_name, old_attr_name, lapl_id);
assertEquals(bool_val, false);
}
catch (Throwable err) {
@@ -358,21 +423,25 @@ public class TestH5A {
}
finally {
if (attr_id > 0)
- try {H5.H5Aclose(attr_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Aget_name() {
- String obj_name = ".";
- String attr_name = "DATASET1";
- String ret_name = null;
+ public void testH5Aget_name()
+ {
+ String obj_name = ".";
+ String attr_name = "DATASET1";
+ String ret_name = null;
long attribute_id = HDF5Constants.H5I_INVALID_HID;
try {
- attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name,
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- aapl_id, lapl_id);
+ attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, aapl_id, lapl_id);
assertTrue("testH5Aget_name: H5Acreate_by_name ", attribute_id > 0);
ret_name = H5.H5Aget_name(attribute_id);
assertEquals(ret_name, attr_name);
@@ -383,40 +452,40 @@ public class TestH5A {
}
finally {
if (attribute_id > 0)
- try {H5.H5Aclose(attribute_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attribute_id);
+ }
+ catch (Exception ex) {
+ }
}
}
-
@Test
- public void testH5Aget_name_by_idx() {
- long loc_id = H5fid;
- String obj_name = ".";
+ public void testH5Aget_name_by_idx()
+ {
+ long loc_id = H5fid;
+ String obj_name = ".";
String attr_name = "DATASET1", attr2_name = "DATASET2";
String ret_name = null;
- int idx_type = HDF5Constants.H5_INDEX_NAME;
- int order = HDF5Constants.H5_ITER_INC;
- int n = 0;
- long attr1_id = HDF5Constants.H5I_INVALID_HID;
- long attr2_id = HDF5Constants.H5I_INVALID_HID;
+ int idx_type = HDF5Constants.H5_INDEX_NAME;
+ int order = HDF5Constants.H5_ITER_INC;
+ int n = 0;
+ long attr1_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
try {
- attr1_id = H5.H5Acreate_by_name(loc_id, obj_name, attr_name,
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- attr2_id = H5.H5Acreate_by_name(loc_id, obj_name, attr2_name,
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr1_id = H5.H5Acreate_by_name(loc_id, obj_name, attr_name, type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr2_id = H5.H5Acreate_by_name(loc_id, obj_name, attr2_name, type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
// getting the 1st attribute name(n=0).
- ret_name = H5.H5Aget_name_by_idx(loc_id, obj_name, idx_type, order,
- n, lapl_id);
+ ret_name = H5.H5Aget_name_by_idx(loc_id, obj_name, idx_type, order, n, lapl_id);
assertFalse("H5Aget_name_by_idx ", ret_name == null);
assertEquals(ret_name, attr_name);
// getting the second attribute name(n=1)
- ret_name = H5.H5Aget_name_by_idx(loc_id, obj_name, idx_type, order,
- 1, lapl_id);
+ ret_name = H5.H5Aget_name_by_idx(loc_id, obj_name, idx_type, order, 1, lapl_id);
assertFalse("H5Aget_name_by_idx ", ret_name == null);
assertEquals(ret_name, attr2_name);
}
@@ -426,20 +495,29 @@ public class TestH5A {
}
finally {
if (attr1_id > 0)
- try {H5.H5Aclose(attr1_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr1_id);
+ }
+ catch (Exception ex) {
+ }
if (attr2_id > 0)
- try {H5.H5Aclose(attr2_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr2_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Aget_storage_size() {
- long attr_id = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Aget_storage_size()
+ {
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
long attr_size = HDF5Constants.H5I_INVALID_HID;
try {
- attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
attr_size = H5.H5Aget_storage_size(attr_id);
assertTrue("The size of attribute is :", attr_size == 0);
@@ -450,27 +528,31 @@ public class TestH5A {
}
finally {
if (attr_id > 0)
- try {H5.H5Aclose(attr_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Aget_info() {
+ public void testH5Aget_info()
+ {
H5A_info_t attr_info = null;
- long attribute_id = HDF5Constants.H5I_INVALID_HID;
- long attr_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
try {
- attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
attribute_id = H5.H5Aopen(H5did, "dset", HDF5Constants.H5P_DEFAULT);
// Calling H5Aget_info with attribute_id returned from H5Aopen.
attr_info = H5.H5Aget_info(attribute_id);
assertFalse("H5Aget_info ", attr_info == null);
- assertTrue("Corder_Valid should be false",
- attr_info.corder_valid == false);
+ assertTrue("Corder_Valid should be false", attr_info.corder_valid == false);
assertTrue("Character set used for attribute name",
- attr_info.cset == HDF5Constants.H5T_CSET_ASCII);
+ attr_info.cset == HDF5Constants.H5T_CSET_ASCII);
assertTrue("Corder ", attr_info.corder == 0);
assertEquals(attr_info.data_size, H5.H5Aget_storage_size(attr_id));
}
@@ -480,34 +562,40 @@ public class TestH5A {
}
finally {
if (attr_id > 0)
- try {H5.H5Aclose(attr_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr_id);
+ }
+ catch (Exception ex) {
+ }
if (attribute_id > 0)
- try {H5.H5Aclose(attribute_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attribute_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Aget_info1() {
+ public void testH5Aget_info1()
+ {
H5A_info_t attr_info = null;
- long attribute_id = HDF5Constants.H5I_INVALID_HID;
- long attr_id = HDF5Constants.H5I_INVALID_HID;
- int order = HDF5Constants.H5_ITER_INC;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
+ int order = HDF5Constants.H5_ITER_INC;
try {
- attr_id = H5.H5Acreate(H5did, ".", type_id, space_id,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- attribute_id = H5.H5Aopen_by_idx(H5did, ".",
- HDF5Constants.H5_INDEX_CRT_ORDER, order, 0,
- HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr_id = H5.H5Acreate(H5did, ".", type_id, space_id, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
+ attribute_id = H5.H5Aopen_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, order, 0,
+ HDF5Constants.H5P_DEFAULT, lapl_id);
// Calling H5Aget_info with attribute_id returned from
// H5Aopen_by_idx.
attr_info = H5.H5Aget_info(attribute_id);
assertFalse("H5Aget_info ", attr_info == null);
- assertTrue("Corder_Valid should be true",
- attr_info.corder_valid == true);
- assertTrue("Character set",
- attr_info.cset == HDF5Constants.H5T_CSET_ASCII);
+ assertTrue("Corder_Valid should be true", attr_info.corder_valid == true);
+ assertTrue("Character set", attr_info.cset == HDF5Constants.H5T_CSET_ASCII);
assertTrue("Corder ", attr_info.corder == 0);
assertEquals(attr_info.data_size, H5.H5Aget_storage_size(attr_id));
}
@@ -517,55 +605,81 @@ public class TestH5A {
}
finally {
if (attr_id > 0)
- try {H5.H5Aclose(attr_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr_id);
+ }
+ catch (Exception ex) {
+ }
if (attribute_id > 0)
- try {H5.H5Aclose(attribute_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attribute_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Aget_info_by_idx() {
- long attr_id = HDF5Constants.H5I_INVALID_HID;
- long attr2_id = HDF5Constants.H5I_INVALID_HID;;
+ public void testH5Aget_info_by_idx()
+ {
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
+ ;
H5A_info_t attr_info = null;
try {
- attr_id = H5.H5Acreate(H5did, "dset1", type_id, space_id,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- attr2_id = H5.H5Acreate(H5did, "dataset2", type_id, space_id,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
-
- //Verify info for 1st attribute, in increasing creation order
- attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, lapl_id);
+ attr_id = H5.H5Acreate(H5did, "dset1", type_id, space_id, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
+ attr2_id = H5.H5Acreate(H5did, "dataset2", type_id, space_id, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
+
+ // Verify info for 1st attribute, in increasing creation order
+ attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER,
+ HDF5Constants.H5_ITER_INC, 0, lapl_id);
assertNotNull(attr_info);
- assertTrue("Corder ", attr_info.corder == 0);//should equal 0 as this is the order of 1st attribute created.
+ assertTrue("Corder ",
+ attr_info.corder ==
+ 0); // should equal 0 as this is the order of 1st attribute created.
assertEquals(attr_info.data_size, H5.H5Aget_storage_size(attr_id));
- //Verify info for 2nd attribute, in increasing creation order
- attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 1, lapl_id);
+ // Verify info for 2nd attribute, in increasing creation order
+ attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER,
+ HDF5Constants.H5_ITER_INC, 1, lapl_id);
assertNotNull(attr_info);
assertTrue("Corder", attr_info.corder == 1);
assertEquals(attr_info.data_size, H5.H5Aget_storage_size(attr2_id));
- //verify info for 2nd attribute, in decreasing creation order
- attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_DEC, 0, lapl_id);
+ // verify info for 2nd attribute, in decreasing creation order
+ attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER,
+ HDF5Constants.H5_ITER_DEC, 0, lapl_id);
assertNotNull(attr_info);
- assertTrue("Corder", attr_info.corder == 1); //should equal 1 as this is the order of 2nd attribute created.
+ assertTrue("Corder",
+ attr_info.corder ==
+ 1); // should equal 1 as this is the order of 2nd attribute created.
- //verify info for 1st attribute, in decreasing creation order
- attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_DEC, 1, lapl_id);
+ // verify info for 1st attribute, in decreasing creation order
+ attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER,
+ HDF5Constants.H5_ITER_DEC, 1, lapl_id);
assertNotNull(attr_info);
- assertTrue("Corder", attr_info.corder == 0); //should equal 0 as this is the order of 1st attribute created.
+ assertTrue("Corder",
+ attr_info.corder ==
+ 0); // should equal 0 as this is the order of 1st attribute created.
- //verify info for 1st attribute, in increasing name order
- attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 1, lapl_id);
+ // verify info for 1st attribute, in increasing name order
+ attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_NAME,
+ HDF5Constants.H5_ITER_INC, 1, lapl_id);
assertNotNull(attr_info);
- assertTrue("Corder", attr_info.corder == 0); //should equal 0 as this is the order of 1st attribute created.
+ assertTrue("Corder",
+ attr_info.corder ==
+ 0); // should equal 0 as this is the order of 1st attribute created.
- //verify info for 2nd attribute, in decreasing name order
- attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_DEC, 1, lapl_id);
+ // verify info for 2nd attribute, in decreasing name order
+ attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_NAME,
+ HDF5Constants.H5_ITER_DEC, 1, lapl_id);
assertNotNull(attr_info);
- assertTrue("Corder", attr_info.corder == 1); //should equal 1 as this is the order of 2nd attribute created.
+ assertTrue("Corder",
+ attr_info.corder ==
+ 1); // should equal 1 as this is the order of 2nd attribute created.
}
catch (Throwable err) {
err.printStackTrace();
@@ -573,25 +687,32 @@ public class TestH5A {
}
finally {
if (attr_id > 0)
- try {H5.H5Aclose(attr_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr_id);
+ }
+ catch (Exception ex) {
+ }
if (attr2_id > 0)
- try {H5.H5Aclose(attr2_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr2_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Aget_info_by_name() {
- long attr_id = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Aget_info_by_name()
+ {
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
H5A_info_t attr_info = null;
- String obj_name = ".";
- String attr_name = "DATASET";
+ String obj_name = ".";
+ String attr_name = "DATASET";
try {
- attr_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id,
- space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- attr_info = H5.H5Aget_info_by_name(H5fid, obj_name, attr_name,
- lapl_id);
+ attr_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr_info = H5.H5Aget_info_by_name(H5fid, obj_name, attr_name, lapl_id);
assertNotNull(attr_info);
}
catch (Throwable err) {
@@ -600,41 +721,45 @@ public class TestH5A {
}
finally {
if (attr_id > 0)
- try {H5.H5Aclose(attr_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Adelete_by_name() {
- long attr_id = HDF5Constants.H5I_INVALID_HID;
- int ret_val = -1;
+ public void testH5Adelete_by_name()
+ {
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
+ int ret_val = -1;
boolean bool_val = false;
- boolean exists = false;
+ boolean exists = false;
try {
- attr_id = H5.H5Acreate_by_name(H5fid, ".", "DATASET",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr_id = H5.H5Acreate_by_name(H5fid, ".", "DATASET", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
ret_val = H5.H5Adelete_by_name(H5fid, ".", "DATASET", lapl_id);
assertTrue("H5Adelete_by_name", ret_val >= 0);
// Check if the Attribute still exists.
- bool_val = H5.H5Aexists_by_name(H5fid, ".", "DATASET",
- lapl_id);
+ bool_val = H5.H5Aexists_by_name(H5fid, ".", "DATASET", lapl_id);
assertFalse("testH5Adelete_by_name: H5Aexists_by_name", bool_val);
exists = H5.H5Aexists(H5fid, "DATASET");
- assertFalse("testH5Adelete_by_name: H5Aexists ",exists);
+ assertFalse("testH5Adelete_by_name: H5Aexists ", exists);
// Negative test. Error thrown when we try to delete an attribute
// that has already been deleted.
- try{
+ try {
ret_val = H5.H5Adelete_by_name(H5fid, ".", "DATASET", lapl_id);
fail("Negative Test Failed: Error Not thrown.");
}
catch (AssertionError err) {
fail("H5.H5Adelete_by_name: " + err);
}
- catch (HDF5LibraryException err) {}
+ catch (HDF5LibraryException err) {
+ }
}
catch (Throwable err) {
err.printStackTrace();
@@ -642,14 +767,19 @@ public class TestH5A {
}
finally {
if (attr_id > 0)
- try {H5.H5Aclose(attr_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Aexists() {
- boolean exists = false;
- long attr_id = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Aexists()
+ {
+ boolean exists = false;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
long attribute_id = HDF5Constants.H5I_INVALID_HID;
try {
@@ -662,14 +792,14 @@ public class TestH5A {
assertFalse("H5Aexists ", exists);
try {
- attr_id = H5.H5Acreate(H5fid, "dset", type_id, space_id,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- exists = H5.H5Aexists(H5fid, "dset");
+ attr_id = H5.H5Acreate(H5fid, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
+ exists = H5.H5Aexists(H5fid, "dset");
assertTrue("H5Aexists ", exists);
- attribute_id = H5.H5Acreate_by_name(H5fid, ".", "attribute",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
+ attribute_id =
+ H5.H5Acreate_by_name(H5fid, ".", "attribute", type_id, space_id, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, lapl_id);
exists = H5.H5Aexists(H5fid, "attribute");
assertTrue("H5Aexists ", exists);
}
@@ -679,35 +809,41 @@ public class TestH5A {
}
finally {
if (attr_id > 0)
- try {H5.H5Aclose(attr_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr_id);
+ }
+ catch (Exception ex) {
+ }
if (attribute_id > 0)
- try {H5.H5Aclose(attribute_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attribute_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Adelete_by_idx_order() {
+ public void testH5Adelete_by_idx_order()
+ {
boolean exists = false;
- long attr1_id = HDF5Constants.H5I_INVALID_HID;
- long attr2_id = HDF5Constants.H5I_INVALID_HID;
- long attr3_id = HDF5Constants.H5I_INVALID_HID;
- long attr4_id = HDF5Constants.H5I_INVALID_HID;
+ long attr1_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
+ long attr3_id = HDF5Constants.H5I_INVALID_HID;
+ long attr4_id = HDF5Constants.H5I_INVALID_HID;
try {
- attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
-
- H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 3, lapl_id);
+ attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+
+ H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 3,
+ lapl_id);
exists = H5.H5Aexists(H5fid, "attribute4");
assertFalse("H5Adelete_by_idx: H5Aexists", exists);
}
@@ -717,34 +853,49 @@ public class TestH5A {
}
finally {
if (attr1_id > 0)
- try {H5.H5Aclose(attr1_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr1_id);
+ }
+ catch (Exception ex) {
+ }
if (attr2_id > 0)
- try {H5.H5Aclose(attr2_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr2_id);
+ }
+ catch (Exception ex) {
+ }
if (attr3_id > 0)
- try {H5.H5Aclose(attr3_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr3_id);
+ }
+ catch (Exception ex) {
+ }
if (attr4_id > 0)
- try {H5.H5Aclose(attr4_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr4_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Adelete_by_idx_name1() {
+ public void testH5Adelete_by_idx_name1()
+ {
boolean exists = false;
- long attr1_id = HDF5Constants.H5I_INVALID_HID;
- long attr2_id = HDF5Constants.H5I_INVALID_HID;
- long attr3_id = HDF5Constants.H5I_INVALID_HID;
+ long attr1_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
+ long attr3_id = HDF5Constants.H5I_INVALID_HID;
try {
- attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, lapl_id);
+ attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2,
+ lapl_id);
exists = H5.H5Aexists(H5fid, "attribute3");
assertFalse("H5Adelete_by_idx: H5Aexists", exists);
}
@@ -754,37 +905,47 @@ public class TestH5A {
}
finally {
if (attr1_id > 0)
- try {H5.H5Aclose(attr1_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr1_id);
+ }
+ catch (Exception ex) {
+ }
if (attr2_id > 0)
- try {H5.H5Aclose(attr2_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr2_id);
+ }
+ catch (Exception ex) {
+ }
if (attr3_id > 0)
- try {H5.H5Aclose(attr3_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr3_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Adelete_by_idx_name2() {
+ public void testH5Adelete_by_idx_name2()
+ {
boolean exists = false;
- long attr1_id = HDF5Constants.H5I_INVALID_HID;
- long attr2_id = HDF5Constants.H5I_INVALID_HID;
- long attr3_id = HDF5Constants.H5I_INVALID_HID;
- long attr4_id = HDF5Constants.H5I_INVALID_HID;
+ long attr1_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
+ long attr3_id = HDF5Constants.H5I_INVALID_HID;
+ long attr4_id = HDF5Constants.H5I_INVALID_HID;
try {
- attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
-
- H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_DEC, 3, lapl_id);
+ attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+
+ H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_DEC, 3,
+ lapl_id);
exists = H5.H5Aexists(H5fid, "attribute1");
assertFalse("H5Adelete_by_idx: H5Aexists", exists);
}
@@ -794,47 +955,66 @@ public class TestH5A {
}
finally {
if (attr1_id > 0)
- try {H5.H5Aclose(attr1_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr1_id);
+ }
+ catch (Exception ex) {
+ }
if (attr2_id > 0)
- try {H5.H5Aclose(attr2_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr2_id);
+ }
+ catch (Exception ex) {
+ }
if (attr3_id > 0)
- try {H5.H5Aclose(attr3_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr3_id);
+ }
+ catch (Exception ex) {
+ }
if (attr4_id > 0)
- try {H5.H5Aclose(attr4_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr4_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test(expected = NullPointerException.class)
- public void testH5Adelete_by_idx_null() throws Throwable {
- H5.H5Adelete_by_idx(H5fid, null, HDF5Constants.H5_INDEX_CRT_ORDER,
- HDF5Constants.H5_ITER_INC, 0, lapl_id);
+ public void testH5Adelete_by_idx_null() throws Throwable
+ {
+ H5.H5Adelete_by_idx(H5fid, null, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0,
+ lapl_id);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Adelete_by_idx_invalidobject() throws Throwable {
- H5.H5Adelete_by_idx(H5fid, "invalid", HDF5Constants.H5_INDEX_CRT_ORDER,
- HDF5Constants.H5_ITER_INC, 0, lapl_id);
+ public void testH5Adelete_by_idx_invalidobject() throws Throwable
+ {
+ H5.H5Adelete_by_idx(H5fid, "invalid", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0,
+ lapl_id);
}
@Test
- public void testH5Aopen_by_name() {
- String obj_name = ".";
- String attr_name = "DATASET";
+ public void testH5Aopen_by_name()
+ {
+ String obj_name = ".";
+ String attr_name = "DATASET";
long attribute_id = HDF5Constants.H5I_INVALID_HID;
- long aid = HDF5Constants.H5I_INVALID_HID;
+ long aid = HDF5Constants.H5I_INVALID_HID;
try {
- attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name,
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
+ attribute_id =
+ H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, lapl_id);
- //open Attribute by name
- if(attribute_id >= 0) {
+ // open Attribute by name
+ if (attribute_id >= 0) {
try {
aid = H5.H5Aopen_by_name(H5fid, obj_name, attr_name, HDF5Constants.H5P_DEFAULT, lapl_id);
- assertTrue("testH5Aopen_by_name: ", aid>=0);
+ assertTrue("testH5Aopen_by_name: ", aid >= 0);
}
- catch(Throwable err) {
+ catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Aopen_by_name " + err);
}
@@ -846,21 +1026,30 @@ public class TestH5A {
}
finally {
if (aid > 0)
- try {H5.H5Aclose(aid);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(aid);
+ }
+ catch (Exception ex) {
+ }
if (attribute_id > 0)
- try {H5.H5Aclose(attribute_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attribute_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Awrite_readVL() {
- String attr_name = "VLdata";
- long attr_id = HDF5Constants.H5I_INVALID_HID;
- long atype_id = HDF5Constants.H5I_INVALID_HID;
- long aspace_id = HDF5Constants.H5I_INVALID_HID;
- String[] str_data = { "Parting", "is such", "sweet", "sorrow." };
- long[] dims = { str_data.length };
- long lsize = 1;
+ public void testH5Awrite_readVL()
+ {
+ String attr_name = "VLdata";
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
+ long atype_id = HDF5Constants.H5I_INVALID_HID;
+ long aspace_id = HDF5Constants.H5I_INVALID_HID;
+ String[] str_data = {"Parting", "is such", "sweet", "sorrow."};
+ long[] dims = {str_data.length};
+ long lsize = 1;
try {
atype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
@@ -870,7 +1059,11 @@ public class TestH5A {
}
catch (Exception err) {
if (atype_id > 0)
- try {H5.H5Tclose(atype_id);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(atype_id);
+ }
+ catch (Exception ex) {
+ }
err.printStackTrace();
fail("H5.testH5Awrite_readVL: " + err);
}
@@ -878,8 +1071,8 @@ public class TestH5A {
try {
aspace_id = H5.H5Screate_simple(1, dims, null);
assertTrue(aspace_id > 0);
- attr_id = H5.H5Acreate(H5did, attr_name, atype_id, aspace_id,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ attr_id = H5.H5Acreate(H5did, attr_name, atype_id, aspace_id, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
assertTrue("testH5Awrite_readVL: ", attr_id >= 0);
H5.H5AwriteVL(attr_id, atype_id, str_data);
@@ -889,7 +1082,7 @@ public class TestH5A {
for (int j = 0; j < dims.length; j++) {
lsize *= dims[j];
}
- String[] strs = new String[(int) lsize];
+ String[] strs = new String[(int)lsize];
for (int j = 0; j < lsize; j++) {
strs[j] = "";
}
@@ -910,19 +1103,32 @@ public class TestH5A {
}
finally {
if (attr_id > 0)
- try {H5.H5Aclose(attr_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr_id);
+ }
+ catch (Exception ex) {
+ }
if (aspace_id > 0)
- try {H5.H5Sclose(aspace_id);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(aspace_id);
+ }
+ catch (Exception ex) {
+ }
if (atype_id > 0)
- try {H5.H5Tclose(atype_id);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(atype_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Aget_create_plist() {
- String attr_name = "DATASET1";
+ public void testH5Aget_create_plist()
+ {
+ String attr_name = "DATASET1";
int char_encoding = 0;
- long plist_id = HDF5Constants.H5I_INVALID_HID;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
long attribute_id = HDF5Constants.H5I_INVALID_HID;
try {
@@ -942,11 +1148,13 @@ public class TestH5A {
err.printStackTrace();
fail("H5Pget_char_encoding: " + err);
}
- assertTrue("testH5Aget_create_plist: get_char_encoding", char_encoding == HDF5Constants.H5T_CSET_ASCII);
+ assertTrue("testH5Aget_create_plist: get_char_encoding",
+ char_encoding == HDF5Constants.H5T_CSET_ASCII);
// Create an attribute for the dataset using the property list
try {
- attribute_id = H5.H5Acreate(H5fid, attr_name, type_id, space_id, plist_id, HDF5Constants.H5P_DEFAULT);
+ attribute_id =
+ H5.H5Acreate(H5fid, attr_name, type_id, space_id, plist_id, HDF5Constants.H5P_DEFAULT);
assertTrue("testH5Aget_create_plist: H5Acreate", attribute_id >= 0);
}
catch (Throwable err) {
@@ -967,7 +1175,8 @@ public class TestH5A {
err.printStackTrace();
fail("H5Pget_char_encoding: " + err);
}
- assertTrue("testH5Aget_create_plist: get_char_encoding", char_encoding == HDF5Constants.H5T_CSET_ASCII);
+ assertTrue("testH5Aget_create_plist: get_char_encoding",
+ char_encoding == HDF5Constants.H5T_CSET_ASCII);
}
catch (Throwable err) {
err.printStackTrace();
@@ -975,14 +1184,23 @@ public class TestH5A {
}
finally {
if (plist_id > 0)
- try {H5.H5Pclose(plist_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(plist_id);
+ }
+ catch (Exception ex) {
+ }
if (attribute_id > 0)
- try {H5.H5Aclose(attribute_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attribute_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Aiterate() {
+ public void testH5Aiterate()
+ {
long attr1_id = HDF5Constants.H5I_INVALID_HID;
long attr2_id = HDF5Constants.H5I_INVALID_HID;
long attr3_id = HDF5Constants.H5I_INVALID_HID;
@@ -990,48 +1208,56 @@ public class TestH5A {
class idata {
public String attr_name = null;
- idata(String name) {
- this.attr_name = name;
- }
+ idata(String name) { this.attr_name = name; }
}
class H5A_iter_data implements H5A_iterate_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
H5A_iterate_t iter_data = new H5A_iter_data();
class H5A_iter_callback implements H5A_iterate_cb {
- public int callback(long group, String name, H5A_info_t info, H5A_iterate_t op_data) {
+ public int callback(long group, String name, H5A_info_t info, H5A_iterate_t op_data)
+ {
idata id = new idata(name);
((H5A_iter_data)op_data).iterdata.add(id);
return 0;
}
}
try {
- attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
H5A_iterate_cb iter_cb = new H5A_iter_callback();
try {
- H5.H5Aiterate(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data);
+ H5.H5Aiterate(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0L, iter_cb,
+ iter_data);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Aiterate: " + err);
}
- assertFalse("H5Aiterate ",((H5A_iter_data)iter_data).iterdata.isEmpty());
- assertTrue("H5Aiterate "+((H5A_iter_data)iter_data).iterdata.size(),((H5A_iter_data)iter_data).iterdata.size()==4);
- assertTrue("H5Aiterate "+(((H5A_iter_data)iter_data).iterdata.get(0)).attr_name,(((H5A_iter_data)iter_data).iterdata.get(0)).attr_name.compareToIgnoreCase("attribute1")==0);
- assertTrue("H5Aiterate "+(((H5A_iter_data)iter_data).iterdata.get(1)).attr_name,(((H5A_iter_data)iter_data).iterdata.get(1)).attr_name.compareToIgnoreCase("attribute2")==0);
- assertTrue("H5Aiterate "+((idata)((H5A_iter_data)iter_data).iterdata.get(2)).attr_name,(((H5A_iter_data)iter_data).iterdata.get(2)).attr_name.compareToIgnoreCase("attribute3")==0);
- assertTrue("H5Aiterate "+((idata)((H5A_iter_data)iter_data).iterdata.get(3)).attr_name,((idata)((H5A_iter_data)iter_data).iterdata.get(3)).attr_name.compareToIgnoreCase("attribute4")==0);
+ assertFalse("H5Aiterate ", ((H5A_iter_data)iter_data).iterdata.isEmpty());
+ assertTrue("H5Aiterate " + ((H5A_iter_data)iter_data).iterdata.size(),
+ ((H5A_iter_data)iter_data).iterdata.size() == 4);
+ assertTrue(
+ "H5Aiterate " + (((H5A_iter_data)iter_data).iterdata.get(0)).attr_name,
+ (((H5A_iter_data)iter_data).iterdata.get(0)).attr_name.compareToIgnoreCase("attribute1") ==
+ 0);
+ assertTrue(
+ "H5Aiterate " + (((H5A_iter_data)iter_data).iterdata.get(1)).attr_name,
+ (((H5A_iter_data)iter_data).iterdata.get(1)).attr_name.compareToIgnoreCase("attribute2") ==
+ 0);
+ assertTrue(
+ "H5Aiterate " + ((idata)((H5A_iter_data)iter_data).iterdata.get(2)).attr_name,
+ (((H5A_iter_data)iter_data).iterdata.get(2)).attr_name.compareToIgnoreCase("attribute3") ==
+ 0);
+ assertTrue("H5Aiterate " + ((idata)((H5A_iter_data)iter_data).iterdata.get(3)).attr_name,
+ ((idata)((H5A_iter_data)iter_data).iterdata.get(3))
+ .attr_name.compareToIgnoreCase("attribute4") == 0);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1039,18 +1265,35 @@ public class TestH5A {
}
finally {
if (attr1_id > 0)
- try {H5.H5Aclose(attr1_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr1_id);
+ }
+ catch (Exception ex) {
+ }
if (attr2_id > 0)
- try {H5.H5Aclose(attr2_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr2_id);
+ }
+ catch (Exception ex) {
+ }
if (attr3_id > 0)
- try {H5.H5Aclose(attr3_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr3_id);
+ }
+ catch (Exception ex) {
+ }
if (attr4_id > 0)
- try {H5.H5Aclose(attr4_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr4_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Aiterate_by_name() {
+ public void testH5Aiterate_by_name()
+ {
long attr1_id = HDF5Constants.H5I_INVALID_HID;
long attr2_id = HDF5Constants.H5I_INVALID_HID;
long attr3_id = HDF5Constants.H5I_INVALID_HID;
@@ -1058,45 +1301,44 @@ public class TestH5A {
class idata {
public String attr_name = null;
- idata(String name) {
- this.attr_name = name;
- }
+ idata(String name) { this.attr_name = name; }
}
class H5A_iter_data implements H5A_iterate_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
H5A_iterate_t iter_data = new H5A_iter_data();
class H5A_iter_callback implements H5A_iterate_cb {
- public int callback(long group, String name, H5A_info_t info, H5A_iterate_t op_data) {
+ public int callback(long group, String name, H5A_info_t info, H5A_iterate_t op_data)
+ {
idata id = new idata(name);
((H5A_iter_data)op_data).iterdata.add(id);
return 0;
}
}
try {
- attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
- attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1",
- type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", type_id, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
H5A_iterate_cb iter_cb = new H5A_iter_callback();
try {
- H5.H5Aiterate_by_name(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT);
+ H5.H5Aiterate_by_name(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L,
+ iter_cb, iter_data, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Aiterate_by_name: " + err);
}
- assertFalse("H5Aiterate_by_name ",((H5A_iter_data)iter_data).iterdata.isEmpty());
- assertTrue("H5Aiterate_by_name "+((H5A_iter_data)iter_data).iterdata.size(),((H5A_iter_data)iter_data).iterdata.size()==4);
- assertTrue("H5Aiterate_by_name "+((idata)((H5A_iter_data)iter_data).iterdata.get(1)).attr_name,((idata)((H5A_iter_data)iter_data).iterdata.get(1)).attr_name.compareToIgnoreCase("attribute2")==0);
+ assertFalse("H5Aiterate_by_name ", ((H5A_iter_data)iter_data).iterdata.isEmpty());
+ assertTrue("H5Aiterate_by_name " + ((H5A_iter_data)iter_data).iterdata.size(),
+ ((H5A_iter_data)iter_data).iterdata.size() == 4);
+ assertTrue("H5Aiterate_by_name " + ((idata)((H5A_iter_data)iter_data).iterdata.get(1)).attr_name,
+ ((idata)((H5A_iter_data)iter_data).iterdata.get(1))
+ .attr_name.compareToIgnoreCase("attribute2") == 0);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1104,17 +1346,29 @@ public class TestH5A {
}
finally {
if (attr1_id > 0)
- try {H5.H5Aclose(attr1_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr1_id);
+ }
+ catch (Exception ex) {
+ }
if (attr2_id > 0)
- try {H5.H5Aclose(attr2_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr2_id);
+ }
+ catch (Exception ex) {
+ }
if (attr3_id > 0)
- try {H5.H5Aclose(attr3_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr3_id);
+ }
+ catch (Exception ex) {
+ }
if (attr4_id > 0)
- try {H5.H5Aclose(attr4_id);} catch (Exception ex) {}
+ try {
+ H5.H5Aclose(attr4_id);
+ }
+ catch (Exception ex) {
+ }
}
}
-
}
-
-
-
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);
}
}
-
}
diff --git a/java/test/TestH5D.java b/java/test/TestH5D.java
index dac3a9c..4bab1a9 100644
--- a/java/test/TestH5D.java
+++ b/java/test/TestH5D.java
@@ -33,46 +33,50 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5D {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_FILE = "testD.h5";
- private static final int DIM_X = 4;
- private static final int DIM_Y = 6;
- private static final int RANK = 2;
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5faplid = HDF5Constants.H5I_INVALID_HID;
- long H5dsid = HDF5Constants.H5I_INVALID_HID;
- long H5dtid = HDF5Constants.H5I_INVALID_HID;
- long H5did = HDF5Constants.H5I_INVALID_HID;
- long H5did0 = HDF5Constants.H5I_INVALID_HID;
- long H5dcpl_id = HDF5Constants.H5I_INVALID_HID;
- long[] H5dims = { DIM_X, DIM_Y };
+ private static final int DIM_X = 4;
+ private static final int DIM_Y = 6;
+ private static final int RANK = 2;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5faplid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5dtid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long H5did0 = HDF5Constants.H5I_INVALID_HID;
+ long H5dcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long[] H5dims = {DIM_X, DIM_Y};
// Values for the status of space allocation
enum H5D_space_status {
- H5D_SPACE_STATUS_ERROR(-1), H5D_SPACE_STATUS_NOT_ALLOCATED(0), H5D_SPACE_STATUS_PART_ALLOCATED(
- 1), H5D_SPACE_STATUS_ALLOCATED(2);
+ H5D_SPACE_STATUS_ERROR(-1),
+ H5D_SPACE_STATUS_NOT_ALLOCATED(0),
+ H5D_SPACE_STATUS_PART_ALLOCATED(1),
+ H5D_SPACE_STATUS_ALLOCATED(2);
private int code;
- H5D_space_status(int space_status) {
- this.code = space_status;
- }
+ H5D_space_status(int space_status) { this.code = space_status; }
- public int getCode() {
- return this.code;
- }
+ public int getCode() { return this.code; }
}
- private final void _deleteFile(String filename) {
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
- try {file.delete();}
- catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
- private final void _createPDataset(long fid, long dsid, String name, long dcpl_val) {
+ private final void _createPDataset(long fid, long dsid, String name, long dcpl_val)
+ {
try {
H5dcpl_id = H5.H5Pcreate(dcpl_val);
@@ -94,9 +98,8 @@ public class TestH5D {
}
try {
- H5did0 = H5.H5Dcreate(fid, name,
- HDF5Constants.H5T_STD_I32BE, dsid,
- HDF5Constants.H5P_DEFAULT, H5dcpl_id, HDF5Constants.H5P_DEFAULT);
+ H5did0 = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT,
+ H5dcpl_id, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -105,7 +108,8 @@ public class TestH5D {
assertTrue("TestH5D._createPDataset.H5Dcreate: ", H5did0 >= 0);
}
- private final void _createChunkDataset(long fid, long dsid, String name, long dapl) {
+ private final void _createChunkDataset(long fid, long dsid, String name, long dapl)
+ {
try {
H5dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE);
@@ -127,9 +131,8 @@ public class TestH5D {
}
try {
- H5did = H5.H5Dcreate(fid, name,
- HDF5Constants.H5T_STD_I32BE, dsid,
- HDF5Constants.H5P_DEFAULT, H5dcpl_id, dapl);
+ H5did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT,
+ H5dcpl_id, dapl);
}
catch (Throwable err) {
err.printStackTrace();
@@ -138,11 +141,11 @@ public class TestH5D {
assertTrue("TestH5D._createChunkDataset.H5Dcreate: ", H5did >= 0);
}
- private final void _createDataset(long fid, long dsid, String name, long dapl) {
+ private final void _createDataset(long fid, long dsid, String name, long dapl)
+ {
try {
- H5did = H5.H5Dcreate(fid, name,
- HDF5Constants.H5T_STD_I32BE, dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
+ H5did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, dapl);
}
catch (Throwable err) {
err.printStackTrace();
@@ -151,7 +154,8 @@ public class TestH5D {
assertTrue("TestH5D._createDataset.H5Dcreate: ", H5did >= 0);
}
- private final void _createVLDataset(long fid, long dsid, String name, long dapl) {
+ private final void _createVLDataset(long fid, long dsid, String name, long dapl)
+ {
try {
H5dtid = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
}
@@ -169,8 +173,8 @@ public class TestH5D {
fail("H5.H5Tset_size: " + err);
}
try {
- H5did = H5.H5Dcreate(fid, name, H5dtid, dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
+ H5did = H5.H5Dcreate(fid, name, H5dtid, dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, dapl);
}
catch (Throwable err) {
err.printStackTrace();
@@ -179,99 +183,153 @@ public class TestH5D {
assertTrue("TestH5D._createVLDataset.H5Dcreate: ", H5did >= 0);
}
- private final void _closeH5file() throws HDF5LibraryException {
+ private final void _closeH5file() throws HDF5LibraryException
+ {
if (H5dcpl_id >= 0)
- try {H5.H5Pclose(H5dcpl_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(H5dcpl_id);
+ }
+ catch (Exception ex) {
+ }
if (H5did0 >= 0)
- try {H5.H5Dclose(H5did0);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did0);
+ }
+ catch (Exception ex) {
+ }
if (H5did >= 0)
- try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception ex) {
+ }
if (H5dtid > 0)
- try {H5.H5Tclose(H5dtid);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(H5dtid);
+ }
+ catch (Exception ex) {
+ }
if (H5dsid > 0)
- try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid);
+ }
+ catch (Exception ex) {
+ }
if (H5fid > 0)
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
}
- private final void _openH5file(String filename, String dsetname, long dapl) {
- try {
- H5fid = H5.H5Fopen(filename,
- HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("TestH5D._openH5file: " + err);
- }
- assertTrue("TestH5D._openH5file: H5.H5Fopen: ",H5fid >= 0);
- try {
- H5did = H5.H5Dopen(H5fid, dsetname, dapl);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("TestH5D._openH5file: " + err);
- }
- assertTrue("TestH5D._openH5file: H5.H5Dopen: ",H5did >= 0);
- try {
- H5dsid = H5.H5Dget_space(H5did);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("TestH5D._openH5file: " + err);
- }
- assertTrue("TestH5D._openH5file: H5.H5Screate_simple: ",H5dsid > 0);
+ private final void _openH5file(String filename, String dsetname, long dapl)
+ {
+ try {
+ H5fid = H5.H5Fopen(filename, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5D._openH5file: " + err);
+ }
+ assertTrue("TestH5D._openH5file: H5.H5Fopen: ", H5fid >= 0);
+ try {
+ H5did = H5.H5Dopen(H5fid, dsetname, dapl);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5D._openH5file: " + err);
+ }
+ assertTrue("TestH5D._openH5file: H5.H5Dopen: ", H5did >= 0);
+ try {
+ H5dsid = H5.H5Dget_space(H5did);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5D._openH5file: " + err);
+ }
+ assertTrue("TestH5D._openH5file: H5.H5Screate_simple: ", H5dsid > 0);
}
@Before
- public void createH5file()
- throws NullPointerException, HDF5Exception {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
- System.out.print(testname.getMethodName());
+ public void createH5file() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
+ System.out.print(testname.getMethodName());
try {
H5faplid = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS);
- H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, H5faplid);
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, H5faplid);
H5dsid = H5.H5Screate_simple(RANK, H5dims, null);
}
catch (Throwable err) {
err.printStackTrace();
fail("TestH5D.createH5file: " + err);
}
- assertTrue("TestH5D.createH5file: H5.H5Fcreate: ",H5fid >= 0);
- assertTrue("TestH5D.createH5file: H5.H5Screate_simple: ",H5dsid >= 0);
+ assertTrue("TestH5D.createH5file: H5.H5Fcreate: ", H5fid >= 0);
+ assertTrue("TestH5D.createH5file: H5.H5Screate_simple: ", H5dsid >= 0);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5dcpl_id >= 0)
- try {H5.H5Pclose(H5dcpl_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(H5dcpl_id);
+ }
+ catch (Exception ex) {
+ }
if (H5did0 >= 0)
- try {H5.H5Dclose(H5did0);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did0);
+ }
+ catch (Exception ex) {
+ }
if (H5did >= 0)
- try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception ex) {
+ }
if (H5dtid > 0)
- try {H5.H5Tclose(H5dtid);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(H5dtid);
+ }
+ catch (Exception ex) {
+ }
if (H5dsid > 0)
- try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid);
+ }
+ catch (Exception ex) {
+ }
if (H5faplid >= 0)
- try {H5.H5Pclose(H5faplid);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(H5faplid);
+ }
+ catch (Exception ex) {
+ }
if (H5fid > 0)
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
_deleteFile(H5_FILE);
System.out.println();
}
@Test
- public void testH5Dcreate() {
+ public void testH5Dcreate()
+ {
long dataset_id = HDF5Constants.H5I_INVALID_HID;
try {
- dataset_id = H5.H5Dcreate(H5fid, "dset",
- HDF5Constants.H5T_STD_I32BE, H5dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ dataset_id =
+ H5.H5Dcreate(H5fid, "dset", HDF5Constants.H5T_STD_I32BE, H5dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
catch (Exception err) {
err.printStackTrace();
@@ -290,11 +348,12 @@ public class TestH5D {
}
@Test
- public void testH5Dcreate_anon() {
+ public void testH5Dcreate_anon()
+ {
long dataset_id = HDF5Constants.H5I_INVALID_HID;
try {
- dataset_id = H5.H5Dcreate_anon(H5fid, HDF5Constants.H5T_STD_I32BE,
- H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ dataset_id = H5.H5Dcreate_anon(H5fid, HDF5Constants.H5T_STD_I32BE, H5dsid,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
catch (Exception err) {
err.printStackTrace();
@@ -313,13 +372,14 @@ public class TestH5D {
}
@Test
- public void testH5Dopen() {
+ public void testH5Dopen()
+ {
long dataset_id = HDF5Constants.H5I_INVALID_HID;
_createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
try {
H5.H5Dclose(H5did);
- H5did = HDF5Constants.H5I_INVALID_HID;
+ H5did = HDF5Constants.H5I_INVALID_HID;
dataset_id = H5.H5Dopen(H5fid, "dset", HDF5Constants.H5P_DEFAULT);
}
catch (Exception err) {
@@ -339,7 +399,8 @@ public class TestH5D {
}
@Test
- public void testH5Dget_storage_size_empty() {
+ public void testH5Dget_storage_size_empty()
+ {
long storage_size = 0;
_createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
@@ -354,10 +415,11 @@ public class TestH5D {
}
@Test
- public void testH5Dget_storage_size() {
+ public void testH5Dget_storage_size()
+ {
long storage_size = 0;
int[][] dset_data = new int[DIM_X][DIM_Y];
- int FILLVAL = 99;
+ int FILLVAL = 99;
_createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
// Initialize the dataset.
@@ -367,9 +429,8 @@ public class TestH5D {
try {
if (H5did >= 0)
- H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data[0]);
+ H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data[0]);
}
catch (Exception e) {
e.printStackTrace();
@@ -382,21 +443,22 @@ public class TestH5D {
err.printStackTrace();
fail("testH5Dget_storage_size: " + err);
}
- assertTrue("testH5Dget_storage_size: "+storage_size, storage_size == DIM_X*DIM_Y*4);
+ assertTrue("testH5Dget_storage_size: " + storage_size, storage_size == DIM_X * DIM_Y * 4);
}
@Test
- public void testH5Dget_access_plist() {
- long dapl_id = HDF5Constants.H5I_INVALID_HID;
- long test_dapl_id = HDF5Constants.H5I_INVALID_HID;
- int[] mdc_nelmts1 = {0};
- int[] mdc_nelmts2 = {0};
+ public void testH5Dget_access_plist()
+ {
+ long dapl_id = HDF5Constants.H5I_INVALID_HID;
+ long test_dapl_id = HDF5Constants.H5I_INVALID_HID;
+ int[] mdc_nelmts1 = {0};
+ int[] mdc_nelmts2 = {0};
long[] rdcc_nelmts1 = {0};
long[] rdcc_nelmts2 = {0};
long[] rdcc_nbytes1 = {0};
long[] rdcc_nbytes2 = {0};
- double[] rdcc_w01 = {0};
- double[] rdcc_w02 = {0};
+ double[] rdcc_w01 = {0};
+ double[] rdcc_w02 = {0};
try {
test_dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS);
@@ -442,14 +504,15 @@ public class TestH5D {
catch (Exception err) {
err.printStackTrace();
}
- assertTrue("testH5Dget_access_plist: ", rdcc_nelmts2==rdcc_nelmts2 && rdcc_nbytes2==rdcc_nbytes2);
+ assertTrue("testH5Dget_access_plist: ", rdcc_nelmts2 == rdcc_nelmts2 && rdcc_nbytes2 == rdcc_nbytes2);
}
@Test
- public void testH5Dget_space_status() {
+ public void testH5Dget_space_status()
+ {
int[][] write_dset_data = new int[DIM_X][DIM_Y];
- int space_status = -1;
- int space_status0 = -1;
+ int space_status = -1;
+ int space_status0 = -1;
// Initialize the dataset.
for (int indx = 0; indx < DIM_X; indx++)
@@ -466,7 +529,8 @@ public class TestH5D {
catch (Exception e) {
e.printStackTrace();
}
- assertTrue("testH5Dget_space_status0 - H5.H5Dget_space_status: ", space_status0 == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode());
+ assertTrue("testH5Dget_space_status0 - H5.H5Dget_space_status: ",
+ space_status0 == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode());
// Retrieve and print space status and storage size for dset.
try {
@@ -475,12 +539,12 @@ public class TestH5D {
catch (Exception e) {
e.printStackTrace();
}
- assertFalse("testH5Dget_space_status - H5.H5Dget_space_status: ", space_status == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode());
+ assertFalse("testH5Dget_space_status - H5.H5Dget_space_status: ",
+ space_status == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode());
// Write the data to the dataset.
try {
- H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
HDF5Constants.H5P_DEFAULT, write_dset_data);
}
catch (Exception e) {
@@ -494,16 +558,18 @@ public class TestH5D {
catch (Exception e) {
e.printStackTrace();
}
- assertTrue("testH5Dget_space_status - H5.H5Dget_space_status: ", space_status == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode());
+ assertTrue("testH5Dget_space_status - H5.H5Dget_space_status: ",
+ space_status == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode());
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Dget_space_closed() throws Throwable {
+ public void testH5Dget_space_closed() throws Throwable
+ {
long dataset_id = HDF5Constants.H5I_INVALID_HID;
try {
- dataset_id = H5.H5Dcreate(H5fid, "dset",
- HDF5Constants.H5T_STD_I32BE, H5dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ dataset_id =
+ H5.H5Dcreate(H5fid, "dset", HDF5Constants.H5T_STD_I32BE, H5dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -516,7 +582,8 @@ public class TestH5D {
}
@Test
- public void testH5Dget_space() {
+ public void testH5Dget_space()
+ {
long dataspace_id = HDF5Constants.H5I_INVALID_HID;
_createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
@@ -540,12 +607,13 @@ public class TestH5D {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Dget_type_closed() throws Throwable {
+ public void testH5Dget_type_closed() throws Throwable
+ {
long dataset_id = HDF5Constants.H5I_INVALID_HID;
try {
- dataset_id = H5.H5Dcreate(H5fid, "dset",
- HDF5Constants.H5T_STD_I32BE, H5dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ dataset_id =
+ H5.H5Dcreate(H5fid, "dset", HDF5Constants.H5T_STD_I32BE, H5dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -558,7 +626,8 @@ public class TestH5D {
}
@Test
- public void testH5Dget_type() {
+ public void testH5Dget_type()
+ {
long datatype_id = HDF5Constants.H5I_INVALID_HID;
_createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
@@ -582,9 +651,10 @@ public class TestH5D {
}
@Test
- public void testH5Dget_offset() {
+ public void testH5Dget_offset()
+ {
int[][] write_dset_data = new int[DIM_X][DIM_Y];
- long dset_address = 0;
+ long dset_address = 0;
_createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
try {
@@ -600,8 +670,7 @@ public class TestH5D {
}
// Write the data to the dataset.
try {
- H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
HDF5Constants.H5P_DEFAULT, write_dset_data);
}
catch (Exception e) {
@@ -621,15 +690,16 @@ public class TestH5D {
}
@Test
- public void testH5Dfill_null() {
- int[] buf_data = new int[DIM_X*DIM_Y];
+ public void testH5Dfill_null()
+ {
+ int[] buf_data = new int[DIM_X * DIM_Y];
// Initialize memory buffer
for (int indx = 0; indx < DIM_X; indx++)
for (int jndx = 0; jndx < DIM_Y; jndx++) {
buf_data[(indx * DIM_Y) + jndx] = indx * jndx - jndx;
}
- byte[] buf_array = HDFNativeData.intToByte(0, DIM_X*DIM_Y, buf_data);
+ byte[] buf_array = HDFNativeData.intToByte(0, DIM_X * DIM_Y, buf_data);
// Fill selection in memory
try {
@@ -644,12 +714,13 @@ public class TestH5D {
// Verify memory buffer the hard way
for (int indx = 0; indx < DIM_X; indx++)
for (int jndx = 0; jndx < DIM_Y; jndx++)
- assertTrue("H5.H5Dfill: [" + indx+","+jndx + "] ", buf_data[(indx * DIM_Y) + jndx] == 0);
+ assertTrue("H5.H5Dfill: [" + indx + "," + jndx + "] ", buf_data[(indx * DIM_Y) + jndx] == 0);
}
@Test
- public void testH5Dfill() {
- int[] buf_data = new int[DIM_X*DIM_Y];
+ public void testH5Dfill()
+ {
+ int[] buf_data = new int[DIM_X * DIM_Y];
byte[] fill_value = HDFNativeData.intToByte(254);
// Initialize memory buffer
@@ -657,11 +728,12 @@ public class TestH5D {
for (int jndx = 0; jndx < DIM_Y; jndx++) {
buf_data[(indx * DIM_Y) + jndx] = indx * jndx - jndx;
}
- byte[] buf_array = HDFNativeData.intToByte(0, DIM_X*DIM_Y, buf_data);
+ byte[] buf_array = HDFNativeData.intToByte(0, DIM_X * DIM_Y, buf_data);
// Fill selection in memory
try {
- H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid);
+ H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT,
+ H5dsid);
}
catch (Exception err) {
err.printStackTrace();
@@ -672,46 +744,51 @@ public class TestH5D {
// Verify memory buffer the hard way
for (int indx = 0; indx < DIM_X; indx++)
for (int jndx = 0; jndx < DIM_Y; jndx++)
- assertTrue("H5.H5Dfill: [" + indx+","+jndx + "] ", buf_data[(indx * DIM_Y) + jndx] == 254);
+ assertTrue("H5.H5Dfill: [" + indx + "," + jndx + "] ",
+ buf_data[(indx * DIM_Y) + jndx] == 254);
}
@Test
- public void testH5Diterate() {
+ public void testH5Diterate()
+ {
final int SPACE_RANK = 2;
final int SPACE_FILL = 254;
class H5D_iter_data implements H5D_iterate_t {
- public int fill_value; /* The fill value to check */
- public long fill_curr_coord; /* Current coordinate to examine */
- public long[] fill_coords; /* Pointer to selection's coordinates */
+ public int fill_value; /* The fill value to check */
+ public long fill_curr_coord; /* Current coordinate to examine */
+ public long[] fill_coords; /* Pointer to selection's coordinates */
}
H5D_iterate_t iter_data = new H5D_iter_data();
class H5D_iter_callback implements H5D_iterate_cb {
- public int callback(byte[] elem_buf, long elem_id, int ndim, long[] point, H5D_iterate_t op_data) {
- //Check value in current buffer location
+ public int callback(byte[] elem_buf, long elem_id, int ndim, long[] point, H5D_iterate_t op_data)
+ {
+ // Check value in current buffer location
int element = HDFNativeData.byteToInt(elem_buf, 0);
- if(element != ((H5D_iter_data)op_data).fill_value)
+ if (element != ((H5D_iter_data)op_data).fill_value)
return -1;
- //Check number of dimensions
- if(ndim != SPACE_RANK)
- return(-1);
- //Check Coordinates
+ // Check number of dimensions
+ if (ndim != SPACE_RANK)
+ return (-1);
+ // Check Coordinates
long[] fill_coords = new long[2];
- fill_coords[0] = ((H5D_iter_data)op_data).fill_coords[(int) (2 * ((H5D_iter_data)op_data).fill_curr_coord)];
- fill_coords[1] = ((H5D_iter_data)op_data).fill_coords[(int) (2 * ((H5D_iter_data)op_data).fill_curr_coord) + 1];
+ fill_coords[0] =
+ ((H5D_iter_data)op_data).fill_coords[(int)(2 * ((H5D_iter_data)op_data).fill_curr_coord)];
+ fill_coords[1] = ((H5D_iter_data)op_data)
+ .fill_coords[(int)(2 * ((H5D_iter_data)op_data).fill_curr_coord) + 1];
((H5D_iter_data)op_data).fill_curr_coord++;
- if(fill_coords[0] != point[0])
- return(-1);
- if(fill_coords[1] != point[1])
- return(-1);
+ if (fill_coords[0] != point[0])
+ return (-1);
+ if (fill_coords[1] != point[1])
+ return (-1);
- return(0);
+ return (0);
}
}
- int[] buf_data = new int[DIM_X*DIM_Y];
+ int[] buf_data = new int[DIM_X * DIM_Y];
byte[] fill_value = HDFNativeData.intToByte(SPACE_FILL);
// Initialize memory buffer
@@ -719,11 +796,12 @@ public class TestH5D {
for (int jndx = 0; jndx < DIM_Y; jndx++) {
buf_data[(indx * DIM_Y) + jndx] = indx * jndx - jndx;
}
- byte[] buf_array = HDFNativeData.intToByte(0, DIM_X*DIM_Y, buf_data);
+ byte[] buf_array = HDFNativeData.intToByte(0, DIM_X * DIM_Y, buf_data);
// Fill selection in memory
try {
- H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid);
+ H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT,
+ H5dsid);
}
catch (Exception err) {
err.printStackTrace();
@@ -731,19 +809,20 @@ public class TestH5D {
}
// Initialize the iterator structure
- ((H5D_iter_data)iter_data).fill_value = SPACE_FILL;
+ ((H5D_iter_data)iter_data).fill_value = SPACE_FILL;
((H5D_iter_data)iter_data).fill_curr_coord = 0;
// Set the coordinates of the selection
- ((H5D_iter_data)iter_data).fill_coords = new long[DIM_X*DIM_Y*SPACE_RANK]; /* Coordinates of selection */
+ ((H5D_iter_data)iter_data).fill_coords =
+ new long[DIM_X * DIM_Y * SPACE_RANK]; /* Coordinates of selection */
for (int indx = 0; indx < DIM_X; indx++)
for (int jndx = 0; jndx < DIM_Y; jndx++) {
- ((H5D_iter_data)iter_data).fill_coords[2*(indx * DIM_Y + jndx)] = indx;
- ((H5D_iter_data)iter_data).fill_coords[2*(indx * DIM_Y + jndx) + 1] = jndx;
+ ((H5D_iter_data)iter_data).fill_coords[2 * (indx * DIM_Y + jndx)] = indx;
+ ((H5D_iter_data)iter_data).fill_coords[2 * (indx * DIM_Y + jndx) + 1] = jndx;
} /* end for */
// Iterate through selection, verifying correct data
H5D_iterate_cb iter_cb = new H5D_iter_callback();
- int op_status = -1;
+ int op_status = -1;
try {
op_status = H5.H5Diterate(buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid, iter_cb, iter_data);
}
@@ -755,47 +834,51 @@ public class TestH5D {
}
@Test
- public void testH5Diterate_write() {
+ public void testH5Diterate_write()
+ {
final int SPACE_RANK = 2;
final int SPACE_FILL = 254;
class H5D_iter_data implements H5D_iterate_t {
- public int fill_value; /* The fill value to check */
- public long fill_curr_coord; /* Current coordinate to examine */
- public long[] fill_coords; /* Pointer to selection's coordinates */
+ public int fill_value; /* The fill value to check */
+ public long fill_curr_coord; /* Current coordinate to examine */
+ public long[] fill_coords; /* Pointer to selection's coordinates */
}
H5D_iterate_t iter_data = new H5D_iter_data();
class H5D_iter_callback implements H5D_iterate_cb {
- public int callback(byte[] elem_buf, long elem_id, int ndim, long[] point, H5D_iterate_t op_data) {
- //Check value in current buffer location
+ public int callback(byte[] elem_buf, long elem_id, int ndim, long[] point, H5D_iterate_t op_data)
+ {
+ // Check value in current buffer location
int element = HDFNativeData.byteToInt(elem_buf, 0);
- if(element != ((H5D_iter_data)op_data).fill_value)
+ if (element != ((H5D_iter_data)op_data).fill_value)
return -1;
- //Check number of dimensions
- if(ndim != SPACE_RANK)
- return(-1);
- //Check Coordinates
+ // Check number of dimensions
+ if (ndim != SPACE_RANK)
+ return (-1);
+ // Check Coordinates
long[] fill_coords = new long[2];
- fill_coords[0] = ((H5D_iter_data)op_data).fill_coords[(int) (2 * ((H5D_iter_data)op_data).fill_curr_coord)];
- fill_coords[1] = ((H5D_iter_data)op_data).fill_coords[(int) (2 * ((H5D_iter_data)op_data).fill_curr_coord) + 1];
+ fill_coords[0] =
+ ((H5D_iter_data)op_data).fill_coords[(int)(2 * ((H5D_iter_data)op_data).fill_curr_coord)];
+ fill_coords[1] = ((H5D_iter_data)op_data)
+ .fill_coords[(int)(2 * ((H5D_iter_data)op_data).fill_curr_coord) + 1];
((H5D_iter_data)op_data).fill_curr_coord++;
- if(fill_coords[0] != point[0])
- return(-1);
- if(fill_coords[1] != point[1])
- return(-1);
+ if (fill_coords[0] != point[0])
+ return (-1);
+ if (fill_coords[1] != point[1])
+ return (-1);
element -= 128;
byte[] new_elembuf = HDFNativeData.intToByte(element);
- elem_buf[0] = new_elembuf[0];
- elem_buf[1] = new_elembuf[1];
- elem_buf[2] = new_elembuf[2];
- elem_buf[3] = new_elembuf[3];
- return(0);
+ elem_buf[0] = new_elembuf[0];
+ elem_buf[1] = new_elembuf[1];
+ elem_buf[2] = new_elembuf[2];
+ elem_buf[3] = new_elembuf[3];
+ return (0);
}
}
- int[] buf_data = new int[DIM_X*DIM_Y];
+ int[] buf_data = new int[DIM_X * DIM_Y];
byte[] fill_value = HDFNativeData.intToByte(SPACE_FILL);
// Initialize memory buffer
@@ -803,11 +886,12 @@ public class TestH5D {
for (int jndx = 0; jndx < DIM_Y; jndx++) {
buf_data[(indx * DIM_Y) + jndx] = indx * jndx - jndx;
}
- byte[] buf_array = HDFNativeData.intToByte(0, DIM_X*DIM_Y, buf_data);
+ byte[] buf_array = HDFNativeData.intToByte(0, DIM_X * DIM_Y, buf_data);
// Fill selection in memory
try {
- H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid);
+ H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT,
+ H5dsid);
}
catch (Exception err) {
err.printStackTrace();
@@ -815,19 +899,20 @@ public class TestH5D {
}
// Initialize the iterator structure
- ((H5D_iter_data)iter_data).fill_value = SPACE_FILL;
+ ((H5D_iter_data)iter_data).fill_value = SPACE_FILL;
((H5D_iter_data)iter_data).fill_curr_coord = 0;
// Set the coordinates of the selection
- ((H5D_iter_data)iter_data).fill_coords = new long[DIM_X*DIM_Y*SPACE_RANK]; /* Coordinates of selection */
+ ((H5D_iter_data)iter_data).fill_coords =
+ new long[DIM_X * DIM_Y * SPACE_RANK]; /* Coordinates of selection */
for (int indx = 0; indx < DIM_X; indx++)
for (int jndx = 0; jndx < DIM_Y; jndx++) {
- ((H5D_iter_data)iter_data).fill_coords[2*(indx * DIM_Y + jndx)] = indx;
- ((H5D_iter_data)iter_data).fill_coords[2*(indx * DIM_Y + jndx) + 1] = jndx;
+ ((H5D_iter_data)iter_data).fill_coords[2 * (indx * DIM_Y + jndx)] = indx;
+ ((H5D_iter_data)iter_data).fill_coords[2 * (indx * DIM_Y + jndx) + 1] = jndx;
} /* end for */
// Iterate through selection, verifying correct data
H5D_iterate_cb iter_cb = new H5D_iter_callback();
- int op_status = -1;
+ int op_status = -1;
try {
op_status = H5.H5Diterate(buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid, iter_cb, iter_data);
}
@@ -842,29 +927,27 @@ public class TestH5D {
// Verify memory buffer the hard way
for (int indx = 0; indx < DIM_X; indx++)
for (int jndx = 0; jndx < DIM_Y; jndx++)
- assertTrue("H5.H5Diterate: [" + indx+","+jndx + "] "+buf_data[(indx * DIM_Y) + jndx], buf_data[(indx * DIM_Y) + jndx] == 126);
+ assertTrue("H5.H5Diterate: [" + indx + "," + jndx + "] " + buf_data[(indx * DIM_Y) + jndx],
+ buf_data[(indx * DIM_Y) + jndx] == 126);
}
@Test
- public void testH5Dvlen_get_buf_size() {
- String[] str_data = { "Parting", "is such", "sweet", "sorrow.",
- "Testing", "one", "two", "three.",
- "Dog,", "man's", "best", "friend.",
- "Diamonds", "are", "a", "girls!",
- "S A", "T U R", "D A Y", "night",
- "That's", "all", "folks", "!!!" };
- long vl_size = -1; /* Number of bytes used */
+ public void testH5Dvlen_get_buf_size()
+ {
+ String[] str_data = {"Parting", "is such", "sweet", "sorrow.", "Testing", "one", "two", "three.",
+ "Dog,", "man's", "best", "friend.", "Diamonds", "are", "a", "girls!",
+ "S A", "T U R", "D A Y", "night", "That's", "all", "folks", "!!!"};
+ long vl_size = -1; /* Number of bytes used */
long str_data_bytes = 0;
for (int idx = 0; idx < str_data.length; idx++)
- str_data_bytes += str_data[idx].length() + 1; //Account for terminating null
+ str_data_bytes += str_data[idx].length() + 1; // Account for terminating null
_createVLDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
try {
if ((H5did >= 0) && (H5dtid >= 0))
- H5.H5Dwrite_VLStrings(H5did, H5dtid,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, str_data);
+ H5.H5Dwrite_VLStrings(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, str_data);
}
catch (Exception e) {
e.printStackTrace();
@@ -879,63 +962,55 @@ public class TestH5D {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Dvlen_read_invalid_buffer() throws Throwable {
- String[] str_data = { "Parting", "is such", "sweet", "sorrow.",
- "Testing", "one", "two", "three.",
- "Dog,", "man's", "best", "friend.",
- "Diamonds", "are", "a", "girls!",
- "S A", "T U R", "D A Y", "night",
- "That's", "all", "folks", "!!!" };
- byte[] read_data = new byte[512];
+ public void testH5Dvlen_read_invalid_buffer() throws Throwable
+ {
+ String[] str_data = {"Parting", "is such", "sweet", "sorrow.", "Testing", "one", "two", "three.",
+ "Dog,", "man's", "best", "friend.", "Diamonds", "are", "a", "girls!",
+ "S A", "T U R", "D A Y", "night", "That's", "all", "folks", "!!!"};
+ byte[] read_data = new byte[512];
_createVLDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
try {
- H5.H5Dwrite_VLStrings(H5did, H5dtid,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, str_data);
+ H5.H5Dwrite_VLStrings(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, str_data);
}
catch (Exception e) {
e.printStackTrace();
}
- H5.H5Dread(H5did, H5dtid,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, read_data);
+ H5.H5Dread(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT,
+ read_data);
}
@Test
- public void testH5Dvlen_write_read() {
- String[] str_wdata = { "Parting", "is such", "sweet", "sorrow.",
- "Testing", "one", "two", "three.",
- "Dog,", "man's", "best", "friend.",
- "Diamonds", "are", "a", "girls!",
- "S A", "T U R", "D A Y", "night",
- "That's", "all", "folks", "!!!" };
+ public void testH5Dvlen_write_read()
+ {
+ String[] str_wdata = {"Parting", "is such", "sweet", "sorrow.", "Testing", "one", "two", "three.",
+ "Dog,", "man's", "best", "friend.", "Diamonds", "are", "a", "girls!",
+ "S A", "T U R", "D A Y", "night", "That's", "all", "folks", "!!!"};
String[] str_rdata = new String[DIM_X * DIM_Y];
_createVLDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
try {
if ((H5did >= 0) && (H5dtid >= 0))
- H5.H5Dwrite_VLStrings(H5did, H5dtid,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, str_wdata);
+ H5.H5Dwrite_VLStrings(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, str_wdata);
}
catch (Exception e) {
e.printStackTrace();
}
try {
if ((H5did >= 0) && (H5dtid >= 0))
- H5.H5Dread_VLStrings(H5did, H5dtid,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, str_rdata);
+ H5.H5Dread_VLStrings(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, str_rdata);
}
catch (Exception e) {
e.printStackTrace();
}
for (int v = 0; v < DIM_X * DIM_Y; v++)
- assertTrue("testH5Dvlen_write_read " + str_wdata[v] + " == " + str_rdata[v], str_wdata[v] == str_wdata[v]);
+ assertTrue("testH5Dvlen_write_read " + str_wdata[v] + " == " + str_rdata[v],
+ str_wdata[v] == str_wdata[v]);
}
-
}
diff --git a/java/test/TestH5Dparams.java b/java/test/TestH5Dparams.java
index 3661139..e42e10b 100644
--- a/java/test/TestH5Dparams.java
+++ b/java/test/TestH5Dparams.java
@@ -13,6 +13,7 @@
package test;
import static org.junit.Assert.assertTrue;
+
import hdf.hdf5lib.H5;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
@@ -23,108 +24,128 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Dparams {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
@Before
- public void checkOpenIDs() {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void checkOpenIDs()
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
}
@After
- public void nextTestName() {
+ public void nextTestName()
+ {
System.out.println();
}
- @Test//(expected = HDF5LibraryException.class)
- public void testH5Dclose_invalid() throws Throwable {
+ @Test //(expected = HDF5LibraryException.class)
+ public void testH5Dclose_invalid() throws Throwable
+ {
long did = H5.H5Dclose(-1);
assertTrue(did == 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Dcreate_null() throws Throwable {
+ public void testH5Dcreate_null() throws Throwable
+ {
H5.H5Dcreate(-1, null, 0, 0, 0, 0, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Dcreate_invalid() throws Throwable {
+ public void testH5Dcreate_invalid() throws Throwable
+ {
H5.H5Dcreate(-1, "Bogus", -1, -1, -1, -1, -1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Dcreate_anon_invalid() throws Throwable {
+ public void testH5Dcreate_anon_invalid() throws Throwable
+ {
H5.H5Dcreate_anon(-1, -1, -1, -1, -1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Dget_access_plist_invalid() throws Throwable {
+ public void testH5Dget_access_plist_invalid() throws Throwable
+ {
H5.H5Dget_access_plist(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Dget_create_plist_invalid() throws Throwable {
+ public void testH5Dget_create_plist_invalid() throws Throwable
+ {
H5.H5Dget_create_plist(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Dget_offset_invalid() throws Throwable {
+ public void testH5Dget_offset_invalid() throws Throwable
+ {
H5.H5Dget_offset(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Dget_space_invalid() throws Throwable {
+ public void testH5Dget_space_invalid() throws Throwable
+ {
H5.H5Dget_space(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Dget_type_invalid() throws Throwable {
+ public void testH5Dget_type_invalid() throws Throwable
+ {
H5.H5Dget_type(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Dget_space_status_invalid() throws Throwable {
+ public void testH5Dget_space_status_invalid() throws Throwable
+ {
int status = H5.H5Dget_space_status(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Dset_extent_status_invalid() throws Throwable {
+ public void testH5Dset_extent_status_invalid() throws Throwable
+ {
long[] size = new long[2];
H5.H5Dset_extent(-1, size);
}
@Test(expected = NullPointerException.class)
- public void testH5Dset_extent_status_null() throws Throwable {
+ public void testH5Dset_extent_status_null() throws Throwable
+ {
H5.H5Dset_extent(-1, null);
}
@Test(expected = NullPointerException.class)
- public void testH5Dopen_null() throws Throwable {
+ public void testH5Dopen_null() throws Throwable
+ {
H5.H5Dopen(-1, null, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Dopen_invalid() throws Throwable {
+ public void testH5Dopen_invalid() throws Throwable
+ {
H5.H5Dopen(-1, "Bogus", 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Dvlen_get_buf_size_invalid() throws Throwable {
+ public void testH5Dvlen_get_buf_size_invalid() throws Throwable
+ {
H5.H5Dvlen_get_buf_size(-1, -1, -1);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Dget_storage_size_invalid() throws Throwable {
+ public void testH5Dget_storage_size_invalid() throws Throwable
+ {
H5.H5Dget_storage_size(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Dflush_invalid() throws Throwable {
+ public void testH5Dflush_invalid() throws Throwable
+ {
H5.H5Dflush(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Drefresh_invalid() throws Throwable {
+ public void testH5Drefresh_invalid() throws Throwable
+ {
H5.H5Drefresh(-1);
}
-
}
diff --git a/java/test/TestH5Dplist.java b/java/test/TestH5Dplist.java
index 774b9dd..b9e97f4 100644
--- a/java/test/TestH5Dplist.java
+++ b/java/test/TestH5Dplist.java
@@ -30,35 +30,42 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Dplist {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_FILE = "testDp.h5";
- private static final int DIM_X = 4;
- private static final int DIM_Y = 7;
- private static final int EDIM_X = 6;
- private static final int EDIM_Y = 10;
- private static final int CHUNK_X = 4;
- private static final int CHUNK_Y = 4;
- private static final int NDIMS = 2;
- private static final int FILLVAL = 99;
- private static final int RANK = 2;
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5dsid = HDF5Constants.H5I_INVALID_HID;
- long H5did = HDF5Constants.H5I_INVALID_HID;
- long H5dcpl_id = HDF5Constants.H5I_INVALID_HID;
- long[] H5dims = { DIM_X, DIM_Y };
- long[] H5extdims = { EDIM_X, EDIM_Y };
- long[] H5chunk_dims = { CHUNK_X, CHUNK_Y };
- long[] H5maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED };
-
- private final void _deleteFile(String filename) {
+ private static final int DIM_X = 4;
+ private static final int DIM_Y = 7;
+ private static final int EDIM_X = 6;
+ private static final int EDIM_Y = 10;
+ private static final int CHUNK_X = 4;
+ private static final int CHUNK_Y = 4;
+ private static final int NDIMS = 2;
+ private static final int FILLVAL = 99;
+ private static final int RANK = 2;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long H5dcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long[] H5dims = {DIM_X, DIM_Y};
+ long[] H5extdims = {EDIM_X, EDIM_Y};
+ long[] H5chunk_dims = {CHUNK_X, CHUNK_Y};
+ long[] H5maxdims = {HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED};
+
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
- private final void _createPDataset(long fid, long dsid, String name, long dcpl_val) {
+ private final void _createPDataset(long fid, long dsid, String name, long dcpl_val)
+ {
try {
H5dcpl_id = H5.H5Pcreate(dcpl_val);
}
@@ -78,7 +85,7 @@ public class TestH5Dplist {
// Set the fill value for the dataset
try {
- int[] fill_value = { FILLVAL };
+ int[] fill_value = {FILLVAL};
H5.H5Pset_fill_value(H5dcpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value);
}
catch (Exception e) {
@@ -98,136 +105,151 @@ public class TestH5Dplist {
_createDataset(H5fid, H5dsid, "dset", H5dcpl_id, HDF5Constants.H5P_DEFAULT);
}
- private final void _createDataset(long fid, long dsid, String name, long dcpl, long dapl) {
+ private final void _createDataset(long fid, long dsid, String name, long dcpl, long dapl)
+ {
try {
- H5did = H5.H5Dcreate(fid, name,
- HDF5Constants.H5T_STD_I32BE, dsid,
- HDF5Constants.H5P_DEFAULT, dcpl, dapl);
+ H5did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT,
+ dcpl, dapl);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Dcreate: " + err);
}
- assertTrue("TestH5Dplist._createDataset: ",H5did > 0);
+ assertTrue("TestH5Dplist._createDataset: ", H5did > 0);
}
@Before
- public void createH5file() throws NullPointerException, HDF5Exception {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void createH5file() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
- H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5dsid = H5.H5Screate_simple(RANK, H5dims, H5maxdims);
}
catch (Throwable err) {
err.printStackTrace();
fail("TestH5Dplist.createH5file: " + err);
}
- assertTrue("TestH5Dplist.createH5file: H5.H5Fcreate: ",H5fid > 0);
- assertTrue("TestH5Dplist.createH5file: H5.H5Screate_simple: ",H5dsid > 0);
+ assertTrue("TestH5Dplist.createH5file: H5.H5Fcreate: ", H5fid > 0);
+ assertTrue("TestH5Dplist.createH5file: H5.H5Screate_simple: ", H5dsid > 0);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5dcpl_id >= 0)
- try {H5.H5Pclose(H5dcpl_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(H5dcpl_id);
+ }
+ catch (Exception ex) {
+ }
if (H5did > 0)
- try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception ex) {
+ }
if (H5dsid > 0)
- try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid);
+ }
+ catch (Exception ex) {
+ }
if (H5fid > 0)
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
_deleteFile(H5_FILE);
System.out.println();
}
- @Test
- public void testH5Dset_extent() {
- int[][] write_dset_data = new int[DIM_X][DIM_Y];
- int[][] read_dset_data = new int[DIM_X][DIM_Y];
- int[][] extend_dset_data = new int[EDIM_X][EDIM_Y];
-
- // Initialize the dataset.
- for (int indx = 0; indx < DIM_X; indx++)
- for (int jndx = 0; jndx < DIM_Y; jndx++)
- write_dset_data[indx][jndx] = indx * jndx - jndx;
-
- _createPDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DATASET_CREATE);
-
- // Read values from the dataset, which has not been written to yet.
- try {
- H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, read_dset_data);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- assertTrue("testH5Dset_extent - H5.H5Dread: ", read_dset_data[0][0] == 99);
-
- // Write the data to the dataset.
- try {
- H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, write_dset_data);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- // Read the data back.
- try {
- H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, read_dset_data);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- assertTrue("testH5Dset_extent - H5.H5Dread: ", read_dset_data[3][6] == 12);
-
- // Extend the dataset.
- try {
- H5.H5Dset_extent(H5did, H5extdims);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- // Read from the extended dataset.
- try {
- H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, extend_dset_data);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- assertTrue("testH5Dset_extent - H5.H5Dread: ", extend_dset_data[3][6] == 12);
- assertTrue("testH5Dset_extent - H5.H5Dread: ", extend_dset_data[4][8] == 99);
- }
-
- @Test
- public void testH5P_dset_no_attrs_hint() {
- boolean ret_val_id = true;
-
- _createPDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DATASET_CREATE);
-
- try {
- ret_val_id = H5.H5Pget_dset_no_attrs_hint(H5dcpl_id);
- assertFalse("H5P_dset_no_attrs_hint", ret_val_id);
- H5.H5Pset_dset_no_attrs_hint(H5dcpl_id, true);
- ret_val_id = H5.H5Pget_dset_no_attrs_hint(H5dcpl_id);
- assertTrue("H5P_dset_no_attrs_hint", ret_val_id);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5P_dset_no_attrs_hint: " + err);
- }
- }
+ @Test
+ public void testH5Dset_extent()
+ {
+ int[][] write_dset_data = new int[DIM_X][DIM_Y];
+ int[][] read_dset_data = new int[DIM_X][DIM_Y];
+ int[][] extend_dset_data = new int[EDIM_X][EDIM_Y];
+ // Initialize the dataset.
+ for (int indx = 0; indx < DIM_X; indx++)
+ for (int jndx = 0; jndx < DIM_Y; jndx++)
+ write_dset_data[indx][jndx] = indx * jndx - jndx;
+
+ _createPDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DATASET_CREATE);
+
+ // Read values from the dataset, which has not been written to yet.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, read_dset_data);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ assertTrue("testH5Dset_extent - H5.H5Dread: ", read_dset_data[0][0] == 99);
+
+ // Write the data to the dataset.
+ try {
+ H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, write_dset_data);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // Read the data back.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, read_dset_data);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ assertTrue("testH5Dset_extent - H5.H5Dread: ", read_dset_data[3][6] == 12);
+
+ // Extend the dataset.
+ try {
+ H5.H5Dset_extent(H5did, H5extdims);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // Read from the extended dataset.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, extend_dset_data);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ assertTrue("testH5Dset_extent - H5.H5Dread: ", extend_dset_data[3][6] == 12);
+ assertTrue("testH5Dset_extent - H5.H5Dread: ", extend_dset_data[4][8] == 99);
+ }
+
+ @Test
+ public void testH5P_dset_no_attrs_hint()
+ {
+ boolean ret_val_id = true;
+
+ _createPDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DATASET_CREATE);
+
+ try {
+ ret_val_id = H5.H5Pget_dset_no_attrs_hint(H5dcpl_id);
+ assertFalse("H5P_dset_no_attrs_hint", ret_val_id);
+ H5.H5Pset_dset_no_attrs_hint(H5dcpl_id, true);
+ ret_val_id = H5.H5Pget_dset_no_attrs_hint(H5dcpl_id);
+ assertTrue("H5P_dset_no_attrs_hint", ret_val_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5P_dset_no_attrs_hint: " + err);
+ }
+ }
}
diff --git a/java/test/TestH5Drw.java b/java/test/TestH5Drw.java
index 69fb9d7..b18bed7 100644
--- a/java/test/TestH5Drw.java
+++ b/java/test/TestH5Drw.java
@@ -33,77 +33,97 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Drw {
- @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 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 H5did = HDF5Constants.H5I_INVALID_HID;
+
+ private final void _closeH5file() throws HDF5LibraryException
+ {
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("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);
+ 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 {
+ public void closeH5file() throws HDF5LibraryException
+ {
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;
System.out.println();
}
@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 testH5Dread_8bit_ints() {
+ public void testH5Dread_8bit_ints()
+ {
byte[][] dset_data = new byte[DIM_X][DIM8_Y];
try {
@@ -117,7 +137,7 @@ public class TestH5Drw {
// Read data.
try {
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
+ HDF5Constants.H5P_DEFAULT, dset_data);
}
catch (Exception err) {
err.printStackTrace();
@@ -144,7 +164,7 @@ public class TestH5Drw {
// Read data.
try {
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
+ HDF5Constants.H5P_DEFAULT, dset_data);
}
catch (Exception err) {
err.printStackTrace();
@@ -153,7 +173,8 @@ public class TestH5Drw {
}
@Test
- public void testH5Dread_16bit_ints() {
+ public void testH5Dread_16bit_ints()
+ {
short[][] dset_data = new short[DIM_X][DIM16_Y];
try {
@@ -167,7 +188,7 @@ public class TestH5Drw {
// Read data.
try {
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT16, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
+ HDF5Constants.H5P_DEFAULT, dset_data);
}
catch (Exception err) {
err.printStackTrace();
@@ -194,7 +215,7 @@ public class TestH5Drw {
// Read data.
try {
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT16, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
+ HDF5Constants.H5P_DEFAULT, dset_data);
}
catch (Exception err) {
err.printStackTrace();
@@ -203,7 +224,8 @@ public class TestH5Drw {
}
@Test
- public void testH5Dread_32bit_ints() {
+ public void testH5Dread_32bit_ints()
+ {
int[][] dset_data = new int[DIM_X][DIM16_Y];
try {
@@ -217,7 +239,7 @@ public class TestH5Drw {
// Read data.
try {
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT32, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
+ HDF5Constants.H5P_DEFAULT, dset_data);
}
catch (Exception err) {
err.printStackTrace();
@@ -244,7 +266,7 @@ public class TestH5Drw {
// Read data.
try {
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT32, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
+ HDF5Constants.H5P_DEFAULT, dset_data);
}
catch (Exception err) {
err.printStackTrace();
@@ -253,7 +275,8 @@ public class TestH5Drw {
}
@Test
- public void testH5Dread_64bit_ints() {
+ public void testH5Dread_64bit_ints()
+ {
long[][] dset_data = new long[DIM_X][DIM64_Y];
try {
@@ -267,7 +290,7 @@ public class TestH5Drw {
// Read data.
try {
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT64, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
+ HDF5Constants.H5P_DEFAULT, dset_data);
}
catch (Exception err) {
err.printStackTrace();
@@ -294,7 +317,7 @@ public class TestH5Drw {
// Read data.
try {
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT64, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
+ HDF5Constants.H5P_DEFAULT, dset_data);
}
catch (Exception err) {
err.printStackTrace();
@@ -303,7 +326,8 @@ public class TestH5Drw {
}
@Test
- public void testH5Dread_32bit_floats() {
+ public void testH5Dread_32bit_floats()
+ {
float[][] dset_data = new float[DIM_X][DIM32_Y];
try {
@@ -317,7 +341,7 @@ public class TestH5Drw {
// Read data.
try {
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_FLOAT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
+ HDF5Constants.H5P_DEFAULT, dset_data);
}
catch (Exception err) {
err.printStackTrace();
@@ -328,7 +352,8 @@ public class TestH5Drw {
}
@Test
- public void testH5Dread_64bit_floats() {
+ public void testH5Dread_64bit_floats()
+ {
double[][] dset_data = new double[DIM_X][DIM64_Y];
try {
@@ -342,7 +367,7 @@ public class TestH5Drw {
// Read data.
try {
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
+ HDF5Constants.H5P_DEFAULT, dset_data);
}
catch (Exception err) {
err.printStackTrace();
@@ -353,7 +378,8 @@ public class TestH5Drw {
}
@Test
- public void testH5Dread_128bit_floats() {
+ public void testH5Dread_128bit_floats()
+ {
byte[][][] dset_data = new byte[DIM_X][DIM128_Y][8];
try {
@@ -367,12 +393,11 @@ public class TestH5Drw {
// Read data.
try {
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_LDOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
+ HDF5Constants.H5P_DEFAULT, dset_data);
}
catch (Exception err) {
err.printStackTrace();
fail("testH5Dread_128bit_floats: H5Dread: " + err);
}
}
-
}
diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java
index cad0a06..bdd6802 100644
--- a/java/test/TestH5E.java
+++ b/java/test/TestH5E.java
@@ -22,9 +22,9 @@ import java.util.ArrayList;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.callbacks.H5E_walk_cb;
import hdf.hdf5lib.callbacks.H5E_walk_t;
+import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5E_error2_t;
import org.junit.After;
@@ -35,20 +35,22 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5E {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
long hdf_java_classid = -1;
- long current_stackid = -1;
+ long current_stackid = -1;
@Before
- public void H5Eget_stack_class() {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void H5Eget_stack_class()
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
hdf_java_classid = -1;
try {
hdf_java_classid = H5.H5Eregister_class("HDF-Java-Error", "hdf-java", "2.5");
- current_stackid = H5.H5Eget_current_stack();
+ current_stackid = H5.H5Eget_current_stack();
}
catch (Throwable err) {
err.printStackTrace();
@@ -57,7 +59,8 @@ public class TestH5E {
}
@After
- public void H5Erestore_stack_class() {
+ public void H5Erestore_stack_class()
+ {
try {
H5.H5Eunregister_class(hdf_java_classid);
hdf_java_classid = -1;
@@ -72,14 +75,15 @@ public class TestH5E {
}
@Test
- public void testH5Eget_msg_major() {
+ public void testH5Eget_msg_major()
+ {
try {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (HDF5LibraryException hdferr) {
- long errnum = hdferr.getMajorErrorNumber();
- int[] error_msg_type = { HDF5Constants.H5E_MAJOR };
- String msg = null;
+ long errnum = hdferr.getMajorErrorNumber();
+ int[] error_msg_type = {HDF5Constants.H5E_MAJOR};
+ String msg = null;
try {
msg = H5.H5Eget_msg(errnum, error_msg_type);
@@ -92,11 +96,11 @@ public class TestH5E {
assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MAJOR, error_msg_type[0]);
/*
- * If HDF5_VOL_CONNECTOR is set, this might not be the
- * native connector and the error string might be different.
- * Only check for the specific error message if the native
- * connector is being used.
- */
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector and the error string might be different.
+ * Only check for the specific error message if the native
+ * connector is being used.
+ */
String connector = System.getenv("HDF5_VOL_CONNECTOR");
if (connector == null)
assertTrue("H5.H5Eget_msg: ", msg.contains("File accessibility"));
@@ -108,14 +112,15 @@ public class TestH5E {
}
@Test
- public void testH5Eget_msg_minor() {
+ public void testH5Eget_msg_minor()
+ {
try {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (HDF5LibraryException hdferr) {
- long errnum = hdferr.getMinorErrorNumber();
- int[] error_msg_type = { HDF5Constants.H5E_MINOR };
- String msg = null;
+ long errnum = hdferr.getMinorErrorNumber();
+ int[] error_msg_type = {HDF5Constants.H5E_MINOR};
+ String msg = null;
try {
msg = H5.H5Eget_msg(errnum, error_msg_type);
@@ -128,11 +133,11 @@ public class TestH5E {
assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MINOR, error_msg_type[0]);
/*
- * If HDF5_VOL_CONNECTOR is set, this might not be the
- * native connector and the error string might be different.
- * Only check for the specific error message if the native
- * connector is being used.
- */
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector and the error string might be different.
+ * Only check for the specific error message if the native
+ * connector is being used.
+ */
String connector = System.getenv("HDF5_VOL_CONNECTOR");
if (connector == null)
assertTrue("H5.H5Eget_msg: ", msg.contains("Unable to open file"));
@@ -144,9 +149,10 @@ public class TestH5E {
}
@Test
- public void testH5Epop() {
+ public void testH5Epop()
+ {
- long num_msg = -1;
+ long num_msg = -1;
long saved_num_msg = -1;
try {
@@ -213,13 +219,14 @@ public class TestH5E {
}
@Test
- public void testH5Epush() {
- String err_func = "testH5Epush";
- String err_msg = "Error message";
- long estack_id = -1;
- long maj_err_id = -1;
- long min_err_id = -1;
- long num_msg = -1;
+ public void testH5Epush()
+ {
+ String err_func = "testH5Epush";
+ String err_msg = "Error message";
+ long estack_id = -1;
+ long maj_err_id = -1;
+ long min_err_id = -1;
+ long num_msg = -1;
try {
try {
@@ -231,7 +238,8 @@ public class TestH5E {
fail("testH5Epush: H5.H5Ecreate_msg_major: " + err);
}
try {
- min_err_id = H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MINOR, "Error in Test Function");
+ min_err_id =
+ H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MINOR, "Error in Test Function");
assertFalse("H5.H5Ecreate_msg_minor: " + min_err_id, min_err_id < 0);
}
catch (Throwable err) {
@@ -257,7 +265,8 @@ public class TestH5E {
fail("testH5Epush: H5.H5Eget_num: " + err);
}
- H5.H5Epush(estack_id, "TestH5E.java", err_func, 354, hdf_java_classid, maj_err_id, min_err_id, err_msg);
+ H5.H5Epush(estack_id, "TestH5E.java", err_func, 354, hdf_java_classid, maj_err_id, min_err_id,
+ err_msg);
try {
num_msg = H5.H5Eget_num(estack_id);
@@ -274,24 +283,38 @@ public class TestH5E {
}
finally {
if (estack_id >= 0)
- try {H5.H5Eclose_stack(estack_id);} catch (Exception ex) {}
+ try {
+ H5.H5Eclose_stack(estack_id);
+ }
+ catch (Exception ex) {
+ }
if (maj_err_id >= 0)
- try {H5.H5Eclose_msg(maj_err_id);} catch (Exception ex) {}
+ try {
+ H5.H5Eclose_msg(maj_err_id);
+ }
+ catch (Exception ex) {
+ }
if (min_err_id >= 0)
- try {H5.H5Eclose_msg(min_err_id);} catch (Exception ex) {}
+ try {
+ H5.H5Eclose_msg(min_err_id);
+ }
+ catch (Exception ex) {
+ }
}
} /* end test_create() */
@Test
- public void testH5Ewalk() {
+ public void testH5Ewalk()
+ {
class wdata {
- public String err_desc = null;
+ public String err_desc = null;
public String func_name = null;
- public int line = -1;
- wdata(String desc, String func, int lineno) {
- this.err_desc = new String(desc);
+ public int line = -1;
+ wdata(String desc, String func, int lineno)
+ {
+ this.err_desc = new String(desc);
this.func_name = new String(func);
- this.line = lineno;
+ this.line = lineno;
}
}
class H5E_walk_data implements H5E_walk_t {
@@ -299,14 +322,15 @@ public class TestH5E {
}
H5E_walk_t walk_data = new H5E_walk_data();
class H5E_walk_callback implements H5E_walk_cb {
- public int callback(int nidx, H5E_error2_t info, H5E_walk_t op_data) {
+ public int callback(int nidx, H5E_error2_t info, H5E_walk_t op_data)
+ {
wdata wd = new wdata(info.desc, info.func_name, info.line);
((H5E_walk_data)op_data).walkdata.add(wd);
return 0;
}
}
H5E_walk_cb walk_cb = new H5E_walk_callback();
- long num_msg = -1;
+ long num_msg = -1;
try {
H5.H5Eset_current_stack(current_stackid);
@@ -346,9 +370,8 @@ public class TestH5E {
err.printStackTrace();
fail("testH5Ewalk:H5Ewalk2 " + err);
}
- assertFalse("testH5Ewalk:H5Ewalk2 ",((H5E_walk_data)walk_data).walkdata.isEmpty());
- assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size() > 0);
+ assertFalse("testH5Ewalk:H5Ewalk2 ", ((H5E_walk_data)walk_data).walkdata.isEmpty());
+ assertTrue("testH5Ewalk:H5Ewalk2 " + ((H5E_walk_data)walk_data).walkdata.size(),
+ ((H5E_walk_data)walk_data).walkdata.size() > 0);
}
-
}
-
diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java
index 9e93cea..c412cf2 100644
--- a/java/test/TestH5Edefault.java
+++ b/java/test/TestH5Edefault.java
@@ -15,25 +15,28 @@ package test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
-import org.junit.Ignore;
import org.junit.rules.TestName;
public class TestH5Edefault {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
public static final int ERRSTACK_CNT = 6;
@Before
- public void H5Eset_default_stack() {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void H5Eset_default_stack()
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
@@ -46,23 +49,26 @@ public class TestH5Edefault {
}
}
@After
- public void nextTestName() {
+ public void nextTestName()
+ {
System.out.println();
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eprint2_invalid_classid() throws Throwable {
+ public void testH5Eprint2_invalid_classid() throws Throwable
+ {
H5.H5Eprint2(-1, null);
}
@Ignore
- public void testH5Eprint() {
+ public void testH5Eprint()
+ {
/*
- * If HDF5_VOL_CONNECTOR is set, this might not be the
- * native connector and the error stack might be different.
- * Only check for the specific error stack if the native
- * connector is being used.
- */
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector and the error stack might be different.
+ * Only check for the specific error stack if the native
+ * connector is being used.
+ */
String connector = System.getenv("HDF5_VOL_CONNECTOR");
if (connector == null) {
try {
@@ -81,19 +87,20 @@ public class TestH5Edefault {
}
@Test
- public void testH5Eget_current_stack() {
- long num_msg = -1;
- long num_msg_default = -1;
- long saved_num_msg = -1;
- long stack_id = -1;
+ public void testH5Eget_current_stack()
+ {
+ long num_msg = -1;
+ long num_msg_default = -1;
+ long saved_num_msg = -1;
+ long stack_id = -1;
long stack_id_default = HDF5Constants.H5E_DEFAULT;
try {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- //default stack id will be different after exception
+ // default stack id will be different after exception
stack_id_default = HDF5Constants.H5E_DEFAULT;
- //err.printStackTrace(); //This will clear the error stack
+ // err.printStackTrace(); //This will clear the error stack
}
// Verify we have messages on the error stack
try {
@@ -147,16 +154,17 @@ public class TestH5Edefault {
}
@Test
- public void testH5Eget_current_stack_pop() {
- long num_msg = -1;
+ public void testH5Eget_current_stack_pop()
+ {
+ long num_msg = -1;
long num_msg_default = -1;
- long saved_num_msg = -1;
- long stack_id = -1;
+ long saved_num_msg = -1;
+ long stack_id = -1;
try {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- //err.printStackTrace(); //This will clear the error stack
+ // err.printStackTrace(); //This will clear the error stack
}
// Verify there are error messages on the stack and save it
@@ -179,7 +187,8 @@ public class TestH5Edefault {
fail("H5.H5Eget_current_stack: " + err);
}
assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id < 0);
- assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id == HDF5Constants.H5E_DEFAULT);
+ assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id,
+ stack_id == HDF5Constants.H5E_DEFAULT);
// Verify the stack is empty
try {
@@ -206,7 +215,7 @@ public class TestH5Edefault {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- //err.printStackTrace(); //This will clear the error stack
+ // err.printStackTrace(); //This will clear the error stack
}
// Verify we have a nonzero number of messages and save it
@@ -243,37 +252,44 @@ public class TestH5Edefault {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eclose_stack_invalid_stackid() throws Throwable {
+ public void testH5Eclose_stack_invalid_stackid() throws Throwable
+ {
H5.H5Eclose_stack(-1);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eget_class_name_invalid_classid() throws Throwable {
+ public void testH5Eget_class_name_invalid_classid() throws Throwable
+ {
H5.H5Eget_class_name(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Eget_class_name_invalid_classname() throws Throwable {
+ public void testH5Eget_class_name_invalid_classname() throws Throwable
+ {
H5.H5Eget_class_name(HDF5Constants.H5E_DEFAULT);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eclose_msg_invalid_errid() throws Throwable {
+ public void testH5Eclose_msg_invalid_errid() throws Throwable
+ {
H5.H5Eclose_msg(-1);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Ecreate_msg_invalid_errid() throws Throwable {
+ public void testH5Ecreate_msg_invalid_errid() throws Throwable
+ {
H5.H5Ecreate_msg(-1, HDF5Constants.H5E_MAJOR, "null");
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eget_msg_invalid_msgid() throws Throwable {
+ public void testH5Eget_msg_invalid_msgid() throws Throwable
+ {
H5.H5Eget_msg(-1, null);
}
@Test
- public void testH5Ecreate_stack() {
+ public void testH5Ecreate_stack()
+ {
try {
long stack_id = H5.H5Ecreate_stack();
assertTrue("H5.H5Ecreate_stack", stack_id > 0);
@@ -286,14 +302,16 @@ public class TestH5Edefault {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eset_current_stack_invalid_stkid() throws Throwable {
+ public void testH5Eset_current_stack_invalid_stkid() throws Throwable
+ {
H5.H5Eset_current_stack(-1);
}
@Test
- public void testH5Eset_current_stack() {
- long num_msg = -1;
- long stack_id = -1;
+ public void testH5Eset_current_stack()
+ {
+ long num_msg = -1;
+ long stack_id = -1;
long saved_num_msg = -1;
// Generate errors on the default stack
@@ -301,7 +319,7 @@ public class TestH5Edefault {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- //err.printStackTrace(); //This will clear the error stack
+ // err.printStackTrace(); //This will clear the error stack
}
// Verify we have a nonzero number of messages and save it
@@ -324,7 +342,8 @@ public class TestH5Edefault {
fail("H5.H5Eset_current_stack: " + err);
}
assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id, stack_id < 0);
- assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id, stack_id == HDF5Constants.H5E_DEFAULT);
+ assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id,
+ stack_id == HDF5Constants.H5E_DEFAULT);
// Verify the copy has the same number of messages as the original stack
try {
@@ -341,7 +360,7 @@ public class TestH5Edefault {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- //err.printStackTrace(); //This will clear the error stack
+ // err.printStackTrace(); //This will clear the error stack
}
// Verify we have the same number of messages as before
@@ -388,13 +407,15 @@ public class TestH5Edefault {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Epop_invalid_stkid() throws Throwable {
+ public void testH5Epop_invalid_stkid() throws Throwable
+ {
H5.H5Epop(-1, 0);
}
@Test
- public void testH5Epop() throws Throwable {
- long num_msg = -1;
+ public void testH5Epop() throws Throwable
+ {
+ long num_msg = -1;
long saved_num_msg = -1;
try {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
@@ -422,28 +443,33 @@ public class TestH5Edefault {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Epush_invalid_stkid() throws Throwable {
+ public void testH5Epush_invalid_stkid() throws Throwable
+ {
H5.H5Epush(-1, "Invalid", "Invalid", 0, -1, -1, -1, "Invalid message");
}
@Test(expected = NullPointerException.class)
- public void testH5Epush_null_name() throws Throwable {
- H5.H5Epush(HDF5Constants.H5E_DEFAULT, null, "Invalid", 0, HDF5Constants.H5E_DEFAULT, HDF5Constants.H5E_DEFAULT, HDF5Constants.H5E_DEFAULT, "Invalid message");
+ public void testH5Epush_null_name() throws Throwable
+ {
+ H5.H5Epush(HDF5Constants.H5E_DEFAULT, null, "Invalid", 0, HDF5Constants.H5E_DEFAULT,
+ HDF5Constants.H5E_DEFAULT, HDF5Constants.H5E_DEFAULT, "Invalid message");
}
@Test(expected = IllegalArgumentException.class)
- public void testH5EprintInt_invalid_classid() throws Throwable {
+ public void testH5EprintInt_invalid_classid() throws Throwable
+ {
H5.H5Eprint2(-1, null);
}
@Ignore
- public void testH5EprintInt() {
+ public void testH5EprintInt()
+ {
/*
- * If HDF5_VOL_CONNECTOR is set, this might not be the
- * native connector and the error stack might be different.
- * Only check for the specific error stack if the native
- * connector is being used.
- */
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector and the error stack might be different.
+ * Only check for the specific error stack if the native
+ * connector is being used.
+ */
String connector = System.getenv("HDF5_VOL_CONNECTOR");
if (connector == null) {
try {
@@ -462,7 +488,8 @@ public class TestH5Edefault {
}
@Test
- public void testH5EclearInt() {
+ public void testH5EclearInt()
+ {
try {
H5.H5Eclear(HDF5Constants.H5E_DEFAULT);
}
@@ -473,12 +500,14 @@ public class TestH5Edefault {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eclear2_invalid_stkid() throws Throwable {
+ public void testH5Eclear2_invalid_stkid() throws Throwable
+ {
H5.H5Eclear2(-1);
}
@Test
- public void testH5Eclear() {
+ public void testH5Eclear()
+ {
try {
H5.H5Eclear2(HDF5Constants.H5E_DEFAULT);
}
@@ -489,7 +518,8 @@ public class TestH5Edefault {
}
@Test
- public void testH5Eclear2_with_msg() {
+ public void testH5Eclear2_with_msg()
+ {
long num_msg = -1;
try {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
@@ -516,12 +546,14 @@ public class TestH5Edefault {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eauto_is_v2_invalid_stkid() throws Throwable {
+ public void testH5Eauto_is_v2_invalid_stkid() throws Throwable
+ {
H5.H5Eauto_is_v2(-1);
}
@Test
- public void testH5Eauto_is_v2() {
+ public void testH5Eauto_is_v2()
+ {
boolean is_v2 = false;
try {
is_v2 = H5.H5Eauto_is_v2(HDF5Constants.H5E_DEFAULT);
@@ -534,12 +566,14 @@ public class TestH5Edefault {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eget_num_invalid_stkid() throws Throwable {
+ public void testH5Eget_num_invalid_stkid() throws Throwable
+ {
H5.H5Eget_num(-1);
}
@Test
- public void testH5Eget_num() {
+ public void testH5Eget_num()
+ {
long num_msg = -1;
try {
num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
@@ -552,7 +586,8 @@ public class TestH5Edefault {
}
@Test
- public void testH5Eget_num_with_msg() {
+ public void testH5Eget_num_with_msg()
+ {
long num_msg = -1;
try {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
@@ -568,6 +603,4 @@ public class TestH5Edefault {
}
assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0);
}
-
}
-
diff --git a/java/test/TestH5Eparams.java b/java/test/TestH5Eparams.java
index e55f1fc..4300ae6 100644
--- a/java/test/TestH5Eparams.java
+++ b/java/test/TestH5Eparams.java
@@ -22,9 +22,9 @@ import java.util.ArrayList;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.callbacks.H5E_walk_cb;
import hdf.hdf5lib.callbacks.H5E_walk_t;
+import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5E_error2_t;
import org.junit.After;
@@ -35,19 +35,21 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Eparams {
- @Rule public TestName testname = new TestName();
- long hdf_java_classid = -1;
- long current_stackid = -1;
+ @Rule
+ public TestName testname = new TestName();
+ long hdf_java_classid = -1;
+ long current_stackid = -1;
@Before
- public void H5Eget_stack_class() {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void H5Eget_stack_class()
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
hdf_java_classid = -1;
try {
hdf_java_classid = H5.H5Eregister_class("HDF-Java-Error", "hdf-java", "2.5");
- current_stackid = H5.H5Eget_current_stack();
+ current_stackid = H5.H5Eget_current_stack();
}
catch (Throwable err) {
err.printStackTrace();
@@ -56,7 +58,8 @@ public class TestH5Eparams {
}
@After
- public void H5Erestore_stack_class() {
+ public void H5Erestore_stack_class()
+ {
try {
H5.H5Eunregister_class(hdf_java_classid);
hdf_java_classid = -1;
@@ -71,7 +74,8 @@ public class TestH5Eparams {
}
@Test
- public void testH5Eget_class_name() {
+ public void testH5Eget_class_name()
+ {
try {
String class_name = H5.H5Eget_class_name(hdf_java_classid);
assertNotNull("H5.H5Eget_class_name: " + class_name, class_name);
@@ -84,7 +88,8 @@ public class TestH5Eparams {
}
@Test
- public void testH5Eprint2() {
+ public void testH5Eprint2()
+ {
try {
assertFalse(current_stackid < 0);
H5.H5Eprint2(current_stackid, null);
@@ -96,17 +101,20 @@ public class TestH5Eparams {
}
@Ignore("Tested with create_msg_major[minor]")
- public void testH5Eclose_msg() {
+ public void testH5Eclose_msg()
+ {
fail("Not yet implemented");
}
@Test(expected = NullPointerException.class)
- public void testH5Ecreate_msg_name_null() throws Throwable {
+ public void testH5Ecreate_msg_name_null() throws Throwable
+ {
H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MAJOR, null);
}
@Test
- public void testH5Ecreate_msg_major() {
+ public void testH5Ecreate_msg_major()
+ {
try {
long err_id = H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MAJOR, "Error in Test");
assertFalse("H5.H5Ecreate_msg_major: " + err_id, err_id < 0);
@@ -119,9 +127,11 @@ public class TestH5Eparams {
}
@Test
- public void testH5Ecreate_msg_minor() {
+ public void testH5Ecreate_msg_minor()
+ {
try {
- long err_id = H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MINOR, "Error in Test Function");
+ long err_id =
+ H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MINOR, "Error in Test Function");
assertFalse("H5.H5Ecreate_msg_minor: " + err_id, err_id < 0);
H5.H5Eclose_msg(err_id);
}
@@ -132,10 +142,11 @@ public class TestH5Eparams {
}
@Test
- public void testH5Eget_msg() {
- int[] error_msg_type = { HDF5Constants.H5E_MINOR };
- long err_id = -1;
- String msg = null;
+ public void testH5Eget_msg()
+ {
+ int[] error_msg_type = {HDF5Constants.H5E_MINOR};
+ long err_id = -1;
+ String msg = null;
try {
err_id = H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MAJOR, "Error in Test");
}
@@ -164,7 +175,8 @@ public class TestH5Eparams {
}
@Test
- public void testH5Ecreate_stack() {
+ public void testH5Ecreate_stack()
+ {
long stk_id = -1;
try {
stk_id = H5.H5Ecreate_stack();
@@ -184,7 +196,8 @@ public class TestH5Eparams {
}
@Test
- public void testH5EprintInt() {
+ public void testH5EprintInt()
+ {
assertFalse(current_stackid < 0);
try {
H5.H5Eprint2(current_stackid, null);
@@ -196,7 +209,8 @@ public class TestH5Eparams {
}
@Test
- public void testH5EclearInt() {
+ public void testH5EclearInt()
+ {
try {
H5.H5Eclear(current_stackid);
}
@@ -207,7 +221,8 @@ public class TestH5Eparams {
}
@Test
- public void testH5Eclear2() {
+ public void testH5Eclear2()
+ {
try {
H5.H5Eclear2(current_stackid);
}
@@ -218,7 +233,8 @@ public class TestH5Eparams {
}
@Test
- public void testH5Eauto_is_v2() {
+ public void testH5Eauto_is_v2()
+ {
boolean is_v2 = false;
try {
is_v2 = H5.H5Eauto_is_v2(current_stackid);
@@ -231,7 +247,8 @@ public class TestH5Eparams {
}
@Test
- public void testH5Eget_num() {
+ public void testH5Eget_num()
+ {
long num_msg = -1;
try {
num_msg = H5.H5Eget_num(current_stackid);
@@ -244,7 +261,8 @@ public class TestH5Eparams {
}
@Test
- public void testH5Eget_num_with_msg() {
+ public void testH5Eget_num_with_msg()
+ {
try {
H5.H5Eset_current_stack(current_stackid);
}
@@ -277,5 +295,4 @@ public class TestH5Eparams {
}
assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0);
}
-
}
diff --git a/java/test/TestH5Eregister.java b/java/test/TestH5Eregister.java
index 99e8e5f..b4c63e0 100644
--- a/java/test/TestH5Eregister.java
+++ b/java/test/TestH5Eregister.java
@@ -14,6 +14,7 @@ package test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
import hdf.hdf5lib.H5;
import org.junit.After;
@@ -23,40 +24,48 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Eregister {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
@Before
- public void checkOpenIDs() {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void checkOpenIDs()
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
}
@After
- public void nextTestName() {
+ public void nextTestName()
+ {
System.out.println();
}
@Test(expected = NullPointerException.class)
- public void testH5Eregister_class_cls_name_null() throws Throwable {
+ public void testH5Eregister_class_cls_name_null() throws Throwable
+ {
H5.H5Eregister_class(null, "libname", "version");
}
@Test(expected = NullPointerException.class)
- public void testH5Eregister_class_lib_name_null() throws Throwable {
+ public void testH5Eregister_class_lib_name_null() throws Throwable
+ {
H5.H5Eregister_class("clsname", null, "version");
}
@Test(expected = NullPointerException.class)
- public void testH5Eregister_class_version_null() throws Throwable {
+ public void testH5Eregister_class_version_null() throws Throwable
+ {
H5.H5Eregister_class("clsname", "libname", null);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eunregister_class_invalid_classid() throws Throwable {
+ public void testH5Eunregister_class_invalid_classid() throws Throwable
+ {
H5.H5Eunregister_class(-1);
}
@Test
- public void testH5Eregister_class() {
+ public void testH5Eregister_class()
+ {
long hdf_java_classid = -1;
try {
hdf_java_classid = H5.H5Eregister_class("HDF-Java-Error", "hdf-java", "2.5");
diff --git a/java/test/TestH5F.java b/java/test/TestH5F.java
index 16786b9..fde2739 100644
--- a/java/test/TestH5F.java
+++ b/java/test/TestH5F.java
@@ -30,49 +30,58 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5F {
- @Rule public TestName testname = new TestName();
- private static final String H5_FILE = "testF.h5";
+ @Rule
+ public TestName testname = new TestName();
+ private static final String H5_FILE = "testF.h5";
private static final String H5_FILE2 = "testF2.h5";
- private static final int COUNT_OBJ_FILE = 1;
- private static final int COUNT_OBJ_DATASET = 0;
- private static final int COUNT_OBJ_GROUP = 0;
+ private static final int COUNT_OBJ_FILE = 1;
+ private static final int COUNT_OBJ_DATASET = 0;
+ private static final int COUNT_OBJ_GROUP = 0;
private static final int COUNT_OBJ_DATATYPE = 0;
- private static final int COUNT_OBJ_ATTR = 0;
- private static final int COUNT_OBJ_ALL = (COUNT_OBJ_FILE
- + COUNT_OBJ_DATASET + COUNT_OBJ_GROUP + COUNT_OBJ_DATATYPE + COUNT_OBJ_ATTR);
- private static final int[] OBJ_COUNTS = { COUNT_OBJ_FILE,
- COUNT_OBJ_DATASET, COUNT_OBJ_GROUP, COUNT_OBJ_DATATYPE,
- COUNT_OBJ_ATTR, COUNT_OBJ_ALL };
- private static final int[] OBJ_TYPES = { HDF5Constants.H5F_OBJ_FILE,
- HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP,
- HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR,
- HDF5Constants.H5F_OBJ_ALL };
- long H5fid = HDF5Constants.H5I_INVALID_HID;
-
- private final void _deleteFile(String filename) {
+ private static final int COUNT_OBJ_ATTR = 0;
+ private static final int COUNT_OBJ_ALL =
+ (COUNT_OBJ_FILE + COUNT_OBJ_DATASET + COUNT_OBJ_GROUP + COUNT_OBJ_DATATYPE + COUNT_OBJ_ATTR);
+ private static final int[] OBJ_COUNTS = {COUNT_OBJ_FILE, COUNT_OBJ_DATASET, COUNT_OBJ_GROUP,
+ COUNT_OBJ_DATATYPE, COUNT_OBJ_ATTR, COUNT_OBJ_ALL};
+ private static final int[] OBJ_TYPES = {HDF5Constants.H5F_OBJ_FILE, HDF5Constants.H5F_OBJ_DATASET,
+ HDF5Constants.H5F_OBJ_GROUP, HDF5Constants.H5F_OBJ_DATATYPE,
+ HDF5Constants.H5F_OBJ_ATTR, HDF5Constants.H5F_OBJ_ALL};
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
@Before
- public void createH5file()
- throws HDF5LibraryException, NullPointerException {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void createH5file() throws HDF5LibraryException, NullPointerException
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
- H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
H5fid = HDF5Constants.H5I_INVALID_HID;
}
_deleteFile(H5_FILE);
@@ -80,7 +89,8 @@ public class TestH5F {
}
@Test
- public void testH5Fget_create_plist() {
+ public void testH5Fget_create_plist()
+ {
long plist = HDF5Constants.H5I_INVALID_HID;
try {
@@ -90,13 +100,23 @@ public class TestH5F {
fail("H5.H5Fget_create_plist: " + err);
}
assertTrue(plist > 0);
- try {H5.H5Pclose(plist);} catch (HDF5LibraryException e) {e.printStackTrace();}
+ try {
+ H5.H5Pclose(plist);
+ }
+ catch (HDF5LibraryException e) {
+ e.printStackTrace();
+ }
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Fget_create_plist_closed() throws Throwable {
+ public void testH5Fget_create_plist_closed() throws Throwable
+ {
if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
}
// it should fail because the file was closed.
@@ -104,7 +124,8 @@ public class TestH5F {
}
@Test
- public void testH5Fget_access_plist() {
+ public void testH5Fget_access_plist()
+ {
long plist = HDF5Constants.H5I_INVALID_HID;
try {
@@ -114,13 +135,23 @@ public class TestH5F {
fail("H5.H5Fget_access_plist: " + err);
}
assertTrue(plist > 0);
- try {H5.H5Pclose(plist);} catch (HDF5LibraryException e) {e.printStackTrace();}
+ try {
+ H5.H5Pclose(plist);
+ }
+ catch (HDF5LibraryException e) {
+ e.printStackTrace();
+ }
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Fget_access_plist_closed() throws Throwable {
+ public void testH5Fget_access_plist_closed() throws Throwable
+ {
if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
}
// it should fail because the file was closed.
@@ -128,17 +159,21 @@ public class TestH5F {
}
@Test
- public void testH5Fget_intent_rdwr() {
+ public void testH5Fget_intent_rdwr()
+ {
int intent = 0;
if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
H5fid = HDF5Constants.H5I_INVALID_HID;
}
try {
- H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
- HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fopen: " + err);
@@ -153,17 +188,21 @@ public class TestH5F {
}
@Test
- public void testH5Fget_intent_rdonly() {
+ public void testH5Fget_intent_rdonly()
+ {
int intent = 0;
if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
H5fid = HDF5Constants.H5I_INVALID_HID;
}
try {
- H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY,
- HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fopen: " + err);
@@ -178,26 +217,26 @@ public class TestH5F {
}
@Test
- public void testH5Fget_fileno_same() {
+ public void testH5Fget_fileno_same()
+ {
long fileno1 = 0;
long fileno2 = 0;
- long fid1 = HDF5Constants.H5I_INVALID_HID;
- long fid2 = HDF5Constants.H5I_INVALID_HID;
+ long fid1 = HDF5Constants.H5I_INVALID_HID;
+ long fid2 = HDF5Constants.H5I_INVALID_HID;
try {
- fid1 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ fid1 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(fid1, HDF5Constants.H5F_SCOPE_LOCAL);
assertTrue("H5Fcreate failed", fid1 > 0);
- fid2 = H5.H5Fopen(H5_FILE2, HDF5Constants.H5F_ACC_RDWR,
- HDF5Constants.H5P_DEFAULT);
+ fid2 = H5.H5Fopen(H5_FILE2, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
assertTrue("H5Fopen failed", fid2 > 0);
fileno1 = H5.H5Fget_fileno(fid1);
- assertTrue("H5Fget_fileno1="+fileno1, fileno1 > 0);
+ assertTrue("H5Fget_fileno1=" + fileno1, fileno1 > 0);
fileno2 = H5.H5Fget_fileno(fid2);
- assertTrue("H5Fget_fileno2="+fileno2, fileno2 > 0);
+ assertTrue("H5Fget_fileno2=" + fileno2, fileno2 > 0);
- assertEquals("fileno1["+fileno1+"]!=fileno2["+fileno2+"]", fileno1, fileno2);
+ assertEquals("fileno1[" + fileno1 + "]!=fileno2[" + fileno2 + "]", fileno1, fileno2);
}
catch (Throwable err) {
fail("testH5Fget_fileno_same: " + err);
@@ -209,23 +248,24 @@ public class TestH5F {
}
@Test
- public void testH5Fget_fileno_diff() {
+ public void testH5Fget_fileno_diff()
+ {
long fileno1 = 0;
long fileno2 = 0;
- long fid2 = HDF5Constants.H5I_INVALID_HID;
+ long fid2 = HDF5Constants.H5I_INVALID_HID;
try {
- fid2 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ fid2 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(fid2, HDF5Constants.H5F_SCOPE_LOCAL);
assertTrue("H5Fcreate failed", fid2 > 0);
fileno1 = H5.H5Fget_fileno(H5fid);
- assertTrue("H5Fget_fileno1="+fileno1, fileno1 > 0);
+ assertTrue("H5Fget_fileno1=" + fileno1, fileno1 > 0);
fileno2 = H5.H5Fget_fileno(fid2);
- assertTrue("H5Fget_fileno2="+fileno2, fileno2 > 0);
+ assertTrue("H5Fget_fileno2=" + fileno2, fileno2 > 0);
- assertNotEquals("fileno1["+fileno1+"]==fileno2["+fileno2+"]", fileno1, fileno2);
+ assertNotEquals("fileno1[" + fileno1 + "]==fileno2[" + fileno2 + "]", fileno1, fileno2);
}
catch (Throwable err) {
fail("testH5Fget_fileno_diff: " + err);
@@ -236,7 +276,8 @@ public class TestH5F {
}
@Test
- public void testH5Fget_obj_count() {
+ public void testH5Fget_obj_count()
+ {
long count = -1;
for (int i = 0; i < OBJ_TYPES.length; i++) {
@@ -252,10 +293,11 @@ public class TestH5F {
}
@Test
- public void testH5Fget_obj_ids() {
- long count = 0;
- long max_objs = 100;
- long[] obj_id_list = new long[(int)max_objs];
+ public void testH5Fget_obj_ids()
+ {
+ long count = 0;
+ long max_objs = 100;
+ long[] obj_id_list = new long[(int)max_objs];
int[] open_obj_counts = new int[OBJ_TYPES.length];
for (int i = 0; i < OBJ_TYPES.length; i++)
@@ -267,8 +309,7 @@ public class TestH5F {
for (int i = 0; i < OBJ_TYPES.length; i++) {
try {
- count = H5.H5Fget_obj_ids(H5fid, OBJ_TYPES[i], max_objs,
- obj_id_list);
+ count = H5.H5Fget_obj_ids(H5fid, OBJ_TYPES[i], max_objs, obj_id_list);
}
catch (Throwable err) {
fail("H5.H5Fget_obj_ids: " + err);
diff --git a/java/test/TestH5Fbasic.java b/java/test/TestH5Fbasic.java
index 4f3d928..37be943 100644
--- a/java/test/TestH5Fbasic.java
+++ b/java/test/TestH5Fbasic.java
@@ -31,45 +31,59 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Fbasic {
- @Rule public TestName testname = new TestName();
- private static final String H5_FILE = "testFb.h5";
+ @Rule
+ public TestName testname = new TestName();
+ private static final String H5_FILE = "testFb.h5";
private static final String TXT_FILE = "testFb.txt";
- long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
- private final void _deleteFile(String filename) {
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
@Before
- public void createH5file() throws HDF5LibraryException, NullPointerException {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void createH5file() throws HDF5LibraryException, NullPointerException
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
- H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
}
_deleteFile(H5_FILE);
System.out.println();
}
@Test
- public void testH5Fcreate() {
+ public void testH5Fcreate()
+ {
assertTrue(H5fid > 0);
}
@Test
- public void testH5Fis_accessible() {
+ public void testH5Fis_accessible()
+ {
boolean isH5 = false;
try {
@@ -82,18 +96,19 @@ public class TestH5Fbasic {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Fcreate_EXCL() throws Throwable {
- H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_EXCL,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ public void testH5Fcreate_EXCL() throws Throwable
+ {
+ H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_EXCL, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Fopen_read_only() throws Throwable {
+ public void testH5Fopen_read_only() throws Throwable
+ {
long fid = HDF5Constants.H5I_INVALID_HID;
try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
- HDF5Constants.H5P_DEFAULT);
+ fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fopen: " + err);
@@ -108,8 +123,7 @@ public class TestH5Fbasic {
File file = new File(H5_FILE);
if (file.setWritable(false)) {
// this should fail.
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
- HDF5Constants.H5P_DEFAULT);
+ fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
try {
H5.H5Fclose(fid);
@@ -123,13 +137,13 @@ public class TestH5Fbasic {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Freopen_closed() throws Throwable {
- long fid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Freopen_closed() throws Throwable
+ {
+ long fid = HDF5Constants.H5I_INVALID_HID;
long fid2 = HDF5Constants.H5I_INVALID_HID;
try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
- HDF5Constants.H5P_DEFAULT);
+ fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fopen: " + err);
@@ -146,13 +160,13 @@ public class TestH5Fbasic {
}
@Test
- public void testH5Freopen() {
- long fid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Freopen()
+ {
+ long fid = HDF5Constants.H5I_INVALID_HID;
long fid2 = HDF5Constants.H5I_INVALID_HID;
try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
- HDF5Constants.H5P_DEFAULT);
+ fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fopen: " + err);
@@ -180,12 +194,12 @@ public class TestH5Fbasic {
}
@Test
- public void testH5Fclose() {
+ public void testH5Fclose()
+ {
long fid = HDF5Constants.H5I_INVALID_HID;
try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
- HDF5Constants.H5P_DEFAULT);
+ fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fopen: " + err);
@@ -200,12 +214,12 @@ public class TestH5Fbasic {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Fclose_twice() throws Throwable {
+ public void testH5Fclose_twice() throws Throwable
+ {
long fid = HDF5Constants.H5I_INVALID_HID;
try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
- HDF5Constants.H5P_DEFAULT);
+ fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fopen: " + err);
@@ -223,7 +237,8 @@ public class TestH5Fbasic {
}
@Test
- public void testH5Fget_freespace() {
+ public void testH5Fget_freespace()
+ {
long freeSpace = 0;
try {
@@ -238,7 +253,8 @@ public class TestH5Fbasic {
// TODO add/and delete objects and test freespace
@Test
- public void testH5Fget_filesize() {
+ public void testH5Fget_filesize()
+ {
long fileSize = 0;
try {
@@ -253,7 +269,8 @@ public class TestH5Fbasic {
// TODO add/and delete objects and test freespace
@Test
- public void testH5Fget_mdc_hit_rate() {
+ public void testH5Fget_mdc_hit_rate()
+ {
double rate;
try {
@@ -265,8 +282,9 @@ public class TestH5Fbasic {
}
@Test
- public void testH5Fget_mdc_size() {
- int nentries = -1;
+ public void testH5Fget_mdc_size()
+ {
+ int nentries = -1;
long cache_sizes[] = new long[3];
try {
@@ -281,7 +299,8 @@ public class TestH5Fbasic {
// TODO: test more cases of different cache sizes.
@Test
- public void testH5Freset_mdc_hit_rate_stats() {
+ public void testH5Freset_mdc_hit_rate_stats()
+ {
try {
H5.H5Freset_mdc_hit_rate_stats(H5fid);
@@ -292,7 +311,8 @@ public class TestH5Fbasic {
}
@Test
- public void testH5Fget_name() {
+ public void testH5Fget_name()
+ {
String fname = null;
try {
@@ -306,7 +326,8 @@ public class TestH5Fbasic {
}
@Test
- public void testH5Fclear_elink_file_cache() {
+ public void testH5Fclear_elink_file_cache()
+ {
try {
H5.H5Fclear_elink_file_cache(H5fid);
@@ -317,7 +338,8 @@ public class TestH5Fbasic {
}
@Test
- public void testH5F_dset_no_attrs_hint() {
+ public void testH5F_dset_no_attrs_hint()
+ {
boolean ret_val_id = true;
try {
ret_val_id = H5.H5Fget_dset_no_attrs_hint(H5fid);
diff --git a/java/test/TestH5Fparams.java b/java/test/TestH5Fparams.java
index 0376485..6accc3b 100644
--- a/java/test/TestH5Fparams.java
+++ b/java/test/TestH5Fparams.java
@@ -32,46 +32,54 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Fparams {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
@Before
- public void checkOpenIDs() {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void checkOpenIDs()
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
}
@After
- public void nextTestName() {
+ public void nextTestName()
+ {
System.out.println();
}
@Test(expected = NullPointerException.class)
- public void testH5Fcreate_null() throws Throwable {
- H5.H5Fcreate(null, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ public void testH5Fcreate_null() throws Throwable
+ {
+ H5.H5Fcreate(null, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = NullPointerException.class)
- public void testH5Fopen_null() throws Throwable {
+ public void testH5Fopen_null() throws Throwable
+ {
H5.H5Fopen(null, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = NullPointerException.class)
- public void testH5Fis_accessible_null() throws Throwable {
+ public void testH5Fis_accessible_null() throws Throwable
+ {
H5.H5Fis_accessible(null, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Fmount_null() throws Throwable {
+ public void testH5Fmount_null() throws Throwable
+ {
H5.H5Fmount(-1, null, -1, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = NullPointerException.class)
- public void testH5Funmount_null() throws Throwable {
+ public void testH5Funmount_null() throws Throwable
+ {
H5.H5Funmount(-1, null);
}
@Ignore
- public void testH5Fis_hdf5_text() {
+ public void testH5Fis_hdf5_text()
+ {
File txtFile = null;
boolean isH5 = false;
@@ -91,25 +99,27 @@ public class TestH5Fparams {
txtFile.delete();
}
catch (SecurityException e) {
- ;// e.printStackTrace();
+ ; // e.printStackTrace();
}
}
- @Test//(expected = HDF5LibraryException.class)
- public void testH5Fclose_negative() throws Throwable {
+ @Test //(expected = HDF5LibraryException.class)
+ public void testH5Fclose_negative() throws Throwable
+ {
// cannot close a file with negative id.
int fid = H5.H5Fclose(-1);
assertTrue(fid == 0);
}
@Test
- public void testH5Fcreate() {
- long fid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Fcreate()
+ {
+ long fid = HDF5Constants.H5I_INVALID_HID;
File file = null;
try {
- fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
if (fid > 0) {
H5.H5Fclose(fid);
}
@@ -124,18 +134,19 @@ public class TestH5Fparams {
file.delete();
}
catch (SecurityException e) {
- ;// e.printStackTrace();
+ ; // e.printStackTrace();
}
}
}
@Test
- public void testH5Fflush_global() {
+ public void testH5Fflush_global()
+ {
long fid = HDF5Constants.H5I_INVALID_HID;
try {
- fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fopen: " + err);
@@ -156,12 +167,13 @@ public class TestH5Fparams {
}
@Test
- public void testH5Fflush_local() {
+ public void testH5Fflush_local()
+ {
long fid = HDF5Constants.H5I_INVALID_HID;
try {
- fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fopen: " + err);
@@ -182,13 +194,14 @@ public class TestH5Fparams {
}
@Test
- public void testH5Fget_info() {
+ public void testH5Fget_info()
+ {
long fid = HDF5Constants.H5I_INVALID_HID;
try {
try {
- fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fcreate: " + err);
@@ -205,21 +218,26 @@ public class TestH5Fparams {
}
}
catch (Exception e) {
- e.printStackTrace();
+ e.printStackTrace();
}
finally {
- try {H5.H5Fclose(fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(fid);
+ }
+ catch (Exception ex) {
+ }
}
}
- @Ignore//(expected = HDF5FunctionArgumentException.class)
- public void testH5Fset_libver_bounds_invalidlow() throws Throwable {
+ @Ignore //(expected = HDF5FunctionArgumentException.class)
+ public void testH5Fset_libver_bounds_invalidlow() throws Throwable
+ {
long fid = HDF5Constants.H5I_INVALID_HID;
try {
try {
- fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fcreate: " + err);
@@ -227,26 +245,36 @@ public class TestH5Fparams {
H5.H5Fset_libver_bounds(fid, 5, HDF5Constants.H5F_LIBVER_LATEST);
}
finally {
- try {H5.H5Fclose(fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(fid);
+ }
+ catch (Exception ex) {
+ }
}
}
- @Ignore//(expected = HDF5FunctionArgumentException.class)
- public void testH5Fset_libver_bounds_invalidhigh() throws Throwable {
+ @Ignore //(expected = HDF5FunctionArgumentException.class)
+ public void testH5Fset_libver_bounds_invalidhigh() throws Throwable
+ {
long fid = HDF5Constants.H5I_INVALID_HID;
try {
try {
- fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fcreate: " + err);
}
- H5.H5Fset_libver_bounds(fid, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST+1);
+ H5.H5Fset_libver_bounds(fid, HDF5Constants.H5F_LIBVER_LATEST,
+ HDF5Constants.H5F_LIBVER_LATEST + 1);
}
finally {
- try {H5.H5Fclose(fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(fid);
+ }
+ catch (Exception ex) {
+ }
}
}
}
diff --git a/java/test/TestH5Fswmr.java b/java/test/TestH5Fswmr.java
index 1ec78fe..823640d 100644
--- a/java/test/TestH5Fswmr.java
+++ b/java/test/TestH5Fswmr.java
@@ -29,25 +29,31 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Fswmr {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_FILE = "testswmr.h5";
- long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
long H5fapl = HDF5Constants.H5I_INVALID_HID;
long H5fcpl = HDF5Constants.H5I_INVALID_HID;
- private final void _deleteFile(String filename) {
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
@Before
- public void createH5file()
- throws HDF5LibraryException, NullPointerException {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void createH5file() throws HDF5LibraryException, NullPointerException
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
H5fapl = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS);
@@ -59,17 +65,30 @@ public class TestH5Fswmr {
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5fapl > 0) {
- try {H5.H5Pclose(H5fapl);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(H5fapl);
+ }
+ catch (Exception ex) {
+ }
H5fapl = HDF5Constants.H5I_INVALID_HID;
}
if (H5fcpl > 0) {
- try {H5.H5Pclose(H5fcpl);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(H5fcpl);
+ }
+ catch (Exception ex) {
+ }
H5fcpl = HDF5Constants.H5I_INVALID_HID;
}
- if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ if (H5fid > 0) {
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
H5fid = HDF5Constants.H5I_INVALID_HID;
}
_deleteFile(H5_FILE);
@@ -77,7 +96,8 @@ public class TestH5Fswmr {
}
@Test
- public void testH5Fstart_swmr_write() {
+ public void testH5Fstart_swmr_write()
+ {
try {
H5.H5Fstart_swmr_write(H5fid);
}
@@ -87,7 +107,8 @@ public class TestH5Fswmr {
}
@Test
- public void testH5Fswmr_read_attempts() {
+ public void testH5Fswmr_read_attempts()
+ {
long read_attempts = 0;
try {
diff --git a/java/test/TestH5G.java b/java/test/TestH5G.java
index edf2cbe..1f6da31 100644
--- a/java/test/TestH5G.java
+++ b/java/test/TestH5G.java
@@ -32,20 +32,22 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5G {
- @Rule public TestName testname = new TestName();
- private static final String H5_FILE = "testG.h5";
- private static final String H5_FILE2 = "testG2.h5";
- private static final String[] GROUPS = { "/G1", "/G1/G11", "/G1/G12",
- "/G1/G11/G111", "/G1/G11/G112", "/G1/G11/G113", "/G1/G11/G114" };
- private static final String[] GROUPS2 = { "/G1", "/G1/G14", "/G1/G12", "/G1/G13", "/G1/G11"};
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5fid2 = HDF5Constants.H5I_INVALID_HID;
-
- private final long _createGroup(long fid, String name) {
+ @Rule
+ public TestName testname = new TestName();
+ private static final String H5_FILE = "testG.h5";
+ private static final String H5_FILE2 = "testG2.h5";
+ private static final String[] GROUPS = {"/G1", "/G1/G11", "/G1/G12", "/G1/G11/G111",
+ "/G1/G11/G112", "/G1/G11/G113", "/G1/G11/G114"};
+ private static final String[] GROUPS2 = {"/G1", "/G1/G14", "/G1/G12", "/G1/G13", "/G1/G11"};
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5fid2 = HDF5Constants.H5I_INVALID_HID;
+
+ private final long _createGroup(long fid, String name)
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
try {
- gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -56,41 +58,51 @@ public class TestH5G {
return gid;
}
- private final long _createGroup2(long fid, String name) {
- long gid = HDF5Constants.H5I_INVALID_HID;
+ private final long _createGroup2(long fid, String name)
+ {
+ long gid = HDF5Constants.H5I_INVALID_HID;
long gcpl = HDF5Constants.H5I_INVALID_HID;
try {
- gcpl = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); //create gcpl
+ gcpl = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); // create gcpl
}
catch (final Exception ex) {
fail("H5.H5Pcreate(): " + ex);
}
assertTrue("TestH5G._createGroup2: ", gcpl >= 0);
try {
- H5.H5Pset_link_creation_order(gcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED
- + HDF5Constants.H5P_CRT_ORDER_INDEXED); // Set link creation order
+ H5.H5Pset_link_creation_order(gcpl,
+ HDF5Constants.H5P_CRT_ORDER_TRACKED +
+ HDF5Constants.H5P_CRT_ORDER_INDEXED); // Set link creation order
}
catch (final Exception ex) {
- try {H5.H5Pclose(gcpl);} catch (final Exception exx) {}
+ try {
+ H5.H5Pclose(gcpl);
+ }
+ catch (final Exception exx) {
+ }
fail("H5.H5Pset_link_creation_order: " + ex);
}
try {
- gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
- gcpl, HDF5Constants.H5P_DEFAULT);
+ gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, gcpl, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Gcreate: " + err);
}
finally {
- try {H5.H5Pclose(gcpl);} catch (final Exception ex) {}
+ try {
+ H5.H5Pclose(gcpl);
+ }
+ catch (final Exception ex) {
+ }
}
assertTrue("TestH5G._createGroup2: ", gid > 0);
return gid;
}
- private final long _openGroup(long fid, String name) {
+ private final long _openGroup(long fid, String name)
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT);
@@ -105,26 +117,31 @@ public class TestH5G {
return gid;
}
- private final void _deleteFile(String filename) {
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
@Before
- public void createH5file()
- throws HDF5LibraryException, NullPointerException {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void createH5file() throws HDF5LibraryException, NullPointerException
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT);
+ HDF5Constants.H5P_DEFAULT);
H5fid2 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT);
+ HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -137,12 +154,20 @@ public class TestH5G {
for (int i = 0; i < GROUPS.length; i++) {
gid = _createGroup(H5fid, GROUPS[i]);
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
for (int i = 0; i < GROUPS2.length; i++) {
gid = _createGroup2(H5fid2, GROUPS2[i]);
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
@@ -150,20 +175,30 @@ public class TestH5G {
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
}
if (H5fid2 > 0) {
- try {H5.H5Fclose(H5fid2);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid2);
+ }
+ catch (Exception ex) {
+ }
}
- _deleteFile(H5_FILE);
- _deleteFile(H5_FILE2);
- System.out.println();
+ _deleteFile(H5_FILE);
+ _deleteFile(H5_FILE2);
+ System.out.println();
}
@Test
- public void testH5Gopen() {
+ public void testH5Gopen()
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
for (int i = 0; i < GROUPS.length; i++) {
try {
@@ -183,7 +218,8 @@ public class TestH5G {
}
@Test
- public void testH5Gget_create_plist() {
+ public void testH5Gget_create_plist()
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
long pid = HDF5Constants.H5I_INVALID_HID;
@@ -215,7 +251,8 @@ public class TestH5G {
}
@Test
- public void testH5Gget_info() {
+ public void testH5Gget_info()
+ {
H5G_info_t info = null;
for (int i = 0; i < GROUPS.length; i++) {
@@ -232,13 +269,13 @@ public class TestH5G {
}
@Test
- public void testH5Gget_info_by_name() {
+ public void testH5Gget_info_by_name()
+ {
H5G_info_t info = null;
for (int i = 0; i < GROUPS.length; i++) {
try {
- info = H5.H5Gget_info_by_name(H5fid, GROUPS[i],
- HDF5Constants.H5P_DEFAULT);
+ info = H5.H5Gget_info_by_name(H5fid, GROUPS[i], HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -249,13 +286,13 @@ public class TestH5G {
}
@Test
- public void testH5Gget_info_by_idx() {
+ public void testH5Gget_info_by_idx()
+ {
H5G_info_t info = null;
for (int i = 0; i < 2; i++) {
try {
- info = H5.H5Gget_info_by_idx(H5fid, "/G1",
- HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC,
- i, HDF5Constants.H5P_DEFAULT);
+ info = H5.H5Gget_info_by_idx(H5fid, "/G1", HDF5Constants.H5_INDEX_NAME,
+ HDF5Constants.H5_ITER_INC, i, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -266,7 +303,8 @@ public class TestH5G {
}
@Test
- public void testH5Gget_obj_info_all() {
+ public void testH5Gget_obj_info_all()
+ {
H5G_info_t info = null;
long gid = _openGroup(H5fid, GROUPS[0]);
@@ -279,27 +317,31 @@ public class TestH5G {
fail("TestH5G.testH5Gget_obj_info_all: H5.H5Gget_info: " + err);
}
finally {
- try {H5.H5Gclose(gid);} catch (Exception ex) { }
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
assertNotNull("TestH5G.testH5Gget_obj_info_all: ", info);
assertTrue("TestH5G.testH5Gget_obj_info_all: number of links is empty", info.nlinks > 0);
- String objNames[] = new String[(int) info.nlinks];
- int objTypes[] = new int[(int) info.nlinks];
- int lnkTypes[] = new int[(int) info.nlinks];
- H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks];
+ String objNames[] = new String[(int)info.nlinks];
+ int objTypes[] = new int[(int)info.nlinks];
+ int lnkTypes[] = new int[(int)info.nlinks];
+ H5O_token_t objTokens[] = new H5O_token_t[(int)info.nlinks];
int names_found = 0;
try {
- names_found = H5.H5Gget_obj_info_all(H5fid, GROUPS[0], objNames,
- objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME);
+ names_found = H5.H5Gget_obj_info_all(H5fid, GROUPS[0], objNames, objTypes, lnkTypes, objTokens,
+ HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
fail("TestH5G.testH5Gget_obj_info_all: H5.H5Gget_obj_info_all: " + err);
}
- assertTrue("number found[" + names_found + "] different than expected["
- + objNames.length + "]", names_found == objNames.length);
+ assertTrue("number found[" + names_found + "] different than expected[" + objNames.length + "]",
+ names_found == objNames.length);
for (int i = 0; i < objNames.length; i++) {
assertNotNull("name #" + i + " does not exist", objNames[i]);
assertTrue("TestH5G.testH5Gget_obj_info_all: ", objNames[i].length() > 0);
@@ -307,7 +349,8 @@ public class TestH5G {
}
@Test
- public void testH5Gget_obj_info_all_gid() {
+ public void testH5Gget_obj_info_all_gid()
+ {
H5G_info_t info = null;
long gid = _openGroup(H5fid, GROUPS[0]);
@@ -316,25 +359,27 @@ public class TestH5G {
info = H5.H5Gget_info(gid);
assertNotNull("TestH5G.testH5Gget_obj_info_all_gid: ", info);
assertTrue("TestH5G.testH5Gget_obj_info_all_gid: number of links is empty", info.nlinks > 0);
- String objNames[] = new String[(int) info.nlinks];
- H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks];
- int lnkTypes[] = new int[(int) info.nlinks];
- int objTypes[] = new int[(int) info.nlinks];
+ String objNames[] = new String[(int)info.nlinks];
+ H5O_token_t objTokens[] = new H5O_token_t[(int)info.nlinks];
+ int lnkTypes[] = new int[(int)info.nlinks];
+ int objTypes[] = new int[(int)info.nlinks];
int names_found = 0;
try {
- names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes,
- objTokens, HDF5Constants.H5_INDEX_NAME);
+ names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes, objTokens,
+ HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
fail("TestH5G.testH5Gget_obj_info_all_gid: H5.H5Gget_obj_info_all: " + err);
}
- assertTrue("TestH5G.testH5Gget_obj_info_all_gid: number found[" + names_found + "] different than expected["
- + objNames.length + "]", names_found == objNames.length);
+ assertTrue("TestH5G.testH5Gget_obj_info_all_gid: number found[" + names_found +
+ "] different than expected[" + objNames.length + "]",
+ names_found == objNames.length);
for (int i = 0; i < objNames.length; i++) {
- assertNotNull("TestH5G.testH5Gget_obj_info_all_gid: name #" + i + " does not exist", objNames[i]);
+ assertNotNull("TestH5G.testH5Gget_obj_info_all_gid: name #" + i + " does not exist",
+ objNames[i]);
assertTrue("TestH5G.testH5Gget_obj_info_all_gid: ", objNames[i].length() > 0);
}
}
@@ -343,12 +388,17 @@ public class TestH5G {
fail("TestH5G.testH5Gget_obj_info_all_gid: H5.H5Gget_info: " + err);
}
finally {
- try {H5.H5Gclose(gid);} catch (Exception ex) { }
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Gget_obj_info_all_gid2() {
+ public void testH5Gget_obj_info_all_gid2()
+ {
H5G_info_t info = null;
long gid = _openGroup(H5fid, GROUPS[1]);
@@ -357,25 +407,27 @@ public class TestH5G {
info = H5.H5Gget_info(gid);
assertNotNull("TestH5G.testH5Gget_obj_info_all_gid2: ", info);
assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: number of links is empty", info.nlinks > 0);
- String objNames[] = new String[(int) info.nlinks];
- H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks];
- int lnkTypes[] = new int[(int) info.nlinks];
- int objTypes[] = new int[(int) info.nlinks];
+ String objNames[] = new String[(int)info.nlinks];
+ H5O_token_t objTokens[] = new H5O_token_t[(int)info.nlinks];
+ int lnkTypes[] = new int[(int)info.nlinks];
+ int objTypes[] = new int[(int)info.nlinks];
int names_found = 0;
try {
- names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes,
- objTokens, HDF5Constants.H5_INDEX_NAME);
+ names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes, objTokens,
+ HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
fail("TestH5G.testH5Gget_obj_info_all_gid2: H5.H5Gget_obj_info_all: " + err);
}
- assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: number found[" + names_found + "] different than expected["
- + objNames.length + "]", names_found == objNames.length);
+ assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: number found[" + names_found +
+ "] different than expected[" + objNames.length + "]",
+ names_found == objNames.length);
for (int i = 0; i < objNames.length; i++) {
- assertNotNull("TestH5G.testH5Gget_obj_info_all_gid2: name #" + i + " does not exist", objNames[i]);
+ assertNotNull("TestH5G.testH5Gget_obj_info_all_gid2: name #" + i + " does not exist",
+ objNames[i]);
assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: ", objNames[i].length() > 0);
}
}
@@ -384,73 +436,91 @@ public class TestH5G {
fail("TestH5G.testH5Gget_obj_info_all_gid2: H5.H5Gget_info: " + err);
}
finally {
- try {H5.H5Gclose(gid);} catch (Exception ex) { }
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Gget_obj_info_max() {
- long gid = _openGroup(H5fid, GROUPS[0]);
- long groups_max_size = GROUPS.length + 1;
- String objNames[] = new String[(int)groups_max_size];
- int objTypes[] = new int[(int)groups_max_size];
- int lnkTypes[] = new int[(int)groups_max_size];
+ public void testH5Gget_obj_info_max()
+ {
+ long gid = _openGroup(H5fid, GROUPS[0]);
+ long groups_max_size = GROUPS.length + 1;
+ String objNames[] = new String[(int)groups_max_size];
+ int objTypes[] = new int[(int)groups_max_size];
+ int lnkTypes[] = new int[(int)groups_max_size];
H5O_token_t objTokens[] = new H5O_token_t[(int)groups_max_size];
int names_found = 0;
try {
- names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes,
- objTokens, groups_max_size);
+ names_found =
+ H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes, objTokens, groups_max_size);
}
catch (Throwable err) {
err.printStackTrace();
fail("TestH5G.testH5Gget_obj_info_max: H5.H5Gget_obj_info_max: " + err);
}
finally {
- try {H5.H5Gclose(gid);} catch (Exception ex) { }
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
// expected number does not include root group
- assertTrue("TestH5G.testH5Gget_obj_info_max: number found[" + names_found + "] different than expected["
- + (GROUPS.length - 1) + "]", names_found == (GROUPS.length - 1));
- for (int i = 0; i < GROUPS.length-1; i++) {
- assertNotNull("TestH5G.testH5Gget_obj_info_max: name #"+i+" does not exist",objNames[i]);
- assertTrue("TestH5G.testH5Gget_obj_info_max: ", objNames[i].length()>0);
+ assertTrue("TestH5G.testH5Gget_obj_info_max: number found[" + names_found +
+ "] different than expected[" + (GROUPS.length - 1) + "]",
+ names_found == (GROUPS.length - 1));
+ for (int i = 0; i < GROUPS.length - 1; i++) {
+ assertNotNull("TestH5G.testH5Gget_obj_info_max: name #" + i + " does not exist", objNames[i]);
+ assertTrue("TestH5G.testH5Gget_obj_info_max: ", objNames[i].length() > 0);
}
}
@Test
- public void testH5Gget_obj_info_max_limit() {
- long gid = _openGroup(H5fid, GROUPS[0]);
- long groups_max_size = GROUPS.length - 3;
- String objNames[] = new String[(int)groups_max_size];
- int objTypes[] = new int[(int)groups_max_size];
- int lnkTypes[] = new int[(int)groups_max_size];
+ public void testH5Gget_obj_info_max_limit()
+ {
+ long gid = _openGroup(H5fid, GROUPS[0]);
+ long groups_max_size = GROUPS.length - 3;
+ String objNames[] = new String[(int)groups_max_size];
+ int objTypes[] = new int[(int)groups_max_size];
+ int lnkTypes[] = new int[(int)groups_max_size];
H5O_token_t objTokens[] = new H5O_token_t[(int)groups_max_size];
int names_found = 0;
try {
- names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes,
- objTokens, groups_max_size);
+ names_found =
+ H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes, objTokens, groups_max_size);
}
catch (Throwable err) {
err.printStackTrace();
fail("TestH5G.testH5Gget_obj_info_max_limit: H5.H5Gget_obj_info_max: " + err);
}
finally {
- try {H5.H5Gclose(gid);} catch (Exception ex) { }
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
- assertTrue("TestH5G.testH5Gget_obj_info_max_limit: number found[" + names_found + "] different than expected["
- + groups_max_size + "]", names_found == groups_max_size);
+ assertTrue("TestH5G.testH5Gget_obj_info_max_limit: number found[" + names_found +
+ "] different than expected[" + groups_max_size + "]",
+ names_found == groups_max_size);
for (int i = 0; i < objNames.length; i++) {
- assertNotNull("TestH5G.testH5Gget_obj_info_max_limit: name #" + i + " does not exist", objNames[i]);
+ assertNotNull("TestH5G.testH5Gget_obj_info_max_limit: name #" + i + " does not exist",
+ objNames[i]);
assertTrue("TestH5G.testH5Gget_obj_info_max_limit: ", objNames[i].length() > 0);
}
}
@Test
- public void testH5Gget_obj_info_all_byIndexType() {
+ public void testH5Gget_obj_info_all_byIndexType()
+ {
H5G_info_t info = null;
long gid = _openGroup(H5fid2, GROUPS2[0]);
@@ -463,41 +533,44 @@ public class TestH5G {
fail("TestH5G.testH5Gget_obj_info_all_byIndexType: H5.H5Gget_info: " + err);
}
finally {
- try {H5.H5Gclose(gid);} catch (Exception ex) { }
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
assertNotNull("TestH5G.testH5Gget_obj_info_all_byIndexType: ", info);
assertTrue("TestH5G.testH5Gget_obj_info_all_byIndexType: number of links is empty", info.nlinks > 0);
- String objNames[] = new String[(int) info.nlinks];
- int objTypes[] = new int[(int) info.nlinks];
- int lnkTypes[] = new int[(int) info.nlinks];
- H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks];
+ String objNames[] = new String[(int)info.nlinks];
+ int objTypes[] = new int[(int)info.nlinks];
+ int lnkTypes[] = new int[(int)info.nlinks];
+ H5O_token_t objTokens[] = new H5O_token_t[(int)info.nlinks];
try {
- H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames,
- objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_CRT_ORDER);
+ H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames, objTypes, lnkTypes, objTokens,
+ HDF5Constants.H5_INDEX_CRT_ORDER);
}
catch (Throwable err) {
err.printStackTrace();
fail("TestH5G.testH5Gget_obj_info_all_byIndexType: H5.H5Gget_obj_info_all: " + err);
}
- assertEquals("G12",objNames[1]);
- assertEquals("G13", objNames[2] );
- assertEquals("G11", objNames[3] );
+ assertEquals("G12", objNames[1]);
+ assertEquals("G13", objNames[2]);
+ assertEquals("G11", objNames[3]);
try {
- H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames,
- objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME);
+ H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames, objTypes, lnkTypes, objTokens,
+ HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
fail("TestH5G.testH5Gget_obj_info_all_byIndexType: H5.H5Gget_obj_info_all: " + err);
}
- assertEquals("G12",objNames[1]);
- assertEquals("G13", objNames[2] );
- assertEquals("G14", objNames[3] );
+ assertEquals("G12", objNames[1]);
+ assertEquals("G13", objNames[2]);
+ assertEquals("G14", objNames[3]);
}
-
}
diff --git a/java/test/TestH5Gbasic.java b/java/test/TestH5Gbasic.java
index 6e2e450..8ec04dd 100644
--- a/java/test/TestH5Gbasic.java
+++ b/java/test/TestH5Gbasic.java
@@ -30,15 +30,17 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Gbasic {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_FILE = "testGb.h5";
- long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
- private final long _createGroup(long fid, String name) {
+ private final long _createGroup(long fid, String name)
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
try {
- gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -48,64 +50,81 @@ public class TestH5Gbasic {
return gid;
}
- private final void _deleteFile(String filename) {
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
@Before
- public void createH5file()
- throws HDF5LibraryException, NullPointerException {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void createH5file() throws HDF5LibraryException, NullPointerException
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
- H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
}
_deleteFile(H5_FILE);
System.out.println();
}
- @Test//(expected = HDF5LibraryException.class)
- public void testH5Gclose_invalid() throws Throwable {
+ @Test //(expected = HDF5LibraryException.class)
+ public void testH5Gclose_invalid() throws Throwable
+ {
long gid = H5.H5Gclose(-1);
assertTrue(gid == 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Gcreate_null() throws Throwable {
+ public void testH5Gcreate_null() throws Throwable
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
// it should fail because the group name is null
- gid = H5.H5Gcreate(H5fid, null, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ gid = H5.H5Gcreate(H5fid, null, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Gcreate_invalid() throws Throwable {
- H5.H5Gcreate(-1, "Invalid ID", HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ public void testH5Gcreate_invalid() throws Throwable
+ {
+ H5.H5Gcreate(-1, "Invalid ID", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Gcreate() {
+ public void testH5Gcreate()
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
try {
- gid = H5.H5Gcreate(H5fid, "/testH5Gcreate",
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT);
+ gid = H5.H5Gcreate(H5fid, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -113,11 +132,16 @@ public class TestH5Gbasic {
}
assertTrue(gid > 0);
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
@Test
- public void testH5Gclose() {
+ public void testH5Gclose()
+ {
long gid = _createGroup(H5fid, "/testH5Gcreate");
assertTrue(gid > 0);
@@ -130,24 +154,28 @@ public class TestH5Gbasic {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Gcreate_exists() throws Throwable {
+ public void testH5Gcreate_exists() throws Throwable
+ {
long gid = _createGroup(H5fid, "/testH5Gcreate");
assertTrue(gid > 0);
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
// it should failed now because the group already exists in file
- gid = H5.H5Gcreate(H5fid, "/testH5Gcreate",
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT);
+ gid = H5.H5Gcreate(H5fid, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Gcreate_anon() {
+ public void testH5Gcreate_anon()
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
try {
- gid = H5.H5Gcreate_anon(H5fid, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT);
+ gid = H5.H5Gcreate_anon(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -155,42 +183,61 @@ public class TestH5Gbasic {
}
assertTrue(gid > 0);
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
@Test(expected = NullPointerException.class)
- public void testH5Gopen_null() throws Throwable {
+ public void testH5Gopen_null() throws Throwable
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
gid = H5.H5Gopen(H5fid, null, HDF5Constants.H5P_DEFAULT);
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Gopen_invalid() throws Throwable {
+ public void testH5Gopen_invalid() throws Throwable
+ {
H5.H5Gopen(-1, "Invalid ID", HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Gopen_not_exists() throws Throwable {
+ public void testH5Gopen_not_exists() throws Throwable
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
- gid = H5.H5Gopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT);
+ gid = H5.H5Gopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT);
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
@Test
- public void testH5Gopen() {
+ public void testH5Gopen()
+ {
long gid = _createGroup(H5fid, "/testH5Gcreate");
assertTrue(gid > 0);
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
try {
- gid = H5.H5Gopen(H5fid, "/testH5Gcreate",
- HDF5Constants.H5P_DEFAULT);
+ gid = H5.H5Gopen(H5fid, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -198,16 +245,22 @@ public class TestH5Gbasic {
}
assertTrue(gid > 0);
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Gget_create_plist_invalid() throws Throwable {
+ public void testH5Gget_create_plist_invalid() throws Throwable
+ {
H5.H5Gget_create_plist(-1);
}
@Test
- public void testH5Gget_create_plist() {
+ public void testH5Gget_create_plist()
+ {
long pid = HDF5Constants.H5I_INVALID_HID;
long gid = _createGroup(H5fid, "/testH5Gcreate");
assertTrue(gid > 0);
@@ -216,126 +269,173 @@ public class TestH5Gbasic {
pid = H5.H5Gget_create_plist(gid);
}
catch (Throwable err) {
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
err.printStackTrace();
fail("H5.H5Gget_create_plist: " + err);
}
assertTrue(pid > 0);
- try {H5.H5Pclose(pid);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(pid);
+ }
+ catch (Exception ex) {
+ }
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Gget_info_invalid() throws Throwable {
+ public void testH5Gget_info_invalid() throws Throwable
+ {
H5.H5Gget_info(-1);
}
@Test
- public void testH5Gget_info() {
+ public void testH5Gget_info()
+ {
H5G_info_t info = null;
- long gid = _createGroup(H5fid, "/testH5Gcreate");
+ long gid = _createGroup(H5fid, "/testH5Gcreate");
assertTrue(gid > 0);
try {
info = H5.H5Gget_info(gid);
}
catch (Throwable err) {
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
err.printStackTrace();
fail("H5.H5Gget_info: " + err);
}
assertNotNull(info);
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
@Test(expected = NullPointerException.class)
- public void testH5Gget_info_by_name_null() throws Throwable {
+ public void testH5Gget_info_by_name_null() throws Throwable
+ {
H5.H5Gget_info_by_name(-1, null, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Gget_info_by_name_invalid() throws Throwable {
+ public void testH5Gget_info_by_name_invalid() throws Throwable
+ {
H5.H5Gget_info_by_name(-1, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Gget_info_by_name_not_exists() throws Throwable {
- H5.H5Gget_info_by_name(H5fid, "/testH5Gcreate",
- HDF5Constants.H5P_DEFAULT);
+ public void testH5Gget_info_by_name_not_exists() throws Throwable
+ {
+ H5.H5Gget_info_by_name(H5fid, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Gget_info_by_name() {
+ public void testH5Gget_info_by_name()
+ {
H5G_info_t info = null;
- long gid = _createGroup(H5fid, "/testH5Gcreate");
+ long gid = _createGroup(H5fid, "/testH5Gcreate");
assertTrue(gid > 0);
try {
- info = H5.H5Gget_info_by_name(gid, "/testH5Gcreate",
- HDF5Constants.H5P_DEFAULT);
+ info = H5.H5Gget_info_by_name(gid, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
err.printStackTrace();
fail("H5.H5Gget_info_by_name: " + err);
}
assertNotNull(info);
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
@Test
- public void testH5Gget_info_by_name_fileid() {
+ public void testH5Gget_info_by_name_fileid()
+ {
H5G_info_t info = null;
- long gid = _createGroup(H5fid, "/testH5Gcreate");
+ long gid = _createGroup(H5fid, "/testH5Gcreate");
assertTrue(gid > 0);
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
try {
- info = H5.H5Gget_info_by_name(H5fid, "/testH5Gcreate",
- HDF5Constants.H5P_DEFAULT);
+ info = H5.H5Gget_info_by_name(H5fid, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
err.printStackTrace();
fail("H5.H5Gget_info_by_name: " + err);
}
assertNotNull(info);
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
@Test(expected = NullPointerException.class)
- public void testH5Gget_info_by_idx_null() throws Throwable {
- H5.H5Gget_info_by_idx(-1, null, HDF5Constants.H5_INDEX_NAME,
- HDF5Constants.H5_ITER_INC, 1L, HDF5Constants.H5P_DEFAULT);
+ public void testH5Gget_info_by_idx_null() throws Throwable
+ {
+ H5.H5Gget_info_by_idx(-1, null, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 1L,
+ HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Gget_info_by_idx_invalid() throws Throwable {
- H5.H5Gget_info_by_idx(-1, "/testH5Gcreate", HDF5Constants.H5_INDEX_NAME,
- HDF5Constants.H5_ITER_INC, 1L, HDF5Constants.H5P_DEFAULT);
+ public void testH5Gget_info_by_idx_invalid() throws Throwable
+ {
+ H5.H5Gget_info_by_idx(-1, "/testH5Gcreate", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC,
+ 1L, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Gget_info_by_idx_not_exists() throws Throwable {
- H5.H5Gget_info_by_idx(H5fid, "/testH5Gcreate",
- HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 1L,
- HDF5Constants.H5P_DEFAULT);
+ public void testH5Gget_info_by_idx_not_exists() throws Throwable
+ {
+ H5.H5Gget_info_by_idx(H5fid, "/testH5Gcreate", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC,
+ 1L, HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Gget_info_by_idx() {
+ public void testH5Gget_info_by_idx()
+ {
H5G_info_t info = null;
- long gid = _createGroup(H5fid, "/testH5Gcreate");
+ long gid = _createGroup(H5fid, "/testH5Gcreate");
assertTrue(gid > 0);
try {
- info = H5.H5Gget_info_by_idx(gid, "/", HDF5Constants.H5_INDEX_NAME,
- HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ info = H5.H5Gget_info_by_idx(gid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0,
+ HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -343,20 +443,28 @@ public class TestH5Gbasic {
}
assertNotNull(info);
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
}
@Test
- public void testH5Gget_info_by_idx_fileid() {
+ public void testH5Gget_info_by_idx_fileid()
+ {
H5G_info_t info = null;
- long gid = _createGroup(H5fid, "/testH5Gcreate");
+ long gid = _createGroup(H5fid, "/testH5Gcreate");
assertTrue(gid > 0);
- try {H5.H5Gclose(gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(gid);
+ }
+ catch (Exception ex) {
+ }
try {
- info = H5.H5Gget_info_by_idx(H5fid, "/",
- HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0,
- HDF5Constants.H5P_DEFAULT);
+ info = H5.H5Gget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC,
+ 0, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -366,13 +474,14 @@ public class TestH5Gbasic {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Gflush_invalid() throws Throwable {
+ public void testH5Gflush_invalid() throws Throwable
+ {
H5.H5Gflush(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Grefresh_invalid() throws Throwable {
+ public void testH5Grefresh_invalid() throws Throwable
+ {
H5.H5Grefresh(-1);
}
-
}
diff --git a/java/test/TestH5Giterate.java b/java/test/TestH5Giterate.java
index 388d2ac..eb4b5bf 100644
--- a/java/test/TestH5Giterate.java
+++ b/java/test/TestH5Giterate.java
@@ -15,6 +15,7 @@ package test;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
@@ -28,11 +29,13 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Giterate {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_FILE = "h5ex_g_iterate.hdf";
- long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
- private final long _openGroup(long fid, String name) {
+ private final long _openGroup(long fid, String name)
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT);
@@ -47,14 +50,13 @@ public class TestH5Giterate {
}
@Before
- public void openH5file()
- throws HDF5LibraryException, NullPointerException {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void openH5file() throws HDF5LibraryException, NullPointerException
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
- H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY,
- HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -63,15 +65,21 @@ public class TestH5Giterate {
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
}
System.out.println();
}
@Test
- public void testH5Gget_obj_info_all() {
+ public void testH5Gget_obj_info_all()
+ {
H5G_info_t info = null;
long gid = _openGroup(H5fid, "/");
@@ -90,45 +98,46 @@ public class TestH5Giterate {
}
assertNotNull(info);
assertTrue("number of links is empty", info.nlinks > 0);
- String objNames[] = new String[(int) info.nlinks];
- int objTypes[] = new int[(int) info.nlinks];
- int lnkTypes[] = new int[(int) info.nlinks];
- H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks];
+ String objNames[] = new String[(int)info.nlinks];
+ int objTypes[] = new int[(int)info.nlinks];
+ int lnkTypes[] = new int[(int)info.nlinks];
+ H5O_token_t objTokens[] = new H5O_token_t[(int)info.nlinks];
int names_found = 0;
try {
- names_found = H5.H5Gget_obj_info_all(H5fid, "/", objNames,
- objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME);
+ names_found = H5.H5Gget_obj_info_all(H5fid, "/", objNames, objTypes, lnkTypes, objTokens,
+ HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Gget_obj_info_all: " + err);
}
- assertTrue("number found[" + names_found + "] different than expected["
- + objNames.length + "]", names_found == objNames.length);
+ assertTrue("number found[" + names_found + "] different than expected[" + objNames.length + "]",
+ names_found == objNames.length);
for (int i = 0; i < objNames.length; i++) {
assertNotNull("name #" + i + " does not exist", objNames[i]);
assertTrue(objNames[i].length() > 0);
- if (objTypes[i]==HDF5Constants.H5O_TYPE_GROUP) {
- assertTrue("Group is index: "+i + " ",i==2);
- assertTrue("Group is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("G1")==0);
+ if (objTypes[i] == HDF5Constants.H5O_TYPE_GROUP) {
+ assertTrue("Group is index: " + i + " ", i == 2);
+ assertTrue("Group is : " + objNames[i] + " ", objNames[i].compareToIgnoreCase("G1") == 0);
}
- else if (objTypes[i]==HDF5Constants.H5O_TYPE_DATASET) {
- assertTrue("Dataset is index: "+i + " ",(i==0)||(i==3));
- if(i==0)
- assertTrue("Dataset is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("DS1")==0);
+ else if (objTypes[i] == HDF5Constants.H5O_TYPE_DATASET) {
+ assertTrue("Dataset is index: " + i + " ", (i == 0) || (i == 3));
+ if (i == 0)
+ assertTrue("Dataset is : " + objNames[i] + " ",
+ objNames[i].compareToIgnoreCase("DS1") == 0);
else
- assertTrue("Dataset is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("L1")==0);
+ assertTrue("Dataset is : " + objNames[i] + " ",
+ objNames[i].compareToIgnoreCase("L1") == 0);
}
- else if (objTypes[i]==HDF5Constants.H5O_TYPE_NAMED_DATATYPE) {
- assertTrue("Datatype is index: "+i + " ",i==1);
- assertTrue("Datatype is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("DT1")==0);
+ else if (objTypes[i] == HDF5Constants.H5O_TYPE_NAMED_DATATYPE) {
+ assertTrue("Datatype is index: " + i + " ", i == 1);
+ assertTrue("Datatype is : " + objNames[i] + " ", objNames[i].compareToIgnoreCase("DT1") == 0);
}
else {
fail(" Unknown at index: " + i + " " + objNames[i]);
}
}
}
-
}
diff --git a/java/test/TestH5Lbasic.java b/java/test/TestH5Lbasic.java
index a28fc3d..c81545b 100644
--- a/java/test/TestH5Lbasic.java
+++ b/java/test/TestH5Lbasic.java
@@ -20,8 +20,8 @@ import java.util.ArrayList;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.callbacks.H5L_iterate_t;
import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t;
+import hdf.hdf5lib.callbacks.H5L_iterate_t;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5L_info_t;
@@ -32,19 +32,19 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Lbasic {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_FILE = "h5ex_g_iterateL1.hdf";
- long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
@Before
- public void openH5file()
- throws HDF5LibraryException, NullPointerException {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void openH5file() throws HDF5LibraryException, NullPointerException
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
- H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY,
- HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -53,15 +53,21 @@ public class TestH5Lbasic {
}
@After
- public void closeH5file() throws HDF5LibraryException {
+ public void closeH5file() throws HDF5LibraryException
+ {
if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
}
System.out.println();
}
@Test
- public void testH5Lexists() {
+ public void testH5Lexists()
+ {
boolean link_exists = false;
try {
link_exists = H5.H5Lexists(H5fid, "None", HDF5Constants.H5P_DEFAULT);
@@ -70,7 +76,7 @@ public class TestH5Lbasic {
err.printStackTrace();
fail("H5.H5Lexists: " + err);
}
- assertFalse("H5Lexists ",link_exists);
+ assertFalse("H5Lexists ", link_exists);
try {
link_exists = H5.H5Lexists(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
}
@@ -78,7 +84,7 @@ public class TestH5Lbasic {
err.printStackTrace();
fail("H5.H5Lexists: " + err);
}
- assertTrue("H5Lexists ",link_exists);
+ assertTrue("H5Lexists ", link_exists);
try {
link_exists = H5.H5Lexists(H5fid, "G1/DS2", HDF5Constants.H5P_DEFAULT);
}
@@ -86,16 +92,18 @@ public class TestH5Lbasic {
err.printStackTrace();
fail("H5.H5Lexists: " + err);
}
- assertTrue("H5Lexists ",link_exists);
+ assertTrue("H5Lexists ", link_exists);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lget_info_not_exist() throws Throwable {
+ public void testH5Lget_info_not_exist() throws Throwable
+ {
H5.H5Lget_info(H5fid, "None", HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Lget_info_dataset() {
+ public void testH5Lget_info_dataset()
+ {
H5L_info_t link_info = null;
try {
link_info = H5.H5Lget_info(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
@@ -104,12 +112,13 @@ public class TestH5Lbasic {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertFalse("H5Lget_info ",link_info==null);
- assertTrue("H5Lget_info link type",link_info.type==HDF5Constants.H5L_TYPE_HARD);
+ assertFalse("H5Lget_info ", link_info == null);
+ assertTrue("H5Lget_info link type", link_info.type == HDF5Constants.H5L_TYPE_HARD);
}
@Test
- public void testH5Lget_info_hardlink() {
+ public void testH5Lget_info_hardlink()
+ {
H5L_info_t link_info = null;
try {
link_info = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
@@ -118,43 +127,53 @@ public class TestH5Lbasic {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertFalse("H5Lget_info",link_info==null);
- assertTrue("H5Lget_info link type",link_info.type==HDF5Constants.H5L_TYPE_HARD);
+ assertFalse("H5Lget_info", link_info == null);
+ assertTrue("H5Lget_info link type", link_info.type == HDF5Constants.H5L_TYPE_HARD);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lget_info_by_idx_name_not_exist_name() throws Throwable {
- H5.H5Lget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ public void testH5Lget_info_by_idx_name_not_exist_name() throws Throwable
+ {
+ H5.H5Lget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0,
+ HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lget_info_by_idx_name_not_exist_create() throws Throwable {
- H5.H5Lget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ public void testH5Lget_info_by_idx_name_not_exist_create() throws Throwable
+ {
+ H5.H5Lget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0,
+ HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lget_info_by_idx_not_exist_name() throws Throwable {
- H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT);
+ public void testH5Lget_info_by_idx_not_exist_name() throws Throwable
+ {
+ H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5,
+ HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lget_info_by_idx_not_exist_create() throws Throwable {
- H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT);
+ public void testH5Lget_info_by_idx_not_exist_create() throws Throwable
+ {
+ H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5,
+ HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Lget_info_by_idx_n0() {
- H5L_info_t link_info = null;
+ public void testH5Lget_info_by_idx_n0()
+ {
+ H5L_info_t link_info = null;
H5L_info_t link_info2 = null;
try {
- link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME,
+ HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_info_by_idx: " + err);
}
- assertFalse("H5Lget_info_by_idx",link_info==null);
- assertTrue("H5Lget_info_by_idx link type",link_info.type==HDF5Constants.H5L_TYPE_HARD);
+ assertFalse("H5Lget_info_by_idx", link_info == null);
+ assertTrue("H5Lget_info_by_idx link type", link_info.type == HDF5Constants.H5L_TYPE_HARD);
try {
link_info2 = H5.H5Lget_info(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
}
@@ -166,18 +185,20 @@ public class TestH5Lbasic {
}
@Test
- public void testH5Lget_info_by_idx_n3() {
- H5L_info_t link_info = null;
+ public void testH5Lget_info_by_idx_n3()
+ {
+ H5L_info_t link_info = null;
H5L_info_t link_info2 = null;
try {
- link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
+ link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME,
+ HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_info_by_idx: " + err);
}
- assertFalse("H5Lget_info_by_idx",link_info==null);
- assertTrue("H5Lget_info_by_idx link type",link_info.type==HDF5Constants.H5L_TYPE_HARD);
+ assertFalse("H5Lget_info_by_idx", link_info == null);
+ assertTrue("H5Lget_info_by_idx link type", link_info.type == HDF5Constants.H5L_TYPE_HARD);
try {
link_info2 = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
}
@@ -189,44 +210,52 @@ public class TestH5Lbasic {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lget_name_by_idx_not_exist() throws Throwable {
- H5.H5Lget_name_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ public void testH5Lget_name_by_idx_not_exist() throws Throwable
+ {
+ H5.H5Lget_name_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0,
+ HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Lget_name_by_idx_n0() {
+ public void testH5Lget_name_by_idx_n0()
+ {
String link_name = null;
try {
- link_name = H5.H5Lget_name_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ link_name = H5.H5Lget_name_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME,
+ HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_name_by_idx: " + err);
}
- assertFalse("H5Lget_name_by_idx ",link_name==null);
- assertTrue("Link Name ",link_name.compareTo("DS1")==0);
+ assertFalse("H5Lget_name_by_idx ", link_name == null);
+ assertTrue("Link Name ", link_name.compareTo("DS1") == 0);
}
@Test
- public void testH5Lget_name_by_idx_n3() {
+ public void testH5Lget_name_by_idx_n3()
+ {
String link_name = null;
try {
- link_name = H5.H5Lget_name_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
+ link_name = H5.H5Lget_name_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME,
+ HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_name_by_idx: " + err);
}
- assertFalse("H5Lget_name_by_idx ",link_name==null);
- assertTrue("Link Name ",link_name.compareTo("L1")==0);
+ assertFalse("H5Lget_name_by_idx ", link_name == null);
+ assertTrue("Link Name ", link_name.compareTo("L1") == 0);
}
@Test
- public void testH5Lvisit() {
+ public void testH5Lvisit()
+ {
class idata {
public String link_name = null;
- public int link_type = -1;
- idata(String name, int type) {
+ public int link_type = -1;
+ idata(String name, int type)
+ {
this.link_name = name;
this.link_type = type;
}
@@ -236,7 +265,8 @@ public class TestH5Lbasic {
}
H5L_iterate_opdata_t iter_data = new H5L_iter_data();
class H5L_iter_callback implements H5L_iterate_t {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data)
+ {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
@@ -250,21 +280,29 @@ public class TestH5Lbasic {
err.printStackTrace();
fail("H5.H5Lvisit: " + err);
}
- assertFalse("H5Lvisit ",((H5L_iter_data)iter_data).iterdata.isEmpty());
- assertTrue("H5Lvisit "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==5);
- assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(0)).link_name,(((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1")==0);
- assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(1)).link_name,(((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DT1")==0);
- assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(2)).link_name,(((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1")==0);
- assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(3)).link_name,(((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1/DS2")==0);
- assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(4)).link_name,(((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("L1")==0);
+ assertFalse("H5Lvisit ", ((H5L_iter_data)iter_data).iterdata.isEmpty());
+ assertTrue("H5Lvisit " + ((H5L_iter_data)iter_data).iterdata.size(),
+ ((H5L_iter_data)iter_data).iterdata.size() == 5);
+ assertTrue("H5Lvisit " + (((H5L_iter_data)iter_data).iterdata.get(0)).link_name,
+ (((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1") == 0);
+ assertTrue("H5Lvisit " + (((H5L_iter_data)iter_data).iterdata.get(1)).link_name,
+ (((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DT1") == 0);
+ assertTrue("H5Lvisit " + (((H5L_iter_data)iter_data).iterdata.get(2)).link_name,
+ (((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1") == 0);
+ assertTrue("H5Lvisit " + (((H5L_iter_data)iter_data).iterdata.get(3)).link_name,
+ (((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1/DS2") == 0);
+ assertTrue("H5Lvisit " + (((H5L_iter_data)iter_data).iterdata.get(4)).link_name,
+ (((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("L1") == 0);
}
@Test
- public void testH5Lvisit_by_name() {
+ public void testH5Lvisit_by_name()
+ {
class idata {
public String link_name = null;
- public int link_type = -1;
- idata(String name, int type) {
+ public int link_type = -1;
+ idata(String name, int type)
+ {
this.link_name = name;
this.link_type = type;
}
@@ -274,7 +312,8 @@ public class TestH5Lbasic {
}
H5L_iterate_opdata_t iter_data = new H5L_iter_data();
class H5L_iter_callback implements H5L_iterate_t {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data)
+ {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
@@ -282,23 +321,28 @@ public class TestH5Lbasic {
}
H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
- H5.H5Lvisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT);
+ H5.H5Lvisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb,
+ iter_data, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lvisit_by_name: " + err);
}
- assertFalse("H5Lvisit_by_name ",((H5L_iter_data)iter_data).iterdata.isEmpty());
- assertTrue("H5Lvisit_by_name "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==1);
- assertTrue("H5Lvisit_by_name "+(((H5L_iter_data)iter_data).iterdata.get(0)).link_name,(((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS2")==0);
+ assertFalse("H5Lvisit_by_name ", ((H5L_iter_data)iter_data).iterdata.isEmpty());
+ assertTrue("H5Lvisit_by_name " + ((H5L_iter_data)iter_data).iterdata.size(),
+ ((H5L_iter_data)iter_data).iterdata.size() == 1);
+ assertTrue("H5Lvisit_by_name " + (((H5L_iter_data)iter_data).iterdata.get(0)).link_name,
+ (((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS2") == 0);
}
@Test
- public void testH5Literate() {
+ public void testH5Literate()
+ {
class idata {
public String link_name = null;
- public int link_type = -1;
- idata(String name, int type) {
+ public int link_type = -1;
+ idata(String name, int type)
+ {
this.link_name = name;
this.link_type = type;
}
@@ -308,7 +352,8 @@ public class TestH5Lbasic {
}
H5L_iterate_opdata_t iter_data = new H5L_iter_data();
class H5L_iter_callback implements H5L_iterate_t {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data)
+ {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
@@ -316,26 +361,35 @@ public class TestH5Lbasic {
}
H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
- H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data);
+ H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb,
+ iter_data);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Literate: " + err);
}
- assertFalse("H5Literate ",((H5L_iter_data)iter_data).iterdata.isEmpty());
- assertTrue("H5Literate "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==4);
- assertTrue("H5Literate "+(((H5L_iter_data)iter_data).iterdata.get(0)).link_name,(((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1")==0);
- assertTrue("H5Literate "+(((H5L_iter_data)iter_data).iterdata.get(1)).link_name,(((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DT1")==0);
- assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name,(((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1")==0);
- assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("L1")==0);
+ assertFalse("H5Literate ", ((H5L_iter_data)iter_data).iterdata.isEmpty());
+ assertTrue("H5Literate " + ((H5L_iter_data)iter_data).iterdata.size(),
+ ((H5L_iter_data)iter_data).iterdata.size() == 4);
+ assertTrue("H5Literate " + (((H5L_iter_data)iter_data).iterdata.get(0)).link_name,
+ (((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1") == 0);
+ assertTrue("H5Literate " + (((H5L_iter_data)iter_data).iterdata.get(1)).link_name,
+ (((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DT1") == 0);
+ assertTrue("H5Literate " + ((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name,
+ (((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1") == 0);
+ assertTrue("H5Literate " + ((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name,
+ ((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("L1") ==
+ 0);
}
@Test
- public void testH5Literate_by_name() {
+ public void testH5Literate_by_name()
+ {
class idata {
public String link_name = null;
- public int link_type = -1;
- idata(String name, int type) {
+ public int link_type = -1;
+ idata(String name, int type)
+ {
this.link_name = name;
this.link_type = type;
}
@@ -345,7 +399,8 @@ public class TestH5Lbasic {
}
H5L_iterate_opdata_t iter_data = new H5L_iter_data();
class H5L_iter_callback implements H5L_iterate_t {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data)
+ {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
@@ -353,15 +408,18 @@ public class TestH5Lbasic {
}
H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
- H5.H5Literate_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT);
+ H5.H5Literate_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L,
+ iter_cb, iter_data, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Literate_by_name: " + err);
}
- assertFalse("H5Literate_by_name ",((H5L_iter_data)iter_data).iterdata.isEmpty());
- assertTrue("H5Literate_by_name "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==1);
- assertTrue("H5Literate_by_name "+((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS2")==0);
+ assertFalse("H5Literate_by_name ", ((H5L_iter_data)iter_data).iterdata.isEmpty());
+ assertTrue("H5Literate_by_name " + ((H5L_iter_data)iter_data).iterdata.size(),
+ ((H5L_iter_data)iter_data).iterdata.size() == 1);
+ assertTrue("H5Literate_by_name " + ((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name,
+ ((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS2") ==
+ 0);
}
-
}
diff --git a/java/test/TestH5Lcreate.java b/java/test/TestH5Lcreate.java
index 44af2e5..822323e 100644
--- a/java/test/TestH5Lcreate.java
+++ b/java/test/TestH5Lcreate.java
@@ -21,8 +21,8 @@ import java.util.ArrayList;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.callbacks.H5L_iterate_t;
import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t;
+import hdf.hdf5lib.callbacks.H5L_iterate_t;
import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5L_info_t;
@@ -35,21 +35,23 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Lcreate {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_EXTFILE = "h5ex_g_iterateL2.hdf";
- private static final String H5_FILE = "testL.h5";
- private static final int DIM_X = 4;
- private static final int DIM_Y = 6;
- long H5fcpl = HDF5Constants.H5I_INVALID_HID;
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5dsid = HDF5Constants.H5I_INVALID_HID;
- long H5did1 = HDF5Constants.H5I_INVALID_HID;
- long H5did2 = HDF5Constants.H5I_INVALID_HID;
- long H5gcpl = HDF5Constants.H5I_INVALID_HID;
- long H5gid = HDF5Constants.H5I_INVALID_HID;
- long[] H5dims = { DIM_X, DIM_Y };
-
- private final void _deleteFile(String filename) {
+ private static final String H5_FILE = "testL.h5";
+ private static final int DIM_X = 4;
+ private static final int DIM_Y = 6;
+ long H5fcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did1 = HDF5Constants.H5I_INVALID_HID;
+ long H5did2 = HDF5Constants.H5I_INVALID_HID;
+ long H5gcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5gid = HDF5Constants.H5I_INVALID_HID;
+ long[] H5dims = {DIM_X, DIM_Y};
+
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
@@ -62,39 +64,41 @@ public class TestH5Lcreate {
}
}
- private final long _createDataset(long fid, long dsid, String name, long dapl) {
+ private final long _createDataset(long fid, long dsid, String name, long dapl)
+ {
long did = HDF5Constants.H5I_INVALID_HID;
try {
- did = H5.H5Dcreate(fid, name,
- HDF5Constants.H5T_STD_I32BE, dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
+ did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, dapl);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Dcreate: " + err);
}
- assertTrue("TestH5L._createDataset: ",did > 0);
+ assertTrue("TestH5L._createDataset: ", did > 0);
return did;
}
- private final long _createGroup(long fid, String name) {
+ private final long _createGroup(long fid, String name)
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
try {
H5gcpl = HDF5Constants.H5P_DEFAULT;
- gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
- H5gcpl, HDF5Constants.H5P_DEFAULT);
+ gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, H5gcpl, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Gcreate: " + err);
}
- assertTrue("TestH5L._createGroup: ",gid > 0);
+ assertTrue("TestH5L._createGroup: ", gid > 0);
return gid;
}
- private final void _createHardLink(long fid, long cid, String curname, long did, String dstname, long lcpl, long lapl) {
+ private final void _createHardLink(long fid, long cid, String curname, long did, String dstname,
+ long lcpl, long lapl)
+ {
boolean link_exists = false;
try {
H5.H5Lcreate_hard(cid, curname, did, dstname, lcpl, lapl);
@@ -108,7 +112,9 @@ public class TestH5Lcreate {
assertTrue("TestH5L._createHardLink ", link_exists);
}
- private final void _createSoftLink(long fid, String curname, long did, String dstname, long lcpl, long lapl) {
+ private final void _createSoftLink(long fid, String curname, long did, String dstname, long lcpl,
+ long lapl)
+ {
boolean link_exists = false;
try {
H5.H5Lcreate_soft(curname, did, dstname, lcpl, lapl);
@@ -122,7 +128,9 @@ public class TestH5Lcreate {
assertTrue("TestH5L._createSoftLink ", link_exists);
}
- private final void _createExternalLink(long fid, String ext_filename, String curname, long did, String dstname, long lcpl, long lapl) {
+ private final void _createExternalLink(long fid, String ext_filename, String curname, long did,
+ String dstname, long lcpl, long lapl)
+ {
boolean link_exists = false;
try {
H5.H5Lcreate_external(ext_filename, curname, did, dstname, lcpl, lapl);
@@ -137,111 +145,149 @@ public class TestH5Lcreate {
}
@Before
- public void createH5file()
- throws NullPointerException, HDF5Exception {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void createH5file() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
H5fcpl = H5.H5Pcreate(HDF5Constants.H5P_FILE_CREATE);
- H5.H5Pset_link_creation_order(H5fcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED);
- H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- H5fcpl, HDF5Constants.H5P_DEFAULT);
+ H5.H5Pset_link_creation_order(H5fcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED +
+ HDF5Constants.H5P_CRT_ORDER_INDEXED);
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, H5fcpl, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("TestH5L.createH5file: " + err);
}
- assertTrue("TestH5L.createH5file: H5.H5Fcreate: ",H5fid > 0);
+ assertTrue("TestH5L.createH5file: H5.H5Fcreate: ", H5fid > 0);
try {
H5dsid = H5.H5Screate_simple(2, H5dims, null);
H5did1 = _createDataset(H5fid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT);
- H5gid = _createGroup(H5fid, "/G1");
+ H5gid = _createGroup(H5fid, "/G1");
H5did2 = _createDataset(H5gid, H5dsid, "DS2", HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("TestH5L.createH5objs: " + err);
}
- assertTrue("TestH5L.createH5file: H5.H5Screate_simple: ",H5dsid > 0);
- assertTrue("TestH5L.createH5file: H5.H5Gcreate: ",H5gid > 0);
+ assertTrue("TestH5L.createH5file: H5.H5Screate_simple: ", H5dsid > 0);
+ assertTrue("TestH5L.createH5file: H5.H5Gcreate: ", H5gid > 0);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5gid > 0)
- try {H5.H5Gclose(H5gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(H5gid);
+ }
+ catch (Exception ex) {
+ }
if (H5gcpl > 0)
- try {H5.H5Pclose(H5gcpl);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(H5gcpl);
+ }
+ catch (Exception ex) {
+ }
if (H5did2 > 0)
- try {H5.H5Dclose(H5did2);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did2);
+ }
+ catch (Exception ex) {
+ }
if (H5dsid > 0)
- try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid);
+ }
+ catch (Exception ex) {
+ }
if (H5did1 > 0)
- try {H5.H5Dclose(H5did1);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did1);
+ }
+ catch (Exception ex) {
+ }
if (H5fid > 0)
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
if (H5fcpl > 0)
- try {H5.H5Pclose(H5fcpl);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(H5fcpl);
+ }
+ catch (Exception ex) {
+ }
_deleteFile(H5_FILE);
System.out.println();
}
@Test
- public void testH5Lget_info_by_idx_n0_create() {
+ public void testH5Lget_info_by_idx_n0_create()
+ {
H5L_info_t link_info = null;
try {
int order = H5.H5Pget_link_creation_order(H5fcpl);
- assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED);
+ assertTrue("creation order :" + order,
+ order == HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_info_by_idx_n0_create:H5Pget_link_creation_order " + err);
}
try {
- link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER,
+ HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_info_by_idx: " + err);
}
- assertFalse("H5Lget_info_by_idx ", link_info==null);
- assertTrue("H5Lget_info_by_idx link type", link_info.type==HDF5Constants.H5L_TYPE_HARD);
+ assertFalse("H5Lget_info_by_idx ", link_info == null);
+ assertTrue("H5Lget_info_by_idx link type", link_info.type == HDF5Constants.H5L_TYPE_HARD);
}
@Test
- public void testH5Lget_info_by_idx_n1_create() {
+ public void testH5Lget_info_by_idx_n1_create()
+ {
H5L_info_t link_info = null;
try {
int order = H5.H5Pget_link_creation_order(H5fcpl);
- assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED);
+ assertTrue("creation order :" + order,
+ order == HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_info_by_idx_n1_create:H5Pget_link_creation_order " + err);
}
try {
- link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 1, HDF5Constants.H5P_DEFAULT);
+ link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER,
+ HDF5Constants.H5_ITER_INC, 1, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_info_by_idx: " + err);
}
- assertFalse("H5Lget_info_by_idx ", link_info==null);
- assertTrue("H5Lget_info_by_idx link type", link_info.type==HDF5Constants.H5L_TYPE_HARD);
+ assertFalse("H5Lget_info_by_idx ", link_info == null);
+ assertTrue("H5Lget_info_by_idx link type", link_info.type == HDF5Constants.H5L_TYPE_HARD);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lcreate_hard_cur_not_exists() throws Throwable {
+ public void testH5Lcreate_hard_cur_not_exists() throws Throwable
+ {
H5.H5Lcreate_hard(H5fid, "None", H5fid, "DS1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Lcreate_hard() {
+ public void testH5Lcreate_hard()
+ {
try {
- H5.H5Lcreate_hard(H5fid, "DS1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5.H5Lcreate_hard(H5fid, "DS1", H5fid, "L1", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
boolean link_exists = H5.H5Lexists(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
assertTrue("testH5Lcreate_hard:H5Lexists ", link_exists);
@@ -253,14 +299,19 @@ public class TestH5Lcreate {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lcreate_hard_dst_link_exists() throws Throwable {
- _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- H5.H5Lcreate_hard(H5fid, "L1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ public void testH5Lcreate_hard_dst_link_exists() throws Throwable
+ {
+ _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
+ H5.H5Lcreate_hard(H5fid, "L1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Ldelete_hard_link() {
- _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ public void testH5Ldelete_hard_link()
+ {
+ _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
try {
H5.H5Ldelete(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
@@ -274,7 +325,8 @@ public class TestH5Lcreate {
}
@Test
- public void testH5Lcreate_soft() {
+ public void testH5Lcreate_soft()
+ {
try {
H5.H5Lcreate_soft("DS1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
@@ -288,13 +340,15 @@ public class TestH5Lcreate {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lcreate_soft_dst_link_exists() throws Throwable {
+ public void testH5Lcreate_soft_dst_link_exists() throws Throwable
+ {
_createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
H5.H5Lcreate_soft("L1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Ldelete_soft_link() {
+ public void testH5Ldelete_soft_link()
+ {
_createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
try {
H5.H5Ldelete(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
@@ -309,7 +363,8 @@ public class TestH5Lcreate {
}
@Test
- public void testH5Lget_info_softlink() {
+ public void testH5Lget_info_softlink()
+ {
H5L_info_t link_info = null;
_createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
try {
@@ -319,15 +374,16 @@ public class TestH5Lcreate {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertFalse("H5Lget_info", link_info==null);
- assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT);
+ assertFalse("H5Lget_info", link_info == null);
+ assertTrue("H5Lget_info link type", link_info.type == HDF5Constants.H5L_TYPE_SOFT);
assertTrue("Link Value Size", link_info.val_size > 0);
}
@Test
- public void testH5Lget_value_soft() {
+ public void testH5Lget_value_soft()
+ {
String[] link_value = {null, null};
- int link_type = -1;
+ int link_type = -1;
_createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
try {
@@ -338,12 +394,13 @@ public class TestH5Lcreate {
fail("H5.H5Lget_value: " + err);
}
assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_SOFT);
- assertFalse("H5Lget_value ", link_value[0]==null);
- assertTrue("Link Value ", link_value[0].compareTo("/G1/DS2")==0);
+ assertFalse("H5Lget_value ", link_value[0] == null);
+ assertTrue("Link Value ", link_value[0].compareTo("/G1/DS2") == 0);
}
@Test
- public void testH5Lcreate_soft_dangle() {
+ public void testH5Lcreate_soft_dangle()
+ {
try {
H5.H5Lcreate_soft("DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
@@ -357,7 +414,8 @@ public class TestH5Lcreate {
}
@Test
- public void testH5Ldelete_soft_link_dangle() {
+ public void testH5Ldelete_soft_link_dangle()
+ {
_createSoftLink(H5fid, "DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
try {
H5.H5Ldelete(H5fid, "L2", HDF5Constants.H5P_DEFAULT);
@@ -372,7 +430,8 @@ public class TestH5Lcreate {
}
@Test
- public void testH5Lget_info_softlink_dangle() {
+ public void testH5Lget_info_softlink_dangle()
+ {
H5L_info_t link_info = null;
_createSoftLink(H5fid, "DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
try {
@@ -382,15 +441,16 @@ public class TestH5Lcreate {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertFalse("H5Lget_info", link_info==null);
- assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT);
+ assertFalse("H5Lget_info", link_info == null);
+ assertTrue("H5Lget_info link type", link_info.type == HDF5Constants.H5L_TYPE_SOFT);
assertTrue("Link Value Size", link_info.val_size > 0);
}
@Test
- public void testH5Lget_value_dangle() {
- String[] link_value = {null,null};
- int link_type = -1;
+ public void testH5Lget_value_dangle()
+ {
+ String[] link_value = {null, null};
+ int link_type = -1;
_createSoftLink(H5fid, "DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
try {
@@ -401,14 +461,16 @@ public class TestH5Lcreate {
fail("H5.H5Lget_value: " + err);
}
assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_SOFT);
- assertFalse("H5Lget_value ", link_value[0]==null);
- assertTrue("Link Value ", link_value[0].compareTo("DS3")==0);
+ assertFalse("H5Lget_value ", link_value[0] == null);
+ assertTrue("Link Value ", link_value[0].compareTo("DS3") == 0);
}
@Test
- public void testH5Lcreate_external() {
+ public void testH5Lcreate_external()
+ {
try {
- H5.H5Lcreate_external(H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5.H5Lcreate_external(H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
boolean link_exists = H5.H5Lexists(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
assertTrue("testH5Lcreate_external:H5Lexists ", link_exists);
@@ -420,9 +482,11 @@ public class TestH5Lcreate {
}
@Test
- public void testH5Lget_info_externallink() {
+ public void testH5Lget_info_externallink()
+ {
H5L_info_t link_info = null;
- _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
try {
link_info = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
}
@@ -430,17 +494,19 @@ public class TestH5Lcreate {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertFalse("H5Lget_info", link_info==null);
- assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_EXTERNAL);
+ assertFalse("H5Lget_info", link_info == null);
+ assertTrue("H5Lget_info link type", link_info.type == HDF5Constants.H5L_TYPE_EXTERNAL);
assertTrue("Link Value Size", link_info.val_size > 0);
}
@Test
- public void testH5Lget_value_external(){
- String[] link_value = {null,null};
- int link_type = -1;
+ public void testH5Lget_value_external()
+ {
+ String[] link_value = {null, null};
+ int link_type = -1;
- _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
try {
link_type = H5.H5Lget_value(H5fid, "L1", link_value, HDF5Constants.H5P_DEFAULT);
}
@@ -449,18 +515,20 @@ public class TestH5Lcreate {
fail("H5.H5Lget_value: " + err);
}
assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_EXTERNAL);
- assertFalse("H5Lget_value ", link_value[0]==null);
- assertFalse("H5Lget_value ", link_value[1]==null);
- assertTrue("Link Value ", link_value[0].compareTo("DT1")==0);
+ assertFalse("H5Lget_value ", link_value[0] == null);
+ assertFalse("H5Lget_value ", link_value[1] == null);
+ assertTrue("Link Value ", link_value[0].compareTo("DT1") == 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lcopy_cur_not_exists() throws Throwable {
+ public void testH5Lcopy_cur_not_exists() throws Throwable
+ {
H5.H5Lcopy(H5fid, "None", H5fid, "DS1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Lcopy() {
+ public void testH5Lcopy()
+ {
try {
H5.H5Lcopy(H5fid, "DS1", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
@@ -474,18 +542,22 @@ public class TestH5Lcreate {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lcopy_dst_link_exists() throws Throwable {
- _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ public void testH5Lcopy_dst_link_exists() throws Throwable
+ {
+ _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5.H5Lcopy(H5fid, "CPY1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lmove_cur_not_exists() throws Throwable {
+ public void testH5Lmove_cur_not_exists() throws Throwable
+ {
H5.H5Lmove(H5fid, "None", H5fid, "DS1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Lmove() {
+ public void testH5Lmove()
+ {
try {
H5.H5Lmove(H5fid, "DS1", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
@@ -501,60 +573,72 @@ public class TestH5Lcreate {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lmove_dst_link_exists() throws Throwable {
- _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ public void testH5Lmove_dst_link_exists() throws Throwable
+ {
+ _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5.H5Lmove(H5fid, "CPY1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lget_value_by_idx_not_exist_name() throws Throwable {
- String[] link_value = {null,null};
- H5.H5Lget_value_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, link_value, HDF5Constants.H5P_DEFAULT);
+ public void testH5Lget_value_by_idx_not_exist_name() throws Throwable
+ {
+ String[] link_value = {null, null};
+ H5.H5Lget_value_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0,
+ link_value, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lget_value_by_idx_not_exist_create() throws Throwable {
- String[] link_value = {null,null};
- H5.H5Lget_value_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, link_value, HDF5Constants.H5P_DEFAULT);
+ public void testH5Lget_value_by_idx_not_exist_create() throws Throwable
+ {
+ String[] link_value = {null, null};
+ H5.H5Lget_value_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0,
+ link_value, HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Lget_value_by_idx_n2_name() {
+ public void testH5Lget_value_by_idx_n2_name()
+ {
H5L_info_t link_info = null;
- String[] link_value = {null,null};
- int link_type = -1;
+ String[] link_value = {null, null};
+ int link_type = -1;
_createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
try {
- link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
+ link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME,
+ HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_info_by_idx: " + err);
}
- assertFalse("testH5Lget_value_by_idx_n2 ",link_info==null);
- assertTrue("testH5Lget_value_by_idx_n2 link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT);
+ assertFalse("testH5Lget_value_by_idx_n2 ", link_info == null);
+ assertTrue("testH5Lget_value_by_idx_n2 link type", link_info.type == HDF5Constants.H5L_TYPE_SOFT);
try {
- link_type = H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT);
+ link_type =
+ H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2,
+ link_value, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_value_by_idx: " + err);
}
assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_SOFT);
- assertFalse("testH5Lget_value_by_idx_n2 ", link_value[0]==null);
- assertTrue("testH5Lget_value_by_idx_n2 Link Value ", link_value[0].compareTo("/G1/DS2")==0);
+ assertFalse("testH5Lget_value_by_idx_n2 ", link_value[0] == null);
+ assertTrue("testH5Lget_value_by_idx_n2 Link Value ", link_value[0].compareTo("/G1/DS2") == 0);
}
@Test
- public void testH5Lget_value_by_idx_n2_create() {
+ public void testH5Lget_value_by_idx_n2_create()
+ {
H5L_info_t link_info = null;
- String[] link_value = {null,null};
- int link_type = -1;
+ String[] link_value = {null, null};
+ int link_type = -1;
try {
int order = H5.H5Pget_link_creation_order(H5fcpl);
- assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED);
+ assertTrue("creation order :" + order,
+ order == HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED);
}
catch (Throwable err) {
err.printStackTrace();
@@ -562,116 +646,139 @@ public class TestH5Lcreate {
}
_createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
try {
- link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
+ link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER,
+ HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_info_by_idx: " + err);
}
- assertFalse("testH5Lget_value_by_idx_n2 ", link_info==null);
- assertTrue("testH5Lget_value_by_idx_n2 link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT);
+ assertFalse("testH5Lget_value_by_idx_n2 ", link_info == null);
+ assertTrue("testH5Lget_value_by_idx_n2 link type", link_info.type == HDF5Constants.H5L_TYPE_SOFT);
try {
- link_type = H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT);
+ link_type =
+ H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER,
+ HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_value_by_idx: " + err);
}
assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_SOFT);
- assertFalse("testH5Lget_value_by_idx_n2 ", link_value[0]==null);
- assertTrue("testH5Lget_value_by_idx_n2 Link Value ", link_value[0].compareTo("/G1/DS2")==0);
+ assertFalse("testH5Lget_value_by_idx_n2 ", link_value[0] == null);
+ assertTrue("testH5Lget_value_by_idx_n2 Link Value ", link_value[0].compareTo("/G1/DS2") == 0);
}
@Test
- public void testH5Lget_value_by_idx_external_name() {
+ public void testH5Lget_value_by_idx_external_name()
+ {
H5L_info_t link_info = null;
- String[] link_value = {null,null};
- int link_type = -1;
+ String[] link_value = {null, null};
+ int link_type = -1;
- _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
try {
- link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
+ link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME,
+ HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_info_by_idx: " + err);
}
- assertFalse("testH5Lget_value_by_idx_ext ", link_info==null);
- assertTrue("testH5Lget_value_by_idx_ext link type "+link_info.type, link_info.type==HDF5Constants.H5L_TYPE_EXTERNAL);
+ assertFalse("testH5Lget_value_by_idx_ext ", link_info == null);
+ assertTrue("testH5Lget_value_by_idx_ext link type " + link_info.type,
+ link_info.type == HDF5Constants.H5L_TYPE_EXTERNAL);
try {
- link_type = H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT);
+ link_type =
+ H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2,
+ link_value, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_value_by_idx: " + err);
}
assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_EXTERNAL);
- assertFalse("testH5Lget_value_by_idx_ext ", link_value[0]==null);
- assertFalse("testH5Lget_value_by_idx_ext ", link_value[1]==null);
- assertTrue("testH5Lget_value_by_idx_ext Link Value ", link_value[0].compareTo("DT1")==0);
+ assertFalse("testH5Lget_value_by_idx_ext ", link_value[0] == null);
+ assertFalse("testH5Lget_value_by_idx_ext ", link_value[1] == null);
+ assertTrue("testH5Lget_value_by_idx_ext Link Value ", link_value[0].compareTo("DT1") == 0);
}
@Test
- public void testH5Lget_value_by_idx_external_create() {
+ public void testH5Lget_value_by_idx_external_create()
+ {
H5L_info_t link_info = null;
- String[] link_value = {null,null};
- int link_type = -1;
+ String[] link_value = {null, null};
+ int link_type = -1;
- _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
try {
- link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
+ link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER,
+ HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_info_by_idx: " + err);
}
- assertFalse("testH5Lget_value_by_idx_ext ", link_info==null);
- assertTrue("testH5Lget_value_by_idx_ext link type "+link_info.type, link_info.type==HDF5Constants.H5L_TYPE_EXTERNAL);
+ assertFalse("testH5Lget_value_by_idx_ext ", link_info == null);
+ assertTrue("testH5Lget_value_by_idx_ext link type " + link_info.type,
+ link_info.type == HDF5Constants.H5L_TYPE_EXTERNAL);
try {
- link_type = H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT);
+ link_type =
+ H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER,
+ HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_value_by_idx: " + err);
}
assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_EXTERNAL);
- assertFalse("testH5Lget_value_by_idx_ext ", link_value[0]==null);
- assertFalse("testH5Lget_value_by_idx_ext ", link_value[1]==null);
- assertTrue("testH5Lget_value_by_idx_ext Link Value ", link_value[0].compareTo("DT1")==0);
+ assertFalse("testH5Lget_value_by_idx_ext ", link_value[0] == null);
+ assertFalse("testH5Lget_value_by_idx_ext ", link_value[1] == null);
+ assertTrue("testH5Lget_value_by_idx_ext Link Value ", link_value[0].compareTo("DT1") == 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Ldelete_by_idx_not_exist_name() throws Throwable {
- H5.H5Ldelete_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ public void testH5Ldelete_by_idx_not_exist_name() throws Throwable
+ {
+ H5.H5Ldelete_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0,
+ HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Ldelete_by_idx_not_exist_create() throws Throwable {
- H5.H5Ldelete_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ public void testH5Ldelete_by_idx_not_exist_create() throws Throwable
+ {
+ H5.H5Ldelete_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0,
+ HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Ldelete_by_idx_n2_name() {
+ public void testH5Ldelete_by_idx_n2_name()
+ {
H5L_info_t link_info = null;
_createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
try {
- link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
+ link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME,
+ HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_info_by_idx: " + err);
}
- assertFalse("testH5Ldelete_by_idx_n2 ", link_info==null);
- assertTrue("testH5Ldelete_by_idx_n2 link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT);
+ assertFalse("testH5Ldelete_by_idx_n2 ", link_info == null);
+ assertTrue("testH5Ldelete_by_idx_n2 link type", link_info.type == HDF5Constants.H5L_TYPE_SOFT);
try {
- H5.H5Ldelete_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
+ H5.H5Ldelete_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2,
+ HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Ldelete_by_idx: " + err);
}
try {
- link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
+ link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME,
+ HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
}
catch (HDF5LibraryException err) {
link_info = null;
@@ -680,31 +787,35 @@ public class TestH5Lcreate {
err.printStackTrace();
fail("H5.H5Ldelete_by_idx: " + err);
}
- assertTrue("testH5Ldelete_by_idx_n2 ",link_info==null);
+ assertTrue("testH5Ldelete_by_idx_n2 ", link_info == null);
}
@Test
- public void testH5Ldelete_by_idx_n2_create() {
+ public void testH5Ldelete_by_idx_n2_create()
+ {
H5L_info_t link_info = null;
_createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
try {
- link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
+ link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER,
+ HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lget_info_by_idx: " + err);
}
- assertFalse("testH5Ldelete_by_idx_n2 ", link_info==null);
- assertTrue("testH5Ldelete_by_idx_n2 link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT);
+ assertFalse("testH5Ldelete_by_idx_n2 ", link_info == null);
+ assertTrue("testH5Ldelete_by_idx_n2 link type", link_info.type == HDF5Constants.H5L_TYPE_SOFT);
try {
- H5.H5Ldelete_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
+ H5.H5Ldelete_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2,
+ HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Ldelete_by_idx: " + err);
}
try {
- link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
+ link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER,
+ HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT);
}
catch (HDF5LibraryException err) {
link_info = null;
@@ -713,28 +824,33 @@ public class TestH5Lcreate {
err.printStackTrace();
fail("H5.H5Ldelete_by_idx: " + err);
}
- assertTrue("testH5Ldelete_by_idx_n2 ",link_info==null);
+ assertTrue("testH5Ldelete_by_idx_n2 ", link_info == null);
}
@Test
- public void testH5Lvisit_create() {
+ public void testH5Lvisit_create()
+ {
try {
int order = H5.H5Pget_link_creation_order(H5fcpl);
- assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED);
+ assertTrue("creation order :" + order,
+ order == HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lvisit_create: H5Pget_link_creation_order " + err);
}
- _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
+ _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
_createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
class idata {
public String link_name = null;
- public int link_type = -1;
- idata(String name, int type) {
+ public int link_type = -1;
+ idata(String name, int type)
+ {
this.link_name = name;
this.link_type = type;
}
@@ -744,7 +860,8 @@ public class TestH5Lcreate {
}
H5L_iterate_opdata_t iter_data = new H5L_iter_data();
class H5L_iter_callback implements H5L_iterate_t {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data)
+ {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
@@ -752,41 +869,60 @@ public class TestH5Lcreate {
}
H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
- H5.H5Lvisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, iter_data);
+ H5.H5Lvisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb,
+ iter_data);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Lvisit: " + err);
}
- assertFalse("H5Lvisit ",((H5L_iter_data)iter_data).iterdata.isEmpty());
- assertTrue("H5Lvisit "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==6);
- assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1")==0);
- assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("G1")==0);
- assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1/DS2")==0);
- assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("CPY1")==0);
- assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("LE")==0);
- assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(5)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(5)).link_name.compareToIgnoreCase("LS")==0);
+ assertFalse("H5Lvisit ", ((H5L_iter_data)iter_data).iterdata.isEmpty());
+ assertTrue("H5Lvisit " + ((H5L_iter_data)iter_data).iterdata.size(),
+ ((H5L_iter_data)iter_data).iterdata.size() == 6);
+ assertTrue("H5Lvisit " + ((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name,
+ ((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1") ==
+ 0);
+ assertTrue("H5Lvisit " + ((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name,
+ ((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("G1") ==
+ 0);
+ assertTrue(
+ "H5Lvisit " + ((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name,
+ ((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1/DS2") == 0);
+ assertTrue(
+ "H5Lvisit " + ((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name,
+ ((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("CPY1") == 0);
+ assertTrue("H5Lvisit " + ((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name,
+ ((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("LE") ==
+ 0);
+ assertTrue("H5Lvisit " + ((idata)((H5L_iter_data)iter_data).iterdata.get(5)).link_name,
+ ((idata)((H5L_iter_data)iter_data).iterdata.get(5)).link_name.compareToIgnoreCase("LS") ==
+ 0);
}
@Test
- public void testH5Literate_create() {
+ public void testH5Literate_create()
+ {
try {
int order = H5.H5Pget_link_creation_order(H5fcpl);
- assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED);
+ assertTrue("creation order :" + order,
+ order == HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Literate_create: H5Pget_link_creation_order " + err);
}
- _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
+ _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
_createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
class idata {
public String link_name = null;
- public int link_type = -1;
- idata(String name, int type) {
+ public int link_type = -1;
+ idata(String name, int type)
+ {
this.link_name = name;
this.link_type = type;
}
@@ -796,7 +932,8 @@ public class TestH5Lcreate {
}
H5L_iterate_opdata_t iter_data = new H5L_iter_data();
class H5L_iter_callback implements H5L_iterate_t {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data)
+ {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
@@ -804,19 +941,30 @@ public class TestH5Lcreate {
}
H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
- H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, iter_cb, iter_data);
+ H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, iter_cb,
+ iter_data);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Literate: " + err);
}
- assertFalse("H5Literate ",((H5L_iter_data)iter_data).iterdata.isEmpty());
- assertTrue("H5Literate "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==5);
- assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1")==0);
- assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("G1")==0);
- assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("CPY1")==0);
- assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("LE")==0);
- assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("LS")==0);
+ assertFalse("H5Literate ", ((H5L_iter_data)iter_data).iterdata.isEmpty());
+ assertTrue("H5Literate " + ((H5L_iter_data)iter_data).iterdata.size(),
+ ((H5L_iter_data)iter_data).iterdata.size() == 5);
+ assertTrue("H5Literate " + ((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name,
+ ((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1") ==
+ 0);
+ assertTrue("H5Literate " + ((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name,
+ ((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("G1") ==
+ 0);
+ assertTrue(
+ "H5Literate " + ((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name,
+ ((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("CPY1") == 0);
+ assertTrue("H5Literate " + ((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name,
+ ((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("LE") ==
+ 0);
+ assertTrue("H5Literate " + ((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name,
+ ((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("LS") ==
+ 0);
}
-
}
diff --git a/java/test/TestH5Lparams.java b/java/test/TestH5Lparams.java
index 30ee242..78de663 100644
--- a/java/test/TestH5Lparams.java
+++ b/java/test/TestH5Lparams.java
@@ -13,6 +13,7 @@
package test;
import static org.junit.Assert.assertTrue;
+
import hdf.hdf5lib.H5;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
@@ -23,206 +24,246 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Lparams {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
@Before
- public void checkOpenIDs() {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void checkOpenIDs()
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
}
@After
- public void nextTestName() {
+ public void nextTestName()
+ {
System.out.println();
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lget_value_invalid() throws Throwable {
+ public void testH5Lget_value_invalid() throws Throwable
+ {
H5.H5Lget_value(-1, "Bogus", null, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Lget_value_null() throws Throwable {
+ public void testH5Lget_value_null() throws Throwable
+ {
H5.H5Lget_value(-1, null, null, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lexists_invalid() throws Throwable {
+ public void testH5Lexists_invalid() throws Throwable
+ {
H5.H5Lexists(-1, "Bogus", -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Lexists_null() throws Throwable {
+ public void testH5Lexists_null() throws Throwable
+ {
H5.H5Lexists(-1, null, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lget_info_invalid() throws Throwable {
+ public void testH5Lget_info_invalid() throws Throwable
+ {
H5.H5Lget_info(-1, "Bogus", -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Lget_info_null() throws Throwable {
+ public void testH5Lget_info_null() throws Throwable
+ {
H5.H5Lget_info(-1, null, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lget_info_by_idx_invalid() throws Throwable {
+ public void testH5Lget_info_by_idx_invalid() throws Throwable
+ {
H5.H5Lget_info_by_idx(-1, "Bogus", -1, -1, -1L, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Lget_info_by_idx_null() throws Throwable {
+ public void testH5Lget_info_by_idx_null() throws Throwable
+ {
H5.H5Lget_info_by_idx(-1, null, 0, 0, 0L, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lget_name_by_idx_invalid() throws Throwable {
+ public void testH5Lget_name_by_idx_invalid() throws Throwable
+ {
H5.H5Lget_name_by_idx(-1, "Bogus", -1, -1, -1L, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Lget_name_by_idx_null() throws Throwable {
+ public void testH5Lget_name_by_idx_null() throws Throwable
+ {
H5.H5Lget_name_by_idx(-1, null, 0, 0, 0L, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lcreate_hard_invalid() throws Throwable {
+ public void testH5Lcreate_hard_invalid() throws Throwable
+ {
H5.H5Lcreate_hard(-1, "Bogus", -1, "Bogus", -1, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Lcreate_hard_null_current() throws Throwable {
+ public void testH5Lcreate_hard_null_current() throws Throwable
+ {
H5.H5Lcreate_hard(-1, null, 0, "Bogus", 0, 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Lcreate_hard_null_dest() throws Throwable {
+ public void testH5Lcreate_hard_null_dest() throws Throwable
+ {
H5.H5Lcreate_hard(-1, "Bogus", 0, null, 0, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Ldelete_invalid() throws Throwable {
+ public void testH5Ldelete_invalid() throws Throwable
+ {
H5.H5Ldelete(-1, "Bogus", -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Ldelete_null() throws Throwable {
+ public void testH5Ldelete_null() throws Throwable
+ {
H5.H5Ldelete(-1, null, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lcreate_soft_invalid() throws Throwable {
- H5.H5Lcreate_soft( "Bogus", -1, "Bogus", -1, -1);
+ public void testH5Lcreate_soft_invalid() throws Throwable
+ {
+ H5.H5Lcreate_soft("Bogus", -1, "Bogus", -1, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Lcreate_soft_null_current() throws Throwable {
+ public void testH5Lcreate_soft_null_current() throws Throwable
+ {
H5.H5Lcreate_soft(null, 0, "Bogus", 0, 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Lcreate_soft_null_dest() throws Throwable {
+ public void testH5Lcreate_soft_null_dest() throws Throwable
+ {
H5.H5Lcreate_soft("Bogus", 0, null, 0, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lcreate_external_invalid() throws Throwable {
+ public void testH5Lcreate_external_invalid() throws Throwable
+ {
H5.H5Lcreate_external("PathToFile", "Bogus", -1, "Bogus", -1, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Lcreate_external_null_file() throws Throwable {
+ public void testH5Lcreate_external_null_file() throws Throwable
+ {
H5.H5Lcreate_external(null, "Bogus", 0, "Bogus", 0, 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Lcreate_external_null_current() throws Throwable {
+ public void testH5Lcreate_external_null_current() throws Throwable
+ {
H5.H5Lcreate_external("PathToFile", null, 0, "Bogus", 0, 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Lcreate_external_null_dest() throws Throwable {
+ public void testH5Lcreate_external_null_dest() throws Throwable
+ {
H5.H5Lcreate_external("PathToFile", "Bogus", 0, null, 0, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lcopy_invalid() throws Throwable {
+ public void testH5Lcopy_invalid() throws Throwable
+ {
H5.H5Lcopy(-1, "Bogus", -1, "Bogus", -1, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Lcopy_null_current() throws Throwable {
+ public void testH5Lcopy_null_current() throws Throwable
+ {
H5.H5Lcopy(-1, null, 0, "Bogus", 0, 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Lcopy_null_dest() throws Throwable {
+ public void testH5Lcopy_null_dest() throws Throwable
+ {
H5.H5Lcopy(-1, "Bogus", 0, null, 0, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lmove_invalid() throws Throwable {
+ public void testH5Lmove_invalid() throws Throwable
+ {
H5.H5Lmove(-1, "Bogus", -1, "Bogus", -1, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Lmove_null_current() throws Throwable {
+ public void testH5Lmove_null_current() throws Throwable
+ {
H5.H5Lmove(-1, null, 0, "Bogus", 0, 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Lmove_null_dest() throws Throwable {
+ public void testH5Lmove_null_dest() throws Throwable
+ {
H5.H5Lmove(-1, "Bogus", 0, null, 0, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Lget_value_by_idx_invalid() throws Throwable {
+ public void testH5Lget_value_by_idx_invalid() throws Throwable
+ {
H5.H5Lget_value_by_idx(-1, "Bogus", -1, -1, -1L, null, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Lget_value_by_idx_null() throws Throwable {
+ public void testH5Lget_value_by_idx_null() throws Throwable
+ {
H5.H5Lget_value_by_idx(-1, null, 0, 0, 0L, null, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Ldelete_by_idx_invalid() throws Throwable {
+ public void testH5Ldelete_by_idx_invalid() throws Throwable
+ {
H5.H5Ldelete_by_idx(-1, "Bogus", -1, -1, -1L, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Ldelete_by_idx_null() throws Throwable {
+ public void testH5Ldelete_by_idx_null() throws Throwable
+ {
H5.H5Ldelete_by_idx(-1, null, 0, 0, 0L, 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Lvisit_null() throws Throwable {
+ public void testH5Lvisit_null() throws Throwable
+ {
H5.H5Lvisit(-1, -1, -1, null, null);
}
@Test(expected = NullPointerException.class)
- public void testH5Lvisit_by_name_nullname() throws Throwable {
+ public void testH5Lvisit_by_name_nullname() throws Throwable
+ {
H5.H5Lvisit_by_name(-1, null, -1, -1, null, null, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Lvisit_by_name_null() throws Throwable {
+ public void testH5Lvisit_by_name_null() throws Throwable
+ {
H5.H5Lvisit_by_name(-1, "Bogus", -1, -1, null, null, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Literate_null() throws Throwable {
+ public void testH5Literate_null() throws Throwable
+ {
H5.H5Literate(-1, -1, -1, -1, null, null);
}
@Test(expected = NullPointerException.class)
- public void testH5Literate_by_name_nullname() throws Throwable {
+ public void testH5Literate_by_name_nullname() throws Throwable
+ {
H5.H5Literate_by_name(-1, null, -1, -1, -1, null, null, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Literate_by_name_null() throws Throwable {
+ public void testH5Literate_by_name_null() throws Throwable
+ {
H5.H5Literate_by_name(-1, "Bogus", -1, -1, -1, null, null, -1);
}
-
}
diff --git a/java/test/TestH5Obasic.java b/java/test/TestH5Obasic.java
index 350b7aa..cac2e6a 100644
--- a/java/test/TestH5Obasic.java
+++ b/java/test/TestH5Obasic.java
@@ -20,13 +20,13 @@ import java.util.ArrayList;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.callbacks.H5O_iterate_t;
import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t;
+import hdf.hdf5lib.callbacks.H5O_iterate_t;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
+import hdf.hdf5lib.structs.H5O_hdr_info_t;
import hdf.hdf5lib.structs.H5O_info_t;
import hdf.hdf5lib.structs.H5O_native_info_t;
import hdf.hdf5lib.structs.H5O_token_t;
-import hdf.hdf5lib.structs.H5O_hdr_info_t;
import hdf.hdf5lib.structs.H5_ih_info_t;
import org.junit.After;
@@ -36,21 +36,21 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Obasic {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_FILE = "h5ex_g_iterateO1.hdf";
private static H5O_token_t H5la_ds1 = null;
- private static H5O_token_t H5la_l1 = null;
- long H5fid = HDF5Constants.H5I_INVALID_HID;
+ private static H5O_token_t H5la_l1 = null;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
@Before
- public void openH5file()
- throws HDF5LibraryException, NullPointerException {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void openH5file() throws HDF5LibraryException, NullPointerException
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
- H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY,
- HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -59,103 +59,136 @@ public class TestH5Obasic {
}
@After
- public void closeH5file() throws HDF5LibraryException {
+ public void closeH5file() throws HDF5LibraryException
+ {
if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
}
System.out.println();
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oopen_not_exists() throws Throwable {
+ public void testH5Oopen_not_exists() throws Throwable
+ {
long oid = HDF5Constants.H5I_INVALID_HID;
oid = H5.H5Oopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT);
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
}
@Test
- public void testH5Oget_info_dataset() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Oget_info_dataset()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
- oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
obj_info = H5.H5Oget_info(oid);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Oget_info: " + err);
}
- assertFalse("H5Oget_info ",obj_info==null);
- assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ assertFalse("H5Oget_info ", obj_info == null);
+ assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_DATASET);
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
}
@Test
- public void testH5Oget_info_hardlink() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Oget_info_hardlink()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
- oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
obj_info = H5.H5Oget_info(oid);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Oget_info: " + err);
}
- assertFalse("H5Oget_info ",obj_info==null);
- assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ assertFalse("H5Oget_info ", obj_info == null);
+ assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_DATASET);
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
}
@Test
- public void testH5Oget_info_group() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Oget_info_group()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
- oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
obj_info = H5.H5Oget_info(oid);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Oget_info: " + err);
}
- assertFalse("H5Oget_info ",obj_info==null);
- assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_GROUP);
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ assertFalse("H5Oget_info ", obj_info == null);
+ assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_GROUP);
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
}
@Test
- public void testH5Oget_info_datatype() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Oget_info_datatype()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
- oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT);
obj_info = H5.H5Oget_info(oid);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Oget_info: " + err);
}
- assertFalse("H5Oget_info ",obj_info==null);
- assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE);
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ assertFalse("H5Oget_info ", obj_info == null);
+ assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_NAMED_DATATYPE);
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_info_by_name_not_exist_name() throws Throwable {
+ public void testH5Oget_info_by_name_not_exist_name() throws Throwable
+ {
H5.H5Oget_info_by_name(H5fid, "None", HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_info_by_name_not_exists() throws Throwable {
+ public void testH5Oget_info_by_name_not_exists() throws Throwable
+ {
H5.H5Oget_info_by_name(H5fid, "Bogus", HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Oget_info_by_name_dataset() {
+ public void testH5Oget_info_by_name_dataset()
+ {
H5O_info_t obj_info = null;
try {
@@ -165,12 +198,13 @@ public class TestH5Obasic {
err.printStackTrace();
fail("H5.H5Oget_info: " + err);
}
- assertFalse("H5Oget_info ",obj_info==null);
- assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
+ assertFalse("H5Oget_info ", obj_info == null);
+ assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_DATASET);
}
@Test
- public void testH5Oget_info_by_name_hardlink() {
+ public void testH5Oget_info_by_name_hardlink()
+ {
H5O_info_t obj_info = null;
try {
obj_info = H5.H5Oget_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
@@ -179,12 +213,13 @@ public class TestH5Obasic {
err.printStackTrace();
fail("H5.H5Oget_info: " + err);
}
- assertFalse("H5Oget_info ",obj_info==null);
- assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
+ assertFalse("H5Oget_info ", obj_info == null);
+ assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_DATASET);
}
@Test
- public void testH5Oget_info_by_name_group() {
+ public void testH5Oget_info_by_name_group()
+ {
H5O_info_t obj_info = null;
try {
obj_info = H5.H5Oget_info_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
@@ -193,12 +228,13 @@ public class TestH5Obasic {
err.printStackTrace();
fail("H5.H5Oget_info: " + err);
}
- assertFalse("H5Oget_info ",obj_info==null);
- assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_GROUP);
+ assertFalse("H5Oget_info ", obj_info == null);
+ assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_GROUP);
}
@Test
- public void testH5Oget_info_by_name_datatype() {
+ public void testH5Oget_info_by_name_datatype()
+ {
H5O_info_t obj_info = null;
try {
obj_info = H5.H5Oget_info_by_name(H5fid, "DT1", HDF5Constants.H5P_DEFAULT);
@@ -207,36 +243,45 @@ public class TestH5Obasic {
err.printStackTrace();
fail("H5.H5Oget_info: " + err);
}
- assertFalse("H5Oget_info ",obj_info==null);
- assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE);
+ assertFalse("H5Oget_info ", obj_info == null);
+ assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_NAMED_DATATYPE);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_info_by_idx_name_not_exist_name() throws Throwable {
- H5.H5Oget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ public void testH5Oget_info_by_idx_name_not_exist_name() throws Throwable
+ {
+ H5.H5Oget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0,
+ HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_info_by_idx_name_not_exist_create() throws Throwable {
- H5.H5Oget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ public void testH5Oget_info_by_idx_name_not_exist_create() throws Throwable
+ {
+ H5.H5Oget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0,
+ HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_info_by_idx_not_exist_name() throws Throwable {
- H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT);
+ public void testH5Oget_info_by_idx_not_exist_name() throws Throwable
+ {
+ H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5,
+ HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_info_by_idx_not_exist_create() throws Throwable {
- H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT);
+ public void testH5Oget_info_by_idx_not_exist_create() throws Throwable
+ {
+ H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5,
+ HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Oget_info_by_idx_n0() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Oget_info_by_idx_n0()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
- oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
obj_info = H5.H5Oget_info(oid);
}
catch (Throwable err) {
@@ -244,25 +289,32 @@ public class TestH5Obasic {
fail("testH5Oget_info_by_idx_n0:H5.H5Oget_info: " + err);
}
H5la_ds1 = obj_info.token;
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
try {
- obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
+ try {
+ obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME,
+ HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("testH5Oget_info_by_idx_n0:H5.H5Oget_info_by_idx: " + err);
}
- assertFalse("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx ",obj_info==null);
- assertTrue("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
+ assertFalse("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx ", obj_info == null);
+ assertTrue("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx link type",
+ obj_info.type == HDF5Constants.H5O_TYPE_DATASET);
assertTrue("testH5Oget_info_by_idx_n0:Link Object token", obj_info.token.equals(H5la_ds1));
}
@Test
- public void testH5Oget_info_by_idx_n3() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Oget_info_by_idx_n3()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
- oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
obj_info = H5.H5Oget_info(oid);
}
catch (Throwable err) {
@@ -270,26 +322,33 @@ public class TestH5Obasic {
fail("testH5Oget_info_by_idx_n3:H5.H5Oget_info: " + err);
}
H5la_l1 = obj_info.token;
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
try {
- obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
+ try {
+ obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME,
+ HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("testH5Oget_info_by_idx_n3:H5.H5Oget_info_by_idx: " + err);
}
- assertFalse("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx ",obj_info==null);
- assertTrue("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
+ assertFalse("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx ", obj_info == null);
+ assertTrue("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx link type",
+ obj_info.type == HDF5Constants.H5O_TYPE_DATASET);
assertTrue("testH5Oget_info_by_idx_n3:Link Object Token", obj_info.token.equals(H5la_l1));
}
@Test
- public void testH5Oget_native_info_dataset() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Oget_native_info_dataset()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_native_info_t native_info = null;
try {
- oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
native_info = H5.H5Oget_native_info(oid);
}
catch (Throwable err) {
@@ -300,16 +359,21 @@ public class TestH5Obasic {
assertFalse("H5Oget_native_info ", native_info.hdr_info == null);
assertFalse("H5Oget_native_info ", native_info.obj_info == null);
assertFalse("H5Oget_native_info ", native_info.attr_info == null);
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
}
@Test
- public void testH5Oget_native_info_hardlink() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Oget_native_info_hardlink()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_native_info_t native_info = null;
try {
- oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
native_info = H5.H5Oget_native_info(oid);
}
catch (Throwable err) {
@@ -320,16 +384,21 @@ public class TestH5Obasic {
assertFalse("H5Oget_native_info ", native_info.hdr_info == null);
assertFalse("H5Oget_native_info ", native_info.obj_info == null);
assertFalse("H5Oget_native_info ", native_info.attr_info == null);
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
}
@Test
- public void testH5Oget_native_info_group() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Oget_native_info_group()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_native_info_t native_info = null;
try {
- oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
native_info = H5.H5Oget_native_info(oid);
}
catch (Throwable err) {
@@ -340,16 +409,21 @@ public class TestH5Obasic {
assertFalse("H5Oget_native_info ", native_info.hdr_info == null);
assertFalse("H5Oget_native_info ", native_info.obj_info == null);
assertFalse("H5Oget_native_info ", native_info.attr_info == null);
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
}
@Test
- public void testH5Oget_native_info_datatype() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Oget_native_info_datatype()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_native_info_t native_info = null;
try {
- oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT);
native_info = H5.H5Oget_native_info(oid);
}
catch (Throwable err) {
@@ -360,21 +434,28 @@ public class TestH5Obasic {
assertFalse("H5Oget_native_info ", native_info.hdr_info == null);
assertFalse("H5Oget_native_info ", native_info.obj_info == null);
assertFalse("H5Oget_native_info ", native_info.attr_info == null);
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_native_info_by_name_not_exist_name() throws Throwable {
+ public void testH5Oget_native_info_by_name_not_exist_name() throws Throwable
+ {
H5.H5Oget_native_info_by_name(H5fid, "None", HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_native_info_by_name_not_exists() throws Throwable {
+ public void testH5Oget_native_info_by_name_not_exists() throws Throwable
+ {
H5.H5Oget_native_info_by_name(H5fid, "Bogus", HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Oget_native_info_by_name_dataset() {
+ public void testH5Oget_native_info_by_name_dataset()
+ {
H5O_native_info_t native_info = null;
try {
@@ -391,7 +472,8 @@ public class TestH5Obasic {
}
@Test
- public void testH5Oget_native_info_by_name_hardlink() {
+ public void testH5Oget_native_info_by_name_hardlink()
+ {
H5O_native_info_t native_info = null;
try {
@@ -408,7 +490,8 @@ public class TestH5Obasic {
}
@Test
- public void testH5Oget_native_info_by_name_group() {
+ public void testH5Oget_native_info_by_name_group()
+ {
H5O_native_info_t native_info = null;
try {
@@ -425,7 +508,8 @@ public class TestH5Obasic {
}
@Test
- public void testH5Oget_native_info_by_name_datatype() {
+ public void testH5Oget_native_info_by_name_datatype()
+ {
H5O_native_info_t native_info = null;
try {
@@ -442,35 +526,44 @@ public class TestH5Obasic {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_native_info_by_idx_name_not_exist_name() throws Throwable {
- H5.H5Oget_native_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ public void testH5Oget_native_info_by_idx_name_not_exist_name() throws Throwable
+ {
+ H5.H5Oget_native_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0,
+ HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_native_info_by_idx_name_not_exist_create() throws Throwable {
- H5.H5Oget_native_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ public void testH5Oget_native_info_by_idx_name_not_exist_create() throws Throwable
+ {
+ H5.H5Oget_native_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER,
+ HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_native_info_by_idx_not_exist_name() throws Throwable {
- H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT);
+ public void testH5Oget_native_info_by_idx_not_exist_name() throws Throwable
+ {
+ H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5,
+ HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_native_info_by_idx_not_exist_create() throws Throwable {
- H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT);
+ public void testH5Oget_native_info_by_idx_not_exist_create() throws Throwable
+ {
+ H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC,
+ 5, HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Oget_native_info_by_idx_n0() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Oget_native_info_by_idx_n0()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_native_info_t native_info = null;
H5O_hdr_info_t ohdr;
H5_ih_info_t oinfo;
H5_ih_info_t ainfo;
try {
- oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
native_info = H5.H5Oget_native_info(oid);
}
catch (Throwable err) {
@@ -478,14 +571,20 @@ public class TestH5Obasic {
fail("testH5Oget_native_info_by_idx_n0:H5.H5Oget_native_info: " + err);
}
- ohdr = native_info.hdr_info;
+ ohdr = native_info.hdr_info;
oinfo = native_info.obj_info;
ainfo = native_info.attr_info;
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
try {
- native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ native_info =
+ H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME,
+ HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -501,15 +600,16 @@ public class TestH5Obasic {
}
@Test
- public void testH5Oget_native_info_by_idx_n3() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Oget_native_info_by_idx_n3()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_native_info_t native_info = null;
H5O_hdr_info_t ohdr;
H5_ih_info_t oinfo;
H5_ih_info_t ainfo;
try {
- oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
native_info = H5.H5Oget_native_info(oid);
}
catch (Throwable err) {
@@ -517,14 +617,20 @@ public class TestH5Obasic {
fail("testH5Oget_native_info_by_idx_n3:H5.H5Oget_native_info: " + err);
}
- ohdr = native_info.hdr_info;
+ ohdr = native_info.hdr_info;
oinfo = native_info.obj_info;
ainfo = native_info.attr_info;
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
try {
- native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
+ native_info =
+ H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME,
+ HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -540,11 +646,13 @@ public class TestH5Obasic {
}
@Test
- public void testH5Ovisit() {
+ public void testH5Ovisit()
+ {
class idata {
public String link_name = null;
- public int link_type = -1;
- idata(String name, int type) {
+ public int link_type = -1;
+ idata(String name, int type)
+ {
this.link_name = name;
this.link_type = type;
}
@@ -554,7 +662,8 @@ public class TestH5Obasic {
}
H5O_iterate_opdata_t iter_data = new H5O_iter_data();
class H5O_iter_callback implements H5O_iterate_t {
- public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) {
+ public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data)
+ {
idata id = new idata(name, info.type);
((H5O_iter_data)op_data).iterdata.add(id);
return 0;
@@ -568,22 +677,31 @@ public class TestH5Obasic {
err.printStackTrace();
fail("H5.H5Ovisit: " + err);
}
- assertFalse("H5Ovisit ",((H5O_iter_data)iter_data).iterdata.isEmpty());
- assertTrue("H5Ovisit "+((H5O_iter_data)iter_data).iterdata.size(),((H5O_iter_data)iter_data).iterdata.size()==5);
- assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(0)).link_name,(((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".")==0);
- assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(1)).link_name,(((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS1")==0);
- assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(2)).link_name,(((H5O_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("DT1")==0);
- assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(3)).link_name,(((H5O_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1")==0);
- assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(4)).link_name,(((H5O_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("G1/DS2")==0);
-// assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(5)).link_name,((idata)((H5O_iter_data)iter_data).iterdata.get(5)).link_name.compareToIgnoreCase("L1")==0);
+ assertFalse("H5Ovisit ", ((H5O_iter_data)iter_data).iterdata.isEmpty());
+ assertTrue("H5Ovisit " + ((H5O_iter_data)iter_data).iterdata.size(),
+ ((H5O_iter_data)iter_data).iterdata.size() == 5);
+ assertTrue("H5Ovisit " + (((H5O_iter_data)iter_data).iterdata.get(0)).link_name,
+ (((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".") == 0);
+ assertTrue("H5Ovisit " + (((H5O_iter_data)iter_data).iterdata.get(1)).link_name,
+ (((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS1") == 0);
+ assertTrue("H5Ovisit " + (((H5O_iter_data)iter_data).iterdata.get(2)).link_name,
+ (((H5O_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("DT1") == 0);
+ assertTrue("H5Ovisit " + (((H5O_iter_data)iter_data).iterdata.get(3)).link_name,
+ (((H5O_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1") == 0);
+ assertTrue("H5Ovisit " + (((H5O_iter_data)iter_data).iterdata.get(4)).link_name,
+ (((H5O_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("G1/DS2") == 0);
+ // assertTrue("H5Ovisit
+ // "+((idata)((H5O_iter_data)iter_data).iterdata.get(5)).link_name,((idata)((H5O_iter_data)iter_data).iterdata.get(5)).link_name.compareToIgnoreCase("L1")==0);
}
@Test
- public void testH5Ovisit_by_name() {
+ public void testH5Ovisit_by_name()
+ {
class idata {
public String link_name = null;
- public int link_type = -1;
- idata(String name, int type) {
+ public int link_type = -1;
+ idata(String name, int type)
+ {
this.link_name = name;
this.link_type = type;
}
@@ -593,7 +711,8 @@ public class TestH5Obasic {
}
H5O_iterate_opdata_t iter_data = new H5O_iter_data();
class H5O_iter_callback implements H5O_iterate_t {
- public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) {
+ public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data)
+ {
idata id = new idata(name, info.type);
((H5O_iter_data)op_data).iterdata.add(id);
return 0;
@@ -601,20 +720,25 @@ public class TestH5Obasic {
}
H5O_iterate_t iter_cb = new H5O_iter_callback();
try {
- H5.H5Ovisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT);
+ H5.H5Ovisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb,
+ iter_data, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Ovisit_by_name: " + err);
}
- assertFalse("H5Ovisit_by_name ",((H5O_iter_data)iter_data).iterdata.isEmpty());
- assertTrue("H5Ovisit_by_name "+((H5O_iter_data)iter_data).iterdata.size(),((H5O_iter_data)iter_data).iterdata.size()==2);
- assertTrue("H5Ovisit_by_name "+(((H5O_iter_data)iter_data).iterdata.get(0)).link_name,(((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".")==0);
- assertTrue("H5Ovisit_by_name "+(((H5O_iter_data)iter_data).iterdata.get(1)).link_name,(((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS2")==0);
+ assertFalse("H5Ovisit_by_name ", ((H5O_iter_data)iter_data).iterdata.isEmpty());
+ assertTrue("H5Ovisit_by_name " + ((H5O_iter_data)iter_data).iterdata.size(),
+ ((H5O_iter_data)iter_data).iterdata.size() == 2);
+ assertTrue("H5Ovisit_by_name " + (((H5O_iter_data)iter_data).iterdata.get(0)).link_name,
+ (((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".") == 0);
+ assertTrue("H5Ovisit_by_name " + (((H5O_iter_data)iter_data).iterdata.get(1)).link_name,
+ (((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS2") == 0);
}
@Test
- public void testH5Oexists_by_name() {
+ public void testH5Oexists_by_name()
+ {
boolean name_exists = false;
try {
name_exists = H5.H5Oexists_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
@@ -624,16 +748,17 @@ public class TestH5Obasic {
fail("H5.H5Oexists_by_name: " + err);
}
assertTrue("H5Oexists_by_name ", name_exists);
- //TODO get dangling link result
+ // TODO get dangling link result
}
@Test
- public void testH5Oopen_by_token() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Oopen_by_token()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
try {
- oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
obj_info = H5.H5Oget_info(oid);
}
catch (Throwable err) {
@@ -641,7 +766,11 @@ public class TestH5Obasic {
fail("testH5Oopen_by_token: H5.H5Oget_info: " + err);
}
H5la_ds1 = obj_info.token;
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
try {
oid = H5.H5Oopen_by_token(H5fid, H5la_ds1);
}
@@ -656,22 +785,28 @@ public class TestH5Obasic {
err.printStackTrace();
fail("testH5Oopen_by_token: H5.H5Oget_info: " + err);
}
- assertFalse("testH5Oopen_by_token: H5Oget_info ",obj_info==null);
- assertTrue("testH5Oopen_by_token: H5Oget_info link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
+ assertFalse("testH5Oopen_by_token: H5Oget_info ", obj_info == null);
+ assertTrue("testH5Oopen_by_token: H5Oget_info link type",
+ obj_info.type == HDF5Constants.H5O_TYPE_DATASET);
assertTrue("testH5Oopen_by_token: Link Object Token", obj_info.token.equals(H5la_ds1));
}
finally {
- try{H5.H5Oclose(oid);} catch (Exception ex) {}
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Oopen_by_idx_n0() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Oopen_by_idx_n0()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
try {
- oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
obj_info = H5.H5Oget_info(oid);
}
catch (Throwable err) {
@@ -679,9 +814,14 @@ public class TestH5Obasic {
fail("testH5Oopen_by_idx_n0: H5.H5Oget_info: " + err);
}
H5la_ds1 = obj_info.token;
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
try {
- oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
+ try {
+ oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0,
+ HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -694,22 +834,28 @@ public class TestH5Obasic {
err.printStackTrace();
fail("testH5Oopen_by_idx_n0: H5.H5Oget_info_by_idx: " + err);
}
- assertFalse("testH5Oopen_by_idx_n0: H5Oget_info_by_idx ",obj_info==null);
- assertTrue("testH5Oopen_by_idx_n0: H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
+ assertFalse("testH5Oopen_by_idx_n0: H5Oget_info_by_idx ", obj_info == null);
+ assertTrue("testH5Oopen_by_idx_n0: H5Oget_info_by_idx link type",
+ obj_info.type == HDF5Constants.H5O_TYPE_DATASET);
assertTrue("testH5Oopen_by_idx_n0: Link Object Token", obj_info.token.equals(H5la_ds1));
}
finally {
- try{H5.H5Oclose(oid);} catch (Exception ex) {}
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Oopen_by_idx_n3() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Oopen_by_idx_n3()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
try {
- oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
obj_info = H5.H5Oget_info(oid);
}
catch (Throwable err) {
@@ -717,9 +863,14 @@ public class TestH5Obasic {
fail("testH5Oopen_by_idx_n3:H5.H5Oget_info: " + err);
}
H5la_l1 = obj_info.token;
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
try {
- oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
+ try {
+ oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3,
+ HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -732,12 +883,17 @@ public class TestH5Obasic {
err.printStackTrace();
fail("testH5Oopen_by_idx_n3:H5.H5Oget_info_by_idx: " + err);
}
- assertFalse("testH5Oopen_by_idx_n3:H5Oget_info_by_idx ",obj_info==null);
- assertTrue("testH5Oopen_by_idx_n3:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
+ assertFalse("testH5Oopen_by_idx_n3:H5Oget_info_by_idx ", obj_info == null);
+ assertTrue("testH5Oopen_by_idx_n3:H5Oget_info_by_idx link type",
+ obj_info.type == HDF5Constants.H5O_TYPE_DATASET);
assertTrue("testH5Oopen_by_idx_n3:Link Object Token", obj_info.token.equals(H5la_l1));
}
finally {
- try{H5.H5Oclose(oid);} catch (Exception ex) {}
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
}
}
}
diff --git a/java/test/TestH5Ocopy.java b/java/test/TestH5Ocopy.java
index 821cad3..e429fef 100644
--- a/java/test/TestH5Ocopy.java
+++ b/java/test/TestH5Ocopy.java
@@ -31,20 +31,22 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Ocopy {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String FILENAME = "testRefsattribute.h5";
- private static final int DIM_X = 4;
- private static final int DIM_Y = 6;
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5dsid = HDF5Constants.H5I_INVALID_HID;
- long H5did1 = HDF5Constants.H5I_INVALID_HID;
- long H5did2 = HDF5Constants.H5I_INVALID_HID;
- long H5gcpl = HDF5Constants.H5I_INVALID_HID;
- long H5gid = HDF5Constants.H5I_INVALID_HID;
- long H5dsid2 = HDF5Constants.H5I_INVALID_HID;
- long[] dims = { 2 };
-
- private final void _deleteFile(String filename) {
+ private static final int DIM_X = 4;
+ private static final int DIM_Y = 6;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did1 = HDF5Constants.H5I_INVALID_HID;
+ long H5did2 = HDF5Constants.H5I_INVALID_HID;
+ long H5gcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5gid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid2 = HDF5Constants.H5I_INVALID_HID;
+ long[] dims = {2};
+
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
@@ -57,87 +59,113 @@ public class TestH5Ocopy {
}
}
- private final long _createDataset(long fid, long dsid, String name, long dapl) {
+ private final long _createDataset(long fid, long dsid, String name, long dapl)
+ {
long did = HDF5Constants.H5I_INVALID_HID;
try {
- did = H5.H5Dcreate(fid, name,
- HDF5Constants.H5T_STD_I32BE, dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
+ did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, dapl);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Dcreate: " + err);
}
- assertTrue("TestH5O._createDataset: ",did >= 0);
+ assertTrue("TestH5O._createDataset: ", did >= 0);
return did;
}
- private final long _createGroup(long fid, String name) {
+ private final long _createGroup(long fid, String name)
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
try {
H5gcpl = HDF5Constants.H5P_DEFAULT;
- gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
- H5gcpl, HDF5Constants.H5P_DEFAULT);
+ gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, H5gcpl, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Gcreate: " + err);
}
- assertTrue("TestH5O._createGroup: ",gid >= 0);
+ assertTrue("TestH5O._createGroup: ", gid >= 0);
return gid;
}
@Before
- public void createH5file()
- throws NullPointerException, HDF5Exception {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void createH5file() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
- H5fid = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- H5dsid2 = H5.H5Screate(HDF5Constants.H5S_SCALAR);
- H5did1 = _createDataset(H5fid, H5dsid2, "DS2", HDF5Constants.H5P_DEFAULT);
- H5dsid = H5.H5Screate_simple(1, dims, null);
- H5gid = _createGroup(H5fid, "/G1");
- H5did2 = _createDataset(H5gid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
+ H5dsid2 = H5.H5Screate(HDF5Constants.H5S_SCALAR);
+ H5did1 = _createDataset(H5fid, H5dsid2, "DS2", HDF5Constants.H5P_DEFAULT);
+ H5dsid = H5.H5Screate_simple(1, dims, null);
+ H5gid = _createGroup(H5fid, "/G1");
+ H5did2 = _createDataset(H5gid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("TestH5O.createH5file: " + err);
}
- assertTrue("TestH5O.createH5file: H5.H5Fcreate: ",H5fid >= 0);
- assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ",H5dsid >= 0);
- assertTrue("TestH5O.createH5file: H5.H5Gcreate: ",H5gid >= 0);
+ assertTrue("TestH5O.createH5file: H5.H5Fcreate: ", H5fid >= 0);
+ assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ", H5dsid >= 0);
+ assertTrue("TestH5O.createH5file: H5.H5Gcreate: ", H5gid >= 0);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5gid > 0)
- try {H5.H5Gclose(H5gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(H5gid);
+ }
+ catch (Exception ex) {
+ }
if (H5did2 > 0)
- try {H5.H5Dclose(H5did2);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did2);
+ }
+ catch (Exception ex) {
+ }
if (H5dsid > 0)
- try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid);
+ }
+ catch (Exception ex) {
+ }
if (H5dsid2 > 0)
- try {H5.H5Sclose(H5dsid2);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid2);
+ }
+ catch (Exception ex) {
+ }
if (H5did1 > 0)
- try {H5.H5Dclose(H5did1);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did1);
+ }
+ catch (Exception ex) {
+ }
if (H5fid > 0)
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
_deleteFile(FILENAME);
System.out.println();
}
@Test
- public void testH5OcopyRefsAttr() {
- long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
+ public void testH5OcopyRefsAttr()
+ {
+ long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
byte[][] dset_data = new byte[2][HDF5Constants.H5R_REF_BUF_SIZE];
- long attribute_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
try {
try {
@@ -147,7 +175,7 @@ public class TestH5Ocopy {
err.printStackTrace();
fail("testH5OcopyRefsAttr: H5Rcreate_object " + err);
}
-
+
try {
dset_data[1] = H5.H5Rcreate_object(H5fid, "DS2", HDF5Constants.H5P_DEFAULT);
}
@@ -155,27 +183,40 @@ public class TestH5Ocopy {
err.printStackTrace();
fail("testH5OcopyRefsAttr: H5Rcreate_object " + err);
}
-
+
try {
- attribute_id = H5.H5Acreate(H5did2, "A1", HDF5Constants.H5T_STD_REF, H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ attribute_id = H5.H5Acreate(H5did2, "A1", HDF5Constants.H5T_STD_REF, H5dsid,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
assertTrue("testH5OcopyRefsAttr.H5Acreate: ", attribute_id >= 0);
H5.H5Awrite(attribute_id, HDF5Constants.H5T_STD_REF, dset_data);
-
+
H5.H5Aclose(attribute_id);
}
catch (Exception ex) {
fail("testH5OcopyRefsAttr: H5Awrite failed");
}
finally {
- try {H5.H5Aclose(attribute_id);} catch (Exception exx) {}
+ try {
+ H5.H5Aclose(attribute_id);
+ }
+ catch (Exception exx) {
+ }
}
}
catch (Exception ex) {
ex.printStackTrace();
}
finally {
- try {H5.H5Rdestroy(dset_data[1]);} catch (Exception ex) {}
- try {H5.H5Rdestroy(dset_data[0]);} catch (Exception ex) {}
+ try {
+ H5.H5Rdestroy(dset_data[1]);
+ }
+ catch (Exception ex) {
+ }
+ try {
+ H5.H5Rdestroy(dset_data[0]);
+ }
+ catch (Exception ex) {
+ }
}
try {
@@ -185,19 +226,24 @@ public class TestH5Ocopy {
H5.H5Ocopy(H5fid, ".", H5fid, "CPYREF", ocp_plist_id, HDF5Constants.H5P_DEFAULT);
}
catch (Exception ex) {
- fail("testH5OcopyRefsAttr: H5Ocopy failed");
+ fail("testH5OcopyRefsAttr: H5Ocopy failed");
}
finally {
- try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(ocp_plist_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5OcopyRefsDatasettodiffFile() {
+ public void testH5OcopyRefsDatasettodiffFile()
+ {
byte[][] dset_data = new byte[2][HDF5Constants.H5R_REF_BUF_SIZE];
- long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
- long dataset_id = HDF5Constants.H5I_INVALID_HID;
- long H5fid2 = HDF5Constants.H5I_INVALID_HID;
+ long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long H5fid2 = HDF5Constants.H5I_INVALID_HID;
try {
try {
@@ -214,72 +260,96 @@ public class TestH5Ocopy {
err.printStackTrace();
fail("testH5OcopyRefsDatasettodiffFile: H5Rcreate_object " + err);
}
-
+
try {
- dataset_id = H5.H5Dcreate(H5fid, "DSREF",
- HDF5Constants.H5T_STD_REF, H5dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ dataset_id =
+ H5.H5Dcreate(H5fid, "DSREF", HDF5Constants.H5T_STD_REF, H5dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
assertTrue("testH5OcopyRefsDatasettodiffFile.H5Dcreate: ", dataset_id >= 0);
- H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
+ H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data);
H5.H5Dclose(dataset_id);
}
catch (Exception ex) {
fail("testH5OcopyRefsDatasettodiffFile: create dataset failed");
}
finally {
- try {H5.H5Dclose(dataset_id);} catch (Exception exx) {}
+ try {
+ H5.H5Dclose(dataset_id);
+ }
+ catch (Exception exx) {
+ }
}
}
catch (Exception ex) {
ex.printStackTrace();
}
finally {
- try {H5.H5Rdestroy(dset_data[0]);} catch (Exception ex) {}
- try {H5.H5Rdestroy(dset_data[1]);} catch (Exception ex) {}
+ try {
+ H5.H5Rdestroy(dset_data[0]);
+ }
+ catch (Exception ex) {
+ }
+ try {
+ H5.H5Rdestroy(dset_data[1]);
+ }
+ catch (Exception ex) {
+ }
}
try {
- //create new file
- H5fid2 = H5.H5Fcreate("copy.h5", HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ // create new file
+ H5fid2 = H5.H5Fcreate("copy.h5", HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
assertTrue("testH5OcopyRefsDatasettodiffFile.H5Fcreate: ", H5fid2 >= 0);
H5.H5Fflush(H5fid2, HDF5Constants.H5F_SCOPE_LOCAL);
}
catch (Exception ex) {
- try {H5.H5Fclose(H5fid2);} catch (Exception exx) {}
+ try {
+ H5.H5Fclose(H5fid2);
+ }
+ catch (Exception exx) {
+ }
fail("testH5OcopyRefsDatasettodiffFile: H5Fcreate failed");
}
try {
- //create object copy property list id and set the flags.
+ // create object copy property list id and set the flags.
ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY);
assertTrue("testH5OcopyRefsDatasettodiffFile.H5Pcreate: ", ocp_plist_id >= 0);
H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG);
- //Perform copy function.
+ // Perform copy function.
H5.H5Ocopy(H5fid, ".", H5fid2, "CPYREFD", ocp_plist_id, HDF5Constants.H5P_DEFAULT);
}
- catch (Exception ex){
+ catch (Exception ex) {
ex.printStackTrace();
fail("testH5OcopyRefsDatasettodiffFile: H5Ocopy failed");
}
finally {
- try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {}
- try {H5.H5Fclose(H5fid2);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(ocp_plist_id);
+ }
+ catch (Exception ex) {
+ }
+ try {
+ H5.H5Fclose(H5fid2);
+ }
+ catch (Exception ex) {
+ }
}
_deleteFile("copy.h5");
}
@Test
- public void testH5OcopyRefsDatasettosameFile() {
+ public void testH5OcopyRefsDatasettosameFile()
+ {
byte[][] dset_data = new byte[2][HDF5Constants.H5R_REF_BUF_SIZE];
byte[][] read_data = new byte[2][HDF5Constants.H5R_REF_BUF_SIZE];
- long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
- long dataset_id = HDF5Constants.H5I_INVALID_HID;
- long did = HDF5Constants.H5I_INVALID_HID;
- int obj_type = -1;
+ long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long did = HDF5Constants.H5I_INVALID_HID;
+ int obj_type = -1;
try {
try {
@@ -289,7 +359,7 @@ public class TestH5Ocopy {
err.printStackTrace();
fail("testH5OcopyRefsDatasettosameFile: H5Rcreate_object " + err);
}
-
+
try {
dset_data[1] = H5.H5Rcreate_object(H5fid, "DS2", HDF5Constants.H5P_DEFAULT);
}
@@ -297,43 +367,54 @@ public class TestH5Ocopy {
err.printStackTrace();
fail("testH5OcopyRefsDatasettosameFile: H5Rcreate_object " + err);
}
-
+
try {
- //Create a dataset and write object references to it.
- dataset_id = H5.H5Dcreate(H5fid, "DSREF",
- HDF5Constants.H5T_STD_REF, H5dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ // Create a dataset and write object references to it.
+ dataset_id =
+ H5.H5Dcreate(H5fid, "DSREF", HDF5Constants.H5T_STD_REF, H5dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
assertTrue("testH5OcopyRefsDatasettosameFile.H5Dcreate: ", dataset_id >= 0);
- H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
- //Close the dataset.
+ H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data);
+ // Close the dataset.
H5.H5Dclose(dataset_id);
}
catch (Exception ex) {
fail("testH5OcopyRefsDatasettosameFile: create dataset failed");
}
finally {
- try {H5.H5Dclose(dataset_id);} catch (Exception exx) {}
+ try {
+ H5.H5Dclose(dataset_id);
+ }
+ catch (Exception exx) {
+ }
}
}
catch (Exception ex) {
ex.printStackTrace();
}
finally {
- try {H5.H5Rdestroy(dset_data[1]);} catch (Exception ex) {}
- try {H5.H5Rdestroy(dset_data[0]);} catch (Exception ex) {}
+ try {
+ H5.H5Rdestroy(dset_data[1]);
+ }
+ catch (Exception ex) {
+ }
+ try {
+ H5.H5Rdestroy(dset_data[0]);
+ }
+ catch (Exception ex) {
+ }
}
try {
ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY);
assertTrue("testH5OcopyRefsDatasettosameFile.H5Pcreate: ", ocp_plist_id >= 0);
H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG);
- //Perform copy function.
+ // Perform copy function.
try {
H5.H5Ocopy(H5fid, "DSREF", H5fid, "CPYREFD", ocp_plist_id, HDF5Constants.H5P_DEFAULT);
}
- catch(Exception ex) {
+ catch (Exception ex) {
fail("testH5OcopyRefsDatasettosameFile: H5Ocopy failed");
}
}
@@ -341,11 +422,15 @@ public class TestH5Ocopy {
fail("testH5OcopyRefsDatasettosameFile: H5Pset_copy_object failed");
}
finally {
- try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {}
+ try {
+ H5.H5Pclose(ocp_plist_id);
+ }
+ catch (Exception exx) {
+ }
}
try {
- //Open the dataset that has been copied
+ // Open the dataset that has been copied
try {
did = H5.H5Dopen(H5fid, "DSREF", HDF5Constants.H5P_DEFAULT);
assertTrue("testH5OcopyRefsDatasettosameFile.H5Dopen: ", did >= 0);
@@ -355,9 +440,10 @@ public class TestH5Ocopy {
fail("testH5OcopyRefsDatasettosameFile: H5Dopen failed");
}
- //Read the dataset object references in the read_data buffer.
+ // Read the dataset object references in the read_data buffer.
try {
- H5.H5Dread(did, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL,HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, read_data);
+ H5.H5Dread(did, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, read_data);
}
catch (Exception e) {
e.printStackTrace();
@@ -369,14 +455,18 @@ public class TestH5Ocopy {
fail("testH5OcopyRefsDatasettosameFile: open and read dataset failed");
}
finally {
- try {H5.H5Dclose(did);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(did);
+ }
+ catch (Exception ex) {
+ }
}
try {
- //Get the type of object the reference points to.
+ // Get the type of object the reference points to.
obj_type = H5.H5Rget_obj_type3(read_data[1], HDF5Constants.H5R_OBJECT);
assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET);
-
+
obj_type = H5.H5Rget_obj_type3(read_data[0], HDF5Constants.H5R_OBJECT);
assertEquals(obj_type, HDF5Constants.H5O_TYPE_GROUP);
}
@@ -384,22 +474,32 @@ public class TestH5Ocopy {
ex.printStackTrace();
}
finally {
- try {H5.H5Rdestroy(read_data[1]);} catch (Exception ex) {}
- try {H5.H5Rdestroy(read_data[0]);} catch (Exception ex) {}
+ try {
+ H5.H5Rdestroy(read_data[1]);
+ }
+ catch (Exception ex) {
+ }
+ try {
+ H5.H5Rdestroy(read_data[0]);
+ }
+ catch (Exception ex) {
+ }
}
}
-
+
@Test
- public void testH5OcopyNullRef() throws Throwable {
+ public void testH5OcopyNullRef() throws Throwable
+ {
final long _pid_ = HDF5Constants.H5P_DEFAULT;
- long sid = HDF5Constants.H5I_INVALID_HID;
- long did = HDF5Constants.H5I_INVALID_HID;
- long aid = HDF5Constants.H5I_INVALID_HID;
+ long sid = HDF5Constants.H5I_INVALID_HID;
+ long did = HDF5Constants.H5I_INVALID_HID;
+ long aid = HDF5Constants.H5I_INVALID_HID;
try {
sid = H5.H5Screate_simple(1, new long[] {1}, null);
assertTrue("testH5OcopyNullRef.H5Screate_simple: ", sid >= 0);
- did = H5.H5Dcreate(H5fid, "Dataset_with_null_Ref", HDF5Constants.H5T_NATIVE_INT, sid, _pid_, _pid_, _pid_);
+ did = H5.H5Dcreate(H5fid, "Dataset_with_null_Ref", HDF5Constants.H5T_NATIVE_INT, sid, _pid_,
+ _pid_, _pid_);
assertTrue("testH5OcopyNullRef.H5Dcreate: ", did > 0);
aid = H5.H5Acreate(did, "Null_Ref", HDF5Constants.H5T_STD_REF, sid, _pid_, _pid_);
assertTrue("testH5OcopyNullRef.H5Acreate: ", aid > 0);
@@ -408,20 +508,36 @@ public class TestH5Ocopy {
ex.printStackTrace();
}
finally {
- try {H5.H5Dclose(did);} catch (Exception exx) {}
- try {H5.H5Aclose(aid);} catch (Exception exx) {}
- try {H5.H5Sclose(sid);} catch (Exception exx) {}
+ try {
+ H5.H5Dclose(did);
+ }
+ catch (Exception exx) {
+ }
+ try {
+ H5.H5Aclose(aid);
+ }
+ catch (Exception exx) {
+ }
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception exx) {
+ }
}
long ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY);
assertTrue("testH5OcopyNullRef.H5Pcreate: ", ocp_plist_id >= 0);
H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG);
try {
- H5.H5Ocopy(H5fid, "/Dataset_with_null_Ref", H5fid, "/Dataset_with_null_Ref_cp", ocp_plist_id, _pid_);
+ H5.H5Ocopy(H5fid, "/Dataset_with_null_Ref", H5fid, "/Dataset_with_null_Ref_cp", ocp_plist_id,
+ _pid_);
}
finally {
- try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {}
+ try {
+ H5.H5Pclose(ocp_plist_id);
+ }
+ catch (Exception exx) {
+ }
}
}
-
}
diff --git a/java/test/TestH5OcopyOld.java b/java/test/TestH5OcopyOld.java
index e547051..2cfccc7 100644
--- a/java/test/TestH5OcopyOld.java
+++ b/java/test/TestH5OcopyOld.java
@@ -31,20 +31,22 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5OcopyOld {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String FILENAME = "testRefsattributeO.h5";
- private static final int DIM_X = 4;
- private static final int DIM_Y = 6;
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5dsid = HDF5Constants.H5I_INVALID_HID;
- long H5did1 = HDF5Constants.H5I_INVALID_HID;
- long H5did2 = HDF5Constants.H5I_INVALID_HID;
- long H5gcpl = HDF5Constants.H5I_INVALID_HID;
- long H5gid = HDF5Constants.H5I_INVALID_HID;
- long H5dsid2 = HDF5Constants.H5I_INVALID_HID;
- long[] dims = { 2 };
-
- private final void _deleteFile(String filename) {
+ private static final int DIM_X = 4;
+ private static final int DIM_Y = 6;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did1 = HDF5Constants.H5I_INVALID_HID;
+ long H5did2 = HDF5Constants.H5I_INVALID_HID;
+ long H5gcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5gid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid2 = HDF5Constants.H5I_INVALID_HID;
+ long[] dims = {2};
+
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
@@ -57,93 +59,119 @@ public class TestH5OcopyOld {
}
}
- private final long _createDataset(long fid, long dsid, String name, long dapl) {
+ private final long _createDataset(long fid, long dsid, String name, long dapl)
+ {
long did = HDF5Constants.H5I_INVALID_HID;
try {
- did = H5.H5Dcreate(fid, name,
- HDF5Constants.H5T_STD_I32BE, dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
+ did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, dapl);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Dcreate: " + err);
}
- assertTrue("TestH5O._createDataset: ",did >= 0);
+ assertTrue("TestH5O._createDataset: ", did >= 0);
return did;
}
- private final long _createGroup(long fid, String name) {
+ private final long _createGroup(long fid, String name)
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
try {
H5gcpl = HDF5Constants.H5P_DEFAULT;
- gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
- H5gcpl, HDF5Constants.H5P_DEFAULT);
+ gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, H5gcpl, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Gcreate: " + err);
}
- assertTrue("TestH5O._createGroup: ",gid >= 0);
+ assertTrue("TestH5O._createGroup: ", gid >= 0);
return gid;
}
@Before
- public void createH5file()
- throws NullPointerException, HDF5Exception {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void createH5file() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
- H5fid = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- H5dsid2 = H5.H5Screate(HDF5Constants.H5S_SCALAR);
- H5did1 = _createDataset(H5fid, H5dsid2, "DS2", HDF5Constants.H5P_DEFAULT);
- H5dsid = H5.H5Screate_simple(1, dims, null);
- H5gid = _createGroup(H5fid, "/G1");
- H5did2 = _createDataset(H5gid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
+ H5dsid2 = H5.H5Screate(HDF5Constants.H5S_SCALAR);
+ H5did1 = _createDataset(H5fid, H5dsid2, "DS2", HDF5Constants.H5P_DEFAULT);
+ H5dsid = H5.H5Screate_simple(1, dims, null);
+ H5gid = _createGroup(H5fid, "/G1");
+ H5did2 = _createDataset(H5gid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("TestH5O.createH5file: " + err);
}
- assertTrue("TestH5O.createH5file: H5.H5Fcreate: ",H5fid >= 0);
- assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ",H5dsid >= 0);
- assertTrue("TestH5O.createH5file: H5.H5Gcreate: ",H5gid >= 0);
+ assertTrue("TestH5O.createH5file: H5.H5Fcreate: ", H5fid >= 0);
+ assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ", H5dsid >= 0);
+ assertTrue("TestH5O.createH5file: H5.H5Gcreate: ", H5gid >= 0);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5gid > 0)
- try {H5.H5Gclose(H5gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(H5gid);
+ }
+ catch (Exception ex) {
+ }
if (H5did2 > 0)
- try {H5.H5Dclose(H5did2);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did2);
+ }
+ catch (Exception ex) {
+ }
if (H5dsid > 0)
- try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid);
+ }
+ catch (Exception ex) {
+ }
if (H5dsid2 > 0)
- try {H5.H5Sclose(H5dsid2);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid2);
+ }
+ catch (Exception ex) {
+ }
if (H5did1 > 0)
- try {H5.H5Dclose(H5did1);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did1);
+ }
+ catch (Exception ex) {
+ }
if (H5fid > 0)
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
_deleteFile(FILENAME);
System.out.println();
}
@Test
- public void testH5OcopyRefsAttr() {
+ public void testH5OcopyRefsAttr()
+ {
long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
- byte rbuf0[]=null , rbuf1[] = null;
- byte[] dset_data = new byte[16];
+ byte rbuf0[] = null, rbuf1[] = null;
+ byte[] dset_data = new byte[16];
long attribute_id = HDF5Constants.H5I_INVALID_HID;
try {
rbuf0 = H5.H5Rcreate(H5fid, "/G1", HDF5Constants.H5R_OBJECT, -1);
rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1);
- //System.arraycopy(rbuf0, 0, dset_data, 0, 8);
+ // System.arraycopy(rbuf0, 0, dset_data, 0, 8);
System.arraycopy(rbuf1, 0, dset_data, 8, 8);
}
catch (Exception ex) {
@@ -151,7 +179,8 @@ public class TestH5OcopyOld {
}
try {
- attribute_id = H5.H5Acreate(H5did2, "A1", HDF5Constants.H5T_STD_REF_OBJ, H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ attribute_id = H5.H5Acreate(H5did2, "A1", HDF5Constants.H5T_STD_REF_OBJ, H5dsid,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
assertTrue("testH5OcopyRefsAttr.H5Acreate: ", attribute_id >= 0);
H5.H5Awrite(attribute_id, HDF5Constants.H5T_STD_REF_OBJ, dset_data);
@@ -161,7 +190,11 @@ public class TestH5OcopyOld {
fail("testH5OcopyRefsAttr: H5Awrite failed");
}
finally {
- try {H5.H5Aclose(attribute_id);} catch (Exception exx) {}
+ try {
+ H5.H5Aclose(attribute_id);
+ }
+ catch (Exception exx) {
+ }
}
try {
@@ -171,82 +204,103 @@ public class TestH5OcopyOld {
H5.H5Ocopy(H5fid, ".", H5fid, "CPYREF", ocp_plist_id, HDF5Constants.H5P_DEFAULT);
}
catch (Exception ex) {
- fail("testH5OcopyRefsAttr: H5Ocopy failed");
+ fail("testH5OcopyRefsAttr: H5Ocopy failed");
}
finally {
- try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(ocp_plist_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5OcopyRefsDatasettodiffFile() {
- byte rbuf1[] = null;
- byte[] dset_data = new byte[16];
+ public void testH5OcopyRefsDatasettodiffFile()
+ {
+ byte rbuf1[] = null;
+ byte[] dset_data = new byte[16];
long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
- long dataset_id = HDF5Constants.H5I_INVALID_HID;
- long H5fid2 = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long H5fid2 = HDF5Constants.H5I_INVALID_HID;
try {
rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1);
System.arraycopy(rbuf1, 0, dset_data, 8, 8);
- dataset_id = H5.H5Dcreate(H5fid, "DSREF",
- HDF5Constants.H5T_STD_REF_OBJ, H5dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ dataset_id =
+ H5.H5Dcreate(H5fid, "DSREF", HDF5Constants.H5T_STD_REF_OBJ, H5dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
assertTrue("testH5OcopyRefsDatasettodiffFile.H5Dcreate: ", dataset_id >= 0);
- H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
+ H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data);
H5.H5Dclose(dataset_id);
}
catch (Exception ex) {
fail("testH5OcopyRefsDatasettodiffFile: create dataset failed");
}
finally {
- try {H5.H5Dclose(dataset_id);} catch (Exception exx) {}
+ try {
+ H5.H5Dclose(dataset_id);
+ }
+ catch (Exception exx) {
+ }
}
try {
- //create new file
- H5fid2 = H5.H5Fcreate("copy.h5", HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ // create new file
+ H5fid2 = H5.H5Fcreate("copy.h5", HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
assertTrue("testH5OcopyRefsDatasettodiffFile.H5Fcreate: ", H5fid2 >= 0);
H5.H5Fflush(H5fid2, HDF5Constants.H5F_SCOPE_LOCAL);
}
catch (Exception ex) {
- try {H5.H5Fclose(H5fid2);} catch (Exception exx) {}
+ try {
+ H5.H5Fclose(H5fid2);
+ }
+ catch (Exception exx) {
+ }
fail("testH5OcopyRefsDatasettodiffFile: H5Fcreate failed");
}
try {
- //create object copy property list id and set the flags.
+ // create object copy property list id and set the flags.
ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY);
assertTrue("testH5OcopyRefsDatasettodiffFile.H5Pcreate: ", ocp_plist_id >= 0);
H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG);
- //Perform copy function.
+ // Perform copy function.
H5.H5Ocopy(H5fid, ".", H5fid2, "CPYREFD", ocp_plist_id, HDF5Constants.H5P_DEFAULT);
}
- catch (Exception ex){
+ catch (Exception ex) {
ex.printStackTrace();
fail("testH5OcopyRefsDatasettodiffFile: H5Ocopy failed");
}
finally {
- try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {}
- try {H5.H5Fclose(H5fid2);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(ocp_plist_id);
+ }
+ catch (Exception ex) {
+ }
+ try {
+ H5.H5Fclose(H5fid2);
+ }
+ catch (Exception ex) {
+ }
}
_deleteFile("copy.h5");
}
@Test
- public void testH5OcopyRefsDatasettosameFile() {
- byte rbuf0[]=null , rbuf1[] = null;
- byte[] dset_data = new byte[16];
+ public void testH5OcopyRefsDatasettosameFile()
+ {
+ byte rbuf0[] = null, rbuf1[] = null;
+ byte[] dset_data = new byte[16];
long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
- long dataset_id = HDF5Constants.H5I_INVALID_HID;
- long did = HDF5Constants.H5I_INVALID_HID;
- int obj_type = -1;
- byte[] read_data = new byte[16];
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long did = HDF5Constants.H5I_INVALID_HID;
+ int obj_type = -1;
+ byte[] read_data = new byte[16];
try {
rbuf0 = H5.H5Rcreate(H5fid, "/G1", HDF5Constants.H5R_OBJECT, -1);
@@ -254,19 +308,22 @@ public class TestH5OcopyOld {
System.arraycopy(rbuf0, 0, dset_data, 0, 8);
System.arraycopy(rbuf1, 0, dset_data, 8, 8);
- //Create a dataset and write object references to it.
- dataset_id = H5.H5Dcreate(H5fid, "DSREF",
- HDF5Constants.H5T_STD_REF_OBJ, H5dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ // Create a dataset and write object references to it.
+ dataset_id =
+ H5.H5Dcreate(H5fid, "DSREF", HDF5Constants.H5T_STD_REF_OBJ, H5dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
assertTrue("testH5OcopyRefsDatasettosameFile.H5Dcreate: ", dataset_id >= 0);
- H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data);
- //Close the dataset.
+ H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data);
+ // Close the dataset.
H5.H5Dclose(dataset_id);
}
catch (Exception ex) {
- try {H5.H5Dclose(dataset_id);} catch (Exception exx) {}
+ try {
+ H5.H5Dclose(dataset_id);
+ }
+ catch (Exception exx) {
+ }
fail("testH5OcopyRefsDatasettosameFile: create dataset failed");
}
@@ -276,37 +333,50 @@ public class TestH5OcopyOld {
H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG);
}
catch (Exception ex) {
- try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {}
+ try {
+ H5.H5Pclose(ocp_plist_id);
+ }
+ catch (Exception exx) {
+ }
fail("testH5OcopyRefsDatasettosameFile: H5Pset_copy_object failed");
}
- //Perform copy function.
+ // Perform copy function.
try {
H5.H5Ocopy(H5fid, "DSREF", H5fid, "CPYREFD", ocp_plist_id, HDF5Constants.H5P_DEFAULT);
}
- catch(Exception ex) {
- try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {}
+ catch (Exception ex) {
+ try {
+ H5.H5Pclose(ocp_plist_id);
+ }
+ catch (Exception exx) {
+ }
fail("testH5OcopyRefsDatasettosameFile: H5Ocopy failed");
}
- //Open the dataset that has been copied
+ // Open the dataset that has been copied
try {
did = H5.H5Dopen(H5fid, "DSREF", HDF5Constants.H5P_DEFAULT);
assertTrue("testH5OcopyRefsDatasettosameFile.H5Dopen: ", did >= 0);
}
catch (Exception e) {
- try {H5.H5Dclose(did);} catch (Exception exx) {}
+ try {
+ H5.H5Dclose(did);
+ }
+ catch (Exception exx) {
+ }
e.printStackTrace();
fail("testH5OcopyRefsDatasettosameFile: H5Dopen failed");
}
try {
- //Read the dataset object references in the read_data buffer.
- H5.H5Dread(did, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL,HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, read_data);
+ // Read the dataset object references in the read_data buffer.
+ H5.H5Dread(did, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, read_data);
System.arraycopy(read_data, 0, rbuf0, 0, 8);
System.arraycopy(read_data, 8, rbuf1, 0, 8);
- //Get the type of object the reference points to.
+ // Get the type of object the reference points to.
obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, rbuf1);
assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET);
@@ -317,22 +387,32 @@ public class TestH5OcopyOld {
ex.printStackTrace();
}
finally {
- try {H5.H5Dclose(did);} catch (Exception ex) {}
- try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(did);
+ }
+ catch (Exception ex) {
+ }
+ try {
+ H5.H5Pclose(ocp_plist_id);
+ }
+ catch (Exception ex) {
+ }
}
- }
-
+ }
+
@Test
- public void testH5OcopyNullRef() throws Throwable {
+ public void testH5OcopyNullRef() throws Throwable
+ {
final long _pid_ = HDF5Constants.H5P_DEFAULT;
- long sid = HDF5Constants.H5I_INVALID_HID;
- long did = HDF5Constants.H5I_INVALID_HID;
- long aid = HDF5Constants.H5I_INVALID_HID;
+ long sid = HDF5Constants.H5I_INVALID_HID;
+ long did = HDF5Constants.H5I_INVALID_HID;
+ long aid = HDF5Constants.H5I_INVALID_HID;
try {
sid = H5.H5Screate_simple(1, new long[] {1}, null);
assertTrue("testH5OcopyNullRef.H5Screate_simple: ", sid >= 0);
- did = H5.H5Dcreate(H5fid, "Dataset_with_null_Ref", HDF5Constants.H5T_NATIVE_INT, sid, _pid_, _pid_, _pid_);
+ did = H5.H5Dcreate(H5fid, "Dataset_with_null_Ref", HDF5Constants.H5T_NATIVE_INT, sid, _pid_,
+ _pid_, _pid_);
assertTrue("testH5OcopyNullRef.H5Dcreate: ", did > 0);
aid = H5.H5Acreate(did, "Null_Ref", HDF5Constants.H5T_STD_REF_OBJ, sid, _pid_, _pid_);
assertTrue("testH5OcopyNullRef.H5Acreate: ", aid > 0);
@@ -341,57 +421,74 @@ public class TestH5OcopyOld {
ex.printStackTrace();
}
finally {
- try {H5.H5Dclose(did);} catch (Exception exx) {}
- try {H5.H5Aclose(aid);} catch (Exception exx) {}
- try {H5.H5Sclose(sid);} catch (Exception exx) {}
+ try {
+ H5.H5Dclose(did);
+ }
+ catch (Exception exx) {
+ }
+ try {
+ H5.H5Aclose(aid);
+ }
+ catch (Exception exx) {
+ }
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception exx) {
+ }
}
long ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY);
assertTrue("testH5OcopyNullRef.H5Pcreate: ", ocp_plist_id >= 0);
H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG);
try {
- H5.H5Ocopy(H5fid, "/Dataset_with_null_Ref", H5fid, "/Dataset_with_null_Ref_cp", ocp_plist_id, _pid_);
+ H5.H5Ocopy(H5fid, "/Dataset_with_null_Ref", H5fid, "/Dataset_with_null_Ref_cp", ocp_plist_id,
+ _pid_);
}
finally {
- try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {}
+ try {
+ H5.H5Pclose(ocp_plist_id);
+ }
+ catch (Exception exx) {
+ }
}
}
-// @Ignore because of JIRA HDF5-9547
-// @Test(expected = HDF5LibraryException.class)
-// public void testH5OcopyInvalidRef() throws Throwable {
-// final long _pid_ = HDF5Constants.H5P_DEFAULT;
-// long sid = HDF5Constants.H5I_INVALID_HID;
-// long did = HDF5Constants.H5I_INVALID_HID;
-// long aid = HDF5Constants.H5I_INVALID_HID;
-//
-// try {
-// sid = H5.H5Screate_simple(1, new long[] {1}, null);
-// assertTrue("testH5OcopyInvalidRef.H5Screate_simple: ", sid >= 0);
-// did = H5.H5Dcreate(H5fid, "Dataset_with_invalid_Ref", HDF5Constants.H5T_NATIVE_INT, sid, _pid_, _pid_, _pid_);
-// assertTrue("testH5OcopyInvalidRef.H5Dcreate: ", did > 0);
-// aid = H5.H5Acreate(did, "Invalid_Ref", HDF5Constants.H5T_STD_REF_OBJ, sid, _pid_, _pid_);
-// assertTrue("testH5OcopyInvalidRef.H5Acreate: ", aid > 0);
-// H5.H5Awrite(aid, HDF5Constants.H5T_STD_REF_OBJ, new long[]{-1});
-// }
-// catch (Exception ex) {
-// ex.printStackTrace();
-// }
-// finally {
-// try {H5.H5Dclose(did);} catch (Exception exx) {}
-// try {H5.H5Aclose(aid);} catch (Exception exx) {}
-// try {H5.H5Sclose(sid);} catch (Exception exx) {}
-// }
-//
-// long ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY);
-// assertTrue("testH5OcopyInvalidRef.H5Pcreate: ", ocp_plist_id >= 0);
-// H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG);
-// try {
-// H5.H5Ocopy(H5fid, "/Dataset_with_invalid_Ref", H5fid, "/Dataset_with_invalid_Ref_cp", ocp_plist_id, _pid_);
-// }
-// finally {
-// try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {}
-// }
-// }
-
+ // @Ignore because of JIRA HDF5-9547
+ // @Test(expected = HDF5LibraryException.class)
+ // public void testH5OcopyInvalidRef() throws Throwable {
+ // final long _pid_ = HDF5Constants.H5P_DEFAULT;
+ // long sid = HDF5Constants.H5I_INVALID_HID;
+ // long did = HDF5Constants.H5I_INVALID_HID;
+ // long aid = HDF5Constants.H5I_INVALID_HID;
+ //
+ // try {
+ // sid = H5.H5Screate_simple(1, new long[] {1}, null);
+ // assertTrue("testH5OcopyInvalidRef.H5Screate_simple: ", sid >= 0);
+ // did = H5.H5Dcreate(H5fid, "Dataset_with_invalid_Ref", HDF5Constants.H5T_NATIVE_INT, sid,
+ // _pid_, _pid_, _pid_); assertTrue("testH5OcopyInvalidRef.H5Dcreate: ", did > 0); aid =
+ // H5.H5Acreate(did, "Invalid_Ref", HDF5Constants.H5T_STD_REF_OBJ, sid, _pid_, _pid_);
+ // assertTrue("testH5OcopyInvalidRef.H5Acreate: ", aid > 0);
+ // H5.H5Awrite(aid, HDF5Constants.H5T_STD_REF_OBJ, new long[]{-1});
+ // }
+ // catch (Exception ex) {
+ // ex.printStackTrace();
+ // }
+ // finally {
+ // try {H5.H5Dclose(did);} catch (Exception exx) {}
+ // try {H5.H5Aclose(aid);} catch (Exception exx) {}
+ // try {H5.H5Sclose(sid);} catch (Exception exx) {}
+ // }
+ //
+ // long ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY);
+ // assertTrue("testH5OcopyInvalidRef.H5Pcreate: ", ocp_plist_id >= 0);
+ // H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG);
+ // try {
+ // H5.H5Ocopy(H5fid, "/Dataset_with_invalid_Ref", H5fid, "/Dataset_with_invalid_Ref_cp",
+ // ocp_plist_id, _pid_);
+ // }
+ // finally {
+ // try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {}
+ // }
+ // }
}
diff --git a/java/test/TestH5Ocreate.java b/java/test/TestH5Ocreate.java
index 78ea744..096abcd 100644
--- a/java/test/TestH5Ocreate.java
+++ b/java/test/TestH5Ocreate.java
@@ -21,8 +21,8 @@ import java.util.ArrayList;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.callbacks.H5O_iterate_t;
import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t;
+import hdf.hdf5lib.callbacks.H5O_iterate_t;
import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5O_info_t;
@@ -35,21 +35,23 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Ocreate {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_EXTFILE = "h5ex_g_iterateO2.hdf";
- private static final String H5_FILE = "testO.h5";
- private static final int DIM_X = 4;
- private static final int DIM_Y = 6;
- long H5fcpl = HDF5Constants.H5I_INVALID_HID;
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5dsid = HDF5Constants.H5I_INVALID_HID;
- long H5did1 = HDF5Constants.H5I_INVALID_HID;
- long H5did2 = HDF5Constants.H5I_INVALID_HID;
- long H5gcpl = HDF5Constants.H5I_INVALID_HID;
- long H5gid = HDF5Constants.H5I_INVALID_HID;
- long[] H5dims = { DIM_X, DIM_Y };
-
- private final void _deleteFile(String filename) {
+ private static final String H5_FILE = "testO.h5";
+ private static final int DIM_X = 4;
+ private static final int DIM_Y = 6;
+ long H5fcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did1 = HDF5Constants.H5I_INVALID_HID;
+ long H5did2 = HDF5Constants.H5I_INVALID_HID;
+ long H5gcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5gid = HDF5Constants.H5I_INVALID_HID;
+ long[] H5dims = {DIM_X, DIM_Y};
+
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
@@ -62,39 +64,41 @@ public class TestH5Ocreate {
}
}
- private final long _createDataset(long fid, long dsid, String name, long dapl) {
+ private final long _createDataset(long fid, long dsid, String name, long dapl)
+ {
long did = HDF5Constants.H5I_INVALID_HID;
try {
- did = H5.H5Dcreate(fid, name,
- HDF5Constants.H5T_STD_I32BE, dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
+ did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, dapl);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Dcreate: " + err);
}
- assertTrue("TestH5O._createDataset: ",did > 0);
+ assertTrue("TestH5O._createDataset: ", did > 0);
return did;
}
- private final long _createGroup(long fid, String name) {
+ private final long _createGroup(long fid, String name)
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
try {
H5gcpl = HDF5Constants.H5P_DEFAULT;
- gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
- H5gcpl, HDF5Constants.H5P_DEFAULT);
+ gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, H5gcpl, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Gcreate: " + err);
}
- assertTrue("TestH5O._createGroup: ",gid > 0);
+ assertTrue("TestH5O._createGroup: ", gid > 0);
return gid;
}
- private final void _createHardLink(long fid, long cid, String curname, long did, String dstname, long lcpl, long lapl) {
+ private final void _createHardLink(long fid, long cid, String curname, long did, String dstname,
+ long lcpl, long lapl)
+ {
boolean link_exists = false;
try {
H5.H5Lcreate_hard(cid, curname, did, dstname, lcpl, lapl);
@@ -108,7 +112,9 @@ public class TestH5Ocreate {
assertTrue("TestH5O._createHardLink ", link_exists);
}
- private final void _createSoftLink(long fid, String curname, long did, String dstname, long lcpl, long lapl) {
+ private final void _createSoftLink(long fid, String curname, long did, String dstname, long lcpl,
+ long lapl)
+ {
boolean link_exists = false;
try {
H5.H5Lcreate_soft(curname, did, dstname, lcpl, lapl);
@@ -122,7 +128,9 @@ public class TestH5Ocreate {
assertTrue("TestH5O._createSoftLink ", link_exists);
}
- private final void _createExternalLink(long fid, String ext_filename, String curname, long did, String dstname, long lcpl, long lapl) {
+ private final void _createExternalLink(long fid, String ext_filename, String curname, long did,
+ String dstname, long lcpl, long lapl)
+ {
boolean link_exists = false;
try {
H5.H5Lcreate_external(ext_filename, curname, did, dstname, lcpl, lapl);
@@ -137,64 +145,95 @@ public class TestH5Ocreate {
}
@Before
- public void createH5file()
- throws NullPointerException, HDF5Exception {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void createH5file() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
H5fcpl = H5.H5Pcreate(HDF5Constants.H5P_FILE_CREATE);
- H5.H5Pset_link_creation_order(H5fcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED);
- H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- H5fcpl, HDF5Constants.H5P_DEFAULT);
+ H5.H5Pset_link_creation_order(H5fcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED +
+ HDF5Constants.H5P_CRT_ORDER_INDEXED);
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, H5fcpl, HDF5Constants.H5P_DEFAULT);
H5dsid = H5.H5Screate_simple(2, H5dims, null);
H5did1 = _createDataset(H5fid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT);
- H5gid = _createGroup(H5fid, "/G1");
+ H5gid = _createGroup(H5fid, "/G1");
H5did2 = _createDataset(H5gid, H5dsid, "DS2", HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("TestH5O.createH5file: " + err);
}
- assertTrue("TestH5O.createH5file: H5.H5Fcreate: ",H5fid > 0);
- assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ",H5dsid > 0);
- assertTrue("TestH5O.createH5file: H5.H5Gcreate: ",H5gid > 0);
+ assertTrue("TestH5O.createH5file: H5.H5Fcreate: ", H5fid > 0);
+ assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ", H5dsid > 0);
+ assertTrue("TestH5O.createH5file: H5.H5Gcreate: ", H5gid > 0);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5gid > 0)
- try {H5.H5Gclose(H5gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(H5gid);
+ }
+ catch (Exception ex) {
+ }
if (H5gcpl > 0)
- try {H5.H5Pclose(H5gcpl);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(H5gcpl);
+ }
+ catch (Exception ex) {
+ }
if (H5did2 > 0)
- try {H5.H5Dclose(H5did2);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did2);
+ }
+ catch (Exception ex) {
+ }
if (H5dsid > 0)
- try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid);
+ }
+ catch (Exception ex) {
+ }
if (H5did1 > 0)
- try {H5.H5Dclose(H5did1);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did1);
+ }
+ catch (Exception ex) {
+ }
if (H5fid > 0)
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
if (H5fcpl > 0)
- try {H5.H5Pclose(H5fcpl);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(H5fcpl);
+ }
+ catch (Exception ex) {
+ }
_deleteFile(H5_FILE);
System.out.println();
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Ocopy_cur_not_exists() throws Throwable {
+ public void testH5Ocopy_cur_not_exists() throws Throwable
+ {
H5.H5Ocopy(H5fid, "None", H5fid, "DS1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Ocopy() {
+ public void testH5Ocopy()
+ {
try {
H5.H5Ocopy(H5fid, "DS1", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
boolean link_exists = H5.H5Lexists(H5fid, "CPY1", HDF5Constants.H5P_DEFAULT);
- assertTrue("testH5Ocopy:H5Lexists ",link_exists);
+ assertTrue("testH5Ocopy:H5Lexists ", link_exists);
}
catch (Throwable err) {
err.printStackTrace();
@@ -203,57 +242,66 @@ public class TestH5Ocreate {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Ocopy_dst_link_exists() throws Throwable {
- _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ public void testH5Ocopy_dst_link_exists() throws Throwable
+ {
+ _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5.H5Ocopy(H5fid, "CPY1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Oget_info_by_idx_n0_create() {
+ public void testH5Oget_info_by_idx_n0_create()
+ {
H5O_info_t obj_info = null;
try {
int order = H5.H5Pget_link_creation_order(H5fcpl);
- assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED);
+ assertTrue("creation order :" + order,
+ order == HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Oget_info_by_idx_n0:H5Pget_link_creation_order " + err);
}
try {
- obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER,
+ HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Oget_info_by_idx: " + err);
}
- assertFalse("H5Oget_info_by_idx ", obj_info==null);
- assertTrue("H5Oget_info_by_idx link type", obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
+ assertFalse("H5Oget_info_by_idx ", obj_info == null);
+ assertTrue("H5Oget_info_by_idx link type", obj_info.type == HDF5Constants.H5O_TYPE_DATASET);
}
@Test
- public void testH5Oget_info_by_idx_n1_create() {
+ public void testH5Oget_info_by_idx_n1_create()
+ {
H5O_info_t obj_info = null;
try {
int order = H5.H5Pget_link_creation_order(H5fcpl);
- assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED);
+ assertTrue("creation order :" + order,
+ order == HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Oget_info_by_idx_n1:H5Pget_link_creation_order " + err);
}
try {
- obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 1, HDF5Constants.H5P_DEFAULT);
+ obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER,
+ HDF5Constants.H5_ITER_INC, 1, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Oget_info_by_idx: " + err);
}
- assertFalse("H5Oget_info_by_idx ", obj_info==null);
- assertTrue("H5Oget_info_by_idx link type", obj_info.type==HDF5Constants.H5O_TYPE_GROUP);
+ assertFalse("H5Oget_info_by_idx ", obj_info == null);
+ assertTrue("H5Oget_info_by_idx link type", obj_info.type == HDF5Constants.H5O_TYPE_GROUP);
}
@Test
- public void testH5Oget_info_softlink() {
+ public void testH5Oget_info_softlink()
+ {
H5O_info_t obj_info = null;
_createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
try {
@@ -263,21 +311,24 @@ public class TestH5Ocreate {
err.printStackTrace();
fail("H5.H5Oget_info: " + err);
}
- assertFalse("H5Oget_info", obj_info==null);
- assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
+ assertFalse("H5Oget_info", obj_info == null);
+ assertTrue("H5Oget_info link type", obj_info.type == HDF5Constants.H5O_TYPE_DATASET);
assertTrue("Link Object Token", obj_info.token != null);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_info_softlink_dangle() throws Throwable {
+ public void testH5Oget_info_softlink_dangle() throws Throwable
+ {
_createSoftLink(H5fid, "DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
H5.H5Oget_info_by_name(H5fid, "L2", HDF5Constants.H5P_DEFAULT);
}
@Test
- public void testH5Oget_info_externallink() {
+ public void testH5Oget_info_externallink()
+ {
H5O_info_t obj_info = null;
- _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
try {
obj_info = H5.H5Oget_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
}
@@ -285,18 +336,19 @@ public class TestH5Ocreate {
err.printStackTrace();
fail("H5.H5Oget_info: " + err);
}
- assertFalse("H5Oget_info", obj_info==null);
- assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE);
+ assertFalse("H5Oget_info", obj_info == null);
+ assertTrue("H5Oget_info link type", obj_info.type == HDF5Constants.H5O_TYPE_NAMED_DATATYPE);
assertTrue("Link Object Token", obj_info.token != null);
}
@Test
- public void testH5Olink() {
- long oid = HDF5Constants.H5I_INVALID_HID;
- H5O_info_t obj_info = null;
+ public void testH5Olink()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
+ H5O_info_t obj_info = null;
H5O_info_t dst_obj_info = null;
try {
- oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
obj_info = H5.H5Oget_info(oid);
}
catch (Throwable err) {
@@ -311,10 +363,14 @@ public class TestH5Ocreate {
err.printStackTrace();
fail("H5.H5Olink: " + err);
}
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
- assertFalse("H5Oget_info ", obj_info==null);
- assertTrue("H5Oget_info object type", obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
+ assertFalse("H5Oget_info ", obj_info == null);
+ assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_DATASET);
try {
dst_obj_info = H5.H5Oget_info_by_name(H5fid, "CPY1", HDF5Constants.H5P_DEFAULT);
@@ -323,29 +379,34 @@ public class TestH5Ocreate {
err.printStackTrace();
fail("H5.H5Oget_info_by_name: " + err);
}
- assertFalse("H5Oget_info ", dst_obj_info==null);
- assertTrue("H5Oget_info object type", dst_obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
+ assertFalse("H5Oget_info ", dst_obj_info == null);
+ assertTrue("H5Oget_info object type", dst_obj_info.type == HDF5Constants.H5O_TYPE_DATASET);
}
@Test
- public void testH5Ovisit_create() {
+ public void testH5Ovisit_create()
+ {
try {
int order = H5.H5Pget_link_creation_order(H5fcpl);
- assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED);
+ assertTrue("creation order :" + order,
+ order == HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Ovisit_create:H5Pget_link_creation_order " + err);
}
- _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
+ _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
_createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
class idata {
public String link_name = null;
- public int link_type = -1;
- idata(String name, int type) {
+ public int link_type = -1;
+ idata(String name, int type)
+ {
this.link_name = name;
this.link_type = type;
}
@@ -355,7 +416,8 @@ public class TestH5Ocreate {
}
H5O_iterate_opdata_t iter_data = new H5O_iter_data();
class H5O_iter_callback implements H5O_iterate_t {
- public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) {
+ public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data)
+ {
idata id = new idata(name, info.type);
((H5O_iter_data)op_data).iterdata.add(id);
return 0;
@@ -363,23 +425,34 @@ public class TestH5Ocreate {
}
H5O_iterate_t iter_cb = new H5O_iter_callback();
try {
- H5.H5Ovisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, iter_data);
+ H5.H5Ovisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb,
+ iter_data);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Ovisit: " + err);
}
assertFalse("H5Ovisit ", ((H5O_iter_data)iter_data).iterdata.isEmpty());
- assertTrue("H5Ovisit "+((H5O_iter_data)iter_data).iterdata.size(), ((H5O_iter_data)iter_data).iterdata.size()==4);
- assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(0)).link_name, ((idata)((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".")==0);
- assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(1)).link_name, ((idata)((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS1")==0);
- assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(2)).link_name, ((idata)((H5O_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1")==0);
- assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(3)).link_name, ((idata)((H5O_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1/DS2")==0);
+ assertTrue("H5Ovisit " + ((H5O_iter_data)iter_data).iterdata.size(),
+ ((H5O_iter_data)iter_data).iterdata.size() == 4);
+ assertTrue("H5Ovisit " + ((idata)((H5O_iter_data)iter_data).iterdata.get(0)).link_name,
+ ((idata)((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".") ==
+ 0);
+ assertTrue("H5Ovisit " + ((idata)((H5O_iter_data)iter_data).iterdata.get(1)).link_name,
+ ((idata)((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS1") ==
+ 0);
+ assertTrue("H5Ovisit " + ((idata)((H5O_iter_data)iter_data).iterdata.get(2)).link_name,
+ ((idata)((H5O_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1") ==
+ 0);
+ assertTrue(
+ "H5Ovisit " + ((idata)((H5O_iter_data)iter_data).iterdata.get(3)).link_name,
+ ((idata)((H5O_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1/DS2") == 0);
}
@Test
- public void testH5Ocomment() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Ocomment()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
String obj_comment = null;
try {
oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
@@ -397,14 +470,19 @@ public class TestH5Ocreate {
err.printStackTrace();
fail("H5.H5Oget_comment: " + err);
}
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
- assertFalse("H5Oget_comment: ", obj_comment==null);
- assertTrue("H5Oget_comment: ", obj_comment.compareTo("Test Comment")==0);
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
+ assertFalse("H5Oget_comment: ", obj_comment == null);
+ assertTrue("H5Oget_comment: ", obj_comment.compareTo("Test Comment") == 0);
}
@Test
- public void testH5Ocomment_clear() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Ocomment_clear()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
String obj_comment = null;
try {
oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
@@ -422,8 +500,8 @@ public class TestH5Ocreate {
err.printStackTrace();
fail("H5.H5Oget_comment: " + err);
}
- assertFalse("H5Oget_comment: ", obj_comment==null);
- assertTrue("H5Oget_comment: ", obj_comment.compareTo("Test Comment")==0);
+ assertFalse("H5Oget_comment: ", obj_comment == null);
+ assertTrue("H5Oget_comment: ", obj_comment.compareTo("Test Comment") == 0);
try {
H5.H5Oset_comment(oid, null);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
@@ -439,12 +517,17 @@ public class TestH5Ocreate {
err.printStackTrace();
fail("H5.H5Oget_comment: " + err);
}
- try {H5.H5Oclose(oid);} catch (Exception ex) {}
- assertTrue("H5Oget_comment: ", obj_comment==null);
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
+ assertTrue("H5Oget_comment: ", obj_comment == null);
}
@Test
- public void testH5Ocomment_by_name() {
+ public void testH5Ocomment_by_name()
+ {
String obj_comment = null;
try {
H5.H5Oset_comment_by_name(H5fid, "DS1", "Test Comment", HDF5Constants.H5P_DEFAULT);
@@ -461,12 +544,13 @@ public class TestH5Ocreate {
err.printStackTrace();
fail("H5.H5Oget_comment_by_name: " + err);
}
- assertFalse("H5Oget_comment_by_name: ", obj_comment==null);
- assertTrue("H5Oget_comment_by_name: ", obj_comment.compareTo("Test Comment")==0);
+ assertFalse("H5Oget_comment_by_name: ", obj_comment == null);
+ assertTrue("H5Oget_comment_by_name: ", obj_comment.compareTo("Test Comment") == 0);
}
@Test
- public void testH5Ocomment_by_name_clear() {
+ public void testH5Ocomment_by_name_clear()
+ {
String obj_comment = null;
try {
H5.H5Oset_comment_by_name(H5fid, "DS1", "Test Comment", HDF5Constants.H5P_DEFAULT);
@@ -483,8 +567,8 @@ public class TestH5Ocreate {
err.printStackTrace();
fail("H5.H5Oget_comment_by_name: " + err);
}
- assertFalse("H5Oget_comment_by_name: ", obj_comment==null);
- assertTrue("H5Oget_comment_by_name: ", obj_comment.compareTo("Test Comment")==0);
+ assertFalse("H5Oget_comment_by_name: ", obj_comment == null);
+ assertTrue("H5Oget_comment_by_name: ", obj_comment.compareTo("Test Comment") == 0);
try {
H5.H5Oset_comment_by_name(H5fid, "DS1", null, HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
@@ -500,19 +584,20 @@ public class TestH5Ocreate {
err.printStackTrace();
fail("H5.H5Oget_comment_by_name: " + err);
}
- assertTrue("H5Oget_comment_by_name: ", obj_comment==null);
+ assertTrue("H5Oget_comment_by_name: ", obj_comment == null);
}
@Test
- public void testH5Oinc_dec_count() {
- long oid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Oinc_dec_count()
+ {
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
try {
- oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
+ oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
obj_info = H5.H5Oget_info(oid);
- assertFalse("testH5Oinc_dec_count: H5Oget_info ",obj_info==null);
- assertTrue("testH5Oinc_dec_count: H5Oget_info reference count",obj_info.rc==1);
+ assertFalse("testH5Oinc_dec_count: H5Oget_info ", obj_info == null);
+ assertTrue("testH5Oinc_dec_count: H5Oget_info reference count", obj_info.rc == 1);
}
catch (Throwable err) {
err.printStackTrace();
@@ -527,8 +612,8 @@ public class TestH5Ocreate {
}
try {
obj_info = H5.H5Oget_info(oid);
- assertFalse("testH5Oinc_dec_count: H5Oget_info ",obj_info==null);
- assertTrue("testH5Oinc_dec_count: H5Oget_info reference count",obj_info.rc==2);
+ assertFalse("testH5Oinc_dec_count: H5Oget_info ", obj_info == null);
+ assertTrue("testH5Oinc_dec_count: H5Oget_info reference count", obj_info.rc == 2);
}
catch (Throwable err) {
err.printStackTrace();
@@ -543,8 +628,8 @@ public class TestH5Ocreate {
}
try {
obj_info = H5.H5Oget_info(oid);
- assertFalse("testH5Oinc_dec_count: H5Oget_info ",obj_info==null);
- assertTrue("testH5Oinc_dec_count: H5Oget_info reference count",obj_info.rc==1);
+ assertFalse("testH5Oinc_dec_count: H5Oget_info ", obj_info == null);
+ assertTrue("testH5Oinc_dec_count: H5Oget_info reference count", obj_info.rc == 1);
}
catch (Throwable err) {
err.printStackTrace();
@@ -552,12 +637,17 @@ public class TestH5Ocreate {
}
}
finally {
- try{H5.H5Oclose(oid);} catch (Exception ex) {}
+ try {
+ H5.H5Oclose(oid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Ocork() {
+ public void testH5Ocork()
+ {
boolean corked = false;
// Check cork status of the group: not corked
@@ -608,5 +698,4 @@ public class TestH5Ocreate {
}
assertFalse("H5Oare_mdc_flushes_disabled: ", corked);
}
-
}
diff --git a/java/test/TestH5Oparams.java b/java/test/TestH5Oparams.java
index 5cbabe1..280e9fd 100644
--- a/java/test/TestH5Oparams.java
+++ b/java/test/TestH5Oparams.java
@@ -13,6 +13,7 @@
package test;
import static org.junit.Assert.assertTrue;
+
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
@@ -25,177 +26,211 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Oparams {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
@Before
- public void checkOpenIDs() {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void checkOpenIDs()
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
}
@After
- public void nextTestName() {
+ public void nextTestName()
+ {
System.out.println();
}
- @Test//(expected = HDF5LibraryException.class)
- public void testH5Oclose_invalid() throws Throwable {
+ @Test //(expected = HDF5LibraryException.class)
+ public void testH5Oclose_invalid() throws Throwable
+ {
long oid = H5.H5Oclose(-1);
assertTrue(oid == 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Oopen_null() throws Throwable {
+ public void testH5Oopen_null() throws Throwable
+ {
H5.H5Oopen(-1, null, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oopen_invalid() throws Throwable {
+ public void testH5Oopen_invalid() throws Throwable
+ {
H5.H5Oopen(-1, "Bogus", 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Ocopy_invalid() throws Throwable {
+ public void testH5Ocopy_invalid() throws Throwable
+ {
H5.H5Ocopy(-1, "Bogus", -1, "Bogus", -1, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Ocopy_null_current() throws Throwable {
+ public void testH5Ocopy_null_current() throws Throwable
+ {
H5.H5Ocopy(-1, null, 0, "Bogus", 0, 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Ocopy_null_dest() throws Throwable {
+ public void testH5Ocopy_null_dest() throws Throwable
+ {
H5.H5Ocopy(-1, "Bogus", 0, null, 0, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_info_invalid() throws Throwable {
+ public void testH5Oget_info_invalid() throws Throwable
+ {
H5.H5Oget_info(-1, 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Oget_info_by_name_null() throws Throwable {
+ public void testH5Oget_info_by_name_null() throws Throwable
+ {
H5.H5Oget_info_by_name(-1, null, 0, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_info_by_name_invalid() throws Throwable {
+ public void testH5Oget_info_by_name_invalid() throws Throwable
+ {
H5.H5Oget_info_by_name(-1, "/testH5Gcreate", 0, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_info_by_idx_invalid() throws Throwable {
+ public void testH5Oget_info_by_idx_invalid() throws Throwable
+ {
H5.H5Oget_info_by_idx(-1, "Bogus", -1, -1, -1L, 0, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Oget_info_by_idx_null() throws Throwable {
+ public void testH5Oget_info_by_idx_null() throws Throwable
+ {
H5.H5Oget_info_by_idx(-1, null, 0, 0, 0L, 0, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_native_info_invalid() throws Throwable {
+ public void testH5Oget_native_info_invalid() throws Throwable
+ {
H5.H5Oget_native_info(-1, 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Oget_native_info_by_name_null() throws Throwable {
+ public void testH5Oget_native_info_by_name_null() throws Throwable
+ {
H5.H5Oget_native_info_by_name(-1, null, 0, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_native_info_by_name_invalid() throws Throwable {
+ public void testH5Oget_native_info_by_name_invalid() throws Throwable
+ {
H5.H5Oget_native_info_by_name(-1, "/testH5Gcreate", 0, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_native_info_by_idx_invalid() throws Throwable {
+ public void testH5Oget_native_info_by_idx_invalid() throws Throwable
+ {
H5.H5Oget_native_info_by_idx(-1, "Bogus", -1, -1, -1L, 0, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Oget_native_info_by_idx_null() throws Throwable {
+ public void testH5Oget_native_info_by_idx_null() throws Throwable
+ {
H5.H5Oget_native_info_by_idx(-1, null, 0, 0, 0L, 0, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Olink_invalid() throws Throwable {
+ public void testH5Olink_invalid() throws Throwable
+ {
H5.H5Olink(-1, -1, "Bogus", -1, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Olink_null_dest() throws Throwable {
+ public void testH5Olink_null_dest() throws Throwable
+ {
H5.H5Olink(-1, 0, null, 0, 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Ovisit_null() throws Throwable {
+ public void testH5Ovisit_null() throws Throwable
+ {
H5.H5Ovisit(-1, -1, -1, null, null, 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Ovisit_by_name_nullname() throws Throwable {
+ public void testH5Ovisit_by_name_nullname() throws Throwable
+ {
H5.H5Ovisit_by_name(-1, null, -1, -1, null, null, 0, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Ovisit_by_name_null() throws Throwable {
+ public void testH5Ovisit_by_name_null() throws Throwable
+ {
H5.H5Ovisit_by_name(-1, "Bogus", -1, -1, null, null, 0, -1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oset_comment_invalid() throws Throwable {
+ public void testH5Oset_comment_invalid() throws Throwable
+ {
H5.H5Oset_comment(-1, "Bogus");
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_comment_invalid() throws Throwable {
+ public void testH5Oget_comment_invalid() throws Throwable
+ {
H5.H5Oget_comment(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oset_comment_by_name_invalid() throws Throwable {
+ public void testH5Oset_comment_by_name_invalid() throws Throwable
+ {
H5.H5Oset_comment_by_name(-1, "Bogus", null, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Oset_comment_by_name_null() throws Throwable {
+ public void testH5Oset_comment_by_name_null() throws Throwable
+ {
H5.H5Oset_comment_by_name(-1, null, null, -1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oget_comment_by_name_invalid() throws Throwable {
+ public void testH5Oget_comment_by_name_invalid() throws Throwable
+ {
H5.H5Oget_comment_by_name(-1, "Bogus", -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Oget_comment_by_name_null() throws Throwable {
+ public void testH5Oget_comment_by_name_null() throws Throwable
+ {
H5.H5Oget_comment_by_name(-1, null, -1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oflush_invalid() throws Throwable {
+ public void testH5Oflush_invalid() throws Throwable
+ {
H5.H5Oflush(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Orefresh_invalid() throws Throwable {
+ public void testH5Orefresh_invalid() throws Throwable
+ {
H5.H5Orefresh(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Odisable_mdc_flushes() throws Throwable {
+ public void testH5Odisable_mdc_flushes() throws Throwable
+ {
H5.H5Odisable_mdc_flushes(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oenable_mdc_flushes() throws Throwable {
+ public void testH5Oenable_mdc_flushes() throws Throwable
+ {
H5.H5Oenable_mdc_flushes(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Oare_mdc_flushes_disabled() throws Throwable {
+ public void testH5Oare_mdc_flushes_disabled() throws Throwable
+ {
H5.H5Oare_mdc_flushes_disabled(-1);
}
-
}
diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java
index 6ae93d9..0571e3f 100644
--- a/java/test/TestH5P.java
+++ b/java/test/TestH5P.java
@@ -34,40 +34,47 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5P {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_FILE = "testP.h5";
- private static final int DIM_X = 4;
- private static final int DIM_Y = 6;
- long[] H5dims = { DIM_X, DIM_Y };
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5dsid = HDF5Constants.H5I_INVALID_HID;
- long H5did = HDF5Constants.H5I_INVALID_HID;
- long lapl_id = HDF5Constants.H5I_INVALID_HID;
- long fapl_id = HDF5Constants.H5I_INVALID_HID;
- long fcpl_id = HDF5Constants.H5I_INVALID_HID;
- long ocpl_id = HDF5Constants.H5I_INVALID_HID;
- long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
- long lcpl_id = HDF5Constants.H5I_INVALID_HID;
- long plapl_id = HDF5Constants.H5I_INVALID_HID;
- long plist_id = HDF5Constants.H5I_INVALID_HID;
- long gapl_id = HDF5Constants.H5I_INVALID_HID;
- long gcpl_id = HDF5Constants.H5I_INVALID_HID;
- long acpl_id = HDF5Constants.H5I_INVALID_HID;
-
- private final void _deleteFile(String filename) {
+ private static final int DIM_X = 4;
+ private static final int DIM_Y = 6;
+ long[] H5dims = {DIM_X, DIM_Y};
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long lapl_id = HDF5Constants.H5I_INVALID_HID;
+ long fapl_id = HDF5Constants.H5I_INVALID_HID;
+ long fcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long ocpl_id = HDF5Constants.H5I_INVALID_HID;
+ long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
+ long lcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long plapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
+ long gapl_id = HDF5Constants.H5I_INVALID_HID;
+ long gcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long acpl_id = HDF5Constants.H5I_INVALID_HID;
+
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
- private final long _createDataset(long fid, long dsid, String name, long dapl) {
+ private final long _createDataset(long fid, long dsid, String name, long dapl)
+ {
long did = HDF5Constants.H5I_INVALID_HID;
try {
- did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
+ did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, dapl);
}
catch (Throwable err) {
err.printStackTrace();
@@ -78,12 +85,12 @@ public class TestH5P {
return did;
}
- private final void _createH5File(long fcpl, long fapl) {
+ private final void _createH5File(long fcpl, long fapl)
+ {
try {
- H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- fcpl, fapl);
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, fcpl, fapl);
H5dsid = H5.H5Screate_simple(2, H5dims, null);
- H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
+ H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -101,28 +108,26 @@ public class TestH5P {
}
}
- public void deleteH5file() throws HDF5LibraryException {
- _deleteFile(H5_FILE);
- }
+ public void deleteH5file() throws HDF5LibraryException { _deleteFile(H5_FILE); }
@Before
- public void createH5fileProperties()
- throws NullPointerException, HDF5Exception {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void createH5fileProperties() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
- lapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS);
- fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS);
- fcpl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_CREATE);
- ocpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE);
+ lapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS);
+ fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS);
+ fcpl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_CREATE);
+ ocpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE);
ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY);
- lcpl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_CREATE);
- plapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS);
- plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER);
- gapl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_ACCESS);
- gcpl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE);
- acpl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_CREATE);
+ lcpl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_CREATE);
+ plapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS);
+ plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER);
+ gapl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_ACCESS);
+ gcpl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE);
+ acpl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_CREATE);
}
catch (Throwable err) {
err.printStackTrace();
@@ -134,51 +139,109 @@ public class TestH5P {
assertTrue(ocpl_id > 0);
assertTrue(ocp_plist_id > 0);
assertTrue(lcpl_id > 0);
- assertTrue(plapl_id>0);
+ assertTrue(plapl_id > 0);
assertTrue(plist_id > 0);
assertTrue(gapl_id > 0);
- assertTrue(gcpl_id >0);
- assertTrue(acpl_id >0);
+ assertTrue(gcpl_id > 0);
+ assertTrue(acpl_id > 0);
}
@After
- public void deleteH5fileProperties() throws HDF5LibraryException {
- if (lapl_id >0)
- try {H5.H5Pclose(lapl_id);} catch (Exception ex) {}
- if (fapl_id >0)
- try {H5.H5Pclose(fapl_id);} catch (Exception ex) {}
- if (fcpl_id >0)
- try {H5.H5Pclose(fcpl_id);} catch (Exception ex) {}
- if (ocpl_id >0)
- try {H5.H5Pclose(ocpl_id);} catch (Exception ex) {}
- if (ocp_plist_id >0)
- try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {}
- if (lcpl_id >0)
- try {H5.H5Pclose(lcpl_id);} catch (Exception ex) {}
- if (plapl_id >0)
- try {H5.H5Pclose(plapl_id);} catch (Exception ex) {}
- if (plist_id >0)
- try {H5.H5Pclose(plist_id);} catch (Exception ex) {}
- if (gapl_id >0)
- try {H5.H5Pclose(gapl_id);} catch (Exception ex) {}
- if (gcpl_id >0)
- try {H5.H5Pclose(gcpl_id);} catch (Exception ex) {}
- if (acpl_id >0)
- try {H5.H5Pclose(acpl_id);} catch (Exception ex) {}
+ public void deleteH5fileProperties() throws HDF5LibraryException
+ {
+ if (lapl_id > 0)
+ try {
+ H5.H5Pclose(lapl_id);
+ }
+ catch (Exception ex) {
+ }
+ if (fapl_id > 0)
+ try {
+ H5.H5Pclose(fapl_id);
+ }
+ catch (Exception ex) {
+ }
+ if (fcpl_id > 0)
+ try {
+ H5.H5Pclose(fcpl_id);
+ }
+ catch (Exception ex) {
+ }
+ if (ocpl_id > 0)
+ try {
+ H5.H5Pclose(ocpl_id);
+ }
+ catch (Exception ex) {
+ }
+ if (ocp_plist_id > 0)
+ try {
+ H5.H5Pclose(ocp_plist_id);
+ }
+ catch (Exception ex) {
+ }
+ if (lcpl_id > 0)
+ try {
+ H5.H5Pclose(lcpl_id);
+ }
+ catch (Exception ex) {
+ }
+ if (plapl_id > 0)
+ try {
+ H5.H5Pclose(plapl_id);
+ }
+ catch (Exception ex) {
+ }
+ if (plist_id > 0)
+ try {
+ H5.H5Pclose(plist_id);
+ }
+ catch (Exception ex) {
+ }
+ if (gapl_id > 0)
+ try {
+ H5.H5Pclose(gapl_id);
+ }
+ catch (Exception ex) {
+ }
+ if (gcpl_id > 0)
+ try {
+ H5.H5Pclose(gcpl_id);
+ }
+ catch (Exception ex) {
+ }
+ if (acpl_id > 0)
+ try {
+ H5.H5Pclose(acpl_id);
+ }
+ catch (Exception ex) {
+ }
if (H5dsid > 0)
- try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid);
+ }
+ 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) {
+ }
System.out.println();
}
@Test
- public void testH5Pget_nlinks() {
+ public void testH5Pget_nlinks()
+ {
long nlinks = -1;
try {
- nlinks = (long) H5.H5Pget_nlinks(lapl_id);
+ nlinks = (long)H5.H5Pget_nlinks(lapl_id);
}
catch (Throwable err) {
err.printStackTrace();
@@ -190,12 +253,13 @@ public class TestH5P {
}
@Test
- public void testH5Pset_nlinks() {
+ public void testH5Pset_nlinks()
+ {
long nlinks = 20;
int ret_val = -1;
try {
ret_val = H5.H5Pset_nlinks(lapl_id, nlinks);
- nlinks = (long) H5.H5Pget_nlinks(lapl_id);
+ nlinks = (long)H5.H5Pget_nlinks(lapl_id);
}
catch (Throwable err) {
err.printStackTrace();
@@ -207,17 +271,22 @@ public class TestH5P {
}
@Test(expected = HDF5FunctionArgumentException.class)
- public void testH5Pset_libver_bounds_invalidlow() throws Throwable {
- H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST+1, HDF5Constants.H5F_LIBVER_LATEST);
+ public void testH5Pset_libver_bounds_invalidlow() throws Throwable
+ {
+ H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST + 1,
+ HDF5Constants.H5F_LIBVER_LATEST);
}
@Test(expected = HDF5FunctionArgumentException.class)
- public void testH5Pset_libver_bounds_invalidhigh() throws Throwable {
- H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST+1);
+ public void testH5Pset_libver_bounds_invalidhigh() throws Throwable
+ {
+ H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST,
+ HDF5Constants.H5F_LIBVER_LATEST + 1);
}
@Test
- public void testH5Pget_link_creation_order() {
+ public void testH5Pget_link_creation_order()
+ {
int crt_order_flags = 0;
try {
crt_order_flags = H5.H5Pget_link_creation_order(fcpl_id);
@@ -230,47 +299,51 @@ public class TestH5P {
}
@Test
- public void testH5Pset_link_creation_order_trackedPLUSindexed() {
- int ret_val = -1;
+ public void testH5Pset_link_creation_order_trackedPLUSindexed()
+ {
+ int ret_val = -1;
int crt_order_flags = HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED;
- int crtorderflags = 0;
+ int crtorderflags = 0;
try {
- ret_val = H5.H5Pset_link_creation_order(fcpl_id, crt_order_flags);
+ ret_val = H5.H5Pset_link_creation_order(fcpl_id, crt_order_flags);
crtorderflags = H5.H5Pget_link_creation_order(fcpl_id);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5Pset_link_creation_order: " + err);
}
- assertTrue("testH5Pset_link_creation_order_trackedPLUSindexed",ret_val >= 0);
+ assertTrue("testH5Pset_link_creation_order_trackedPLUSindexed", ret_val >= 0);
assertEquals(crt_order_flags, crtorderflags);
}
@Test
- public void testH5Pset_link_creation_order_tracked() {
- int ret_val = -1;
+ public void testH5Pset_link_creation_order_tracked()
+ {
+ int ret_val = -1;
int crtorderflags = 0;
try {
- ret_val = H5.H5Pset_link_creation_order(fcpl_id, HDF5Constants.H5P_CRT_ORDER_TRACKED);
+ ret_val = H5.H5Pset_link_creation_order(fcpl_id, HDF5Constants.H5P_CRT_ORDER_TRACKED);
crtorderflags = H5.H5Pget_link_creation_order(fcpl_id);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5Pset_link_creation_order: " + err);
}
- assertTrue("testH5Pset_link_creation_order_tracked",ret_val >= 0);
+ assertTrue("testH5Pset_link_creation_order_tracked", ret_val >= 0);
assertEquals(HDF5Constants.H5P_CRT_ORDER_TRACKED, crtorderflags);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Pset_link_creation_order_invalidvalue() throws Throwable {
+ public void testH5Pset_link_creation_order_invalidvalue() throws Throwable
+ {
H5.H5Pset_link_creation_order(fcpl_id, HDF5Constants.H5P_CRT_ORDER_INDEXED);
}
@Test
- public void testH5Pget_attr_creation_order() {
+ public void testH5Pget_attr_creation_order()
+ {
int crt_order_flags = 0;
try {
@@ -284,13 +357,14 @@ public class TestH5P {
}
@Test
- public void testH5Pset_attr_creation_order_trackedPLUSindexed() {
- int ret_val = -1;
+ public void testH5Pset_attr_creation_order_trackedPLUSindexed()
+ {
+ int ret_val = -1;
int crt_order_flags = HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED;
- int crtorderflags = 0;
+ int crtorderflags = 0;
try {
- ret_val = H5.H5Pset_attr_creation_order(ocpl_id, crt_order_flags);
+ ret_val = H5.H5Pset_attr_creation_order(ocpl_id, crt_order_flags);
crtorderflags = H5.H5Pget_attr_creation_order(ocpl_id);
}
catch (Throwable err) {
@@ -302,12 +376,13 @@ public class TestH5P {
}
@Test
- public void testH5Pset_attr_creation_order_tracked() {
- int ret_val = -1;
+ public void testH5Pset_attr_creation_order_tracked()
+ {
+ int ret_val = -1;
int crtorderflags = 0;
try {
- ret_val = H5.H5Pset_attr_creation_order(ocpl_id, HDF5Constants.H5P_CRT_ORDER_TRACKED);
+ ret_val = H5.H5Pset_attr_creation_order(ocpl_id, HDF5Constants.H5P_CRT_ORDER_TRACKED);
crtorderflags = H5.H5Pget_attr_creation_order(ocpl_id);
}
catch (Throwable err) {
@@ -319,12 +394,14 @@ public class TestH5P {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Pset_attr_creation_order_invalidvalue() throws Throwable {
+ public void testH5Pset_attr_creation_order_invalidvalue() throws Throwable
+ {
H5.H5Pset_attr_creation_order(ocpl_id, HDF5Constants.H5P_CRT_ORDER_INDEXED);
}
@Test
- public void testH5Pset_copy_object() {
+ public void testH5Pset_copy_object()
+ {
int cpy_option = -1;
@@ -350,12 +427,14 @@ public class TestH5P {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Pset_copy_object_invalidobject() throws Throwable {
+ public void testH5Pset_copy_object_invalidobject() throws Throwable
+ {
H5.H5Pset_copy_object(HDF5Constants.H5P_DEFAULT, HDF5Constants.H5O_COPY_SHALLOW_HIERARCHY_FLAG);
}
@Test
- public void testH5Pset_create_intermediate_group() {
+ public void testH5Pset_create_intermediate_group()
+ {
int ret_val = -1;
try {
@@ -365,16 +444,18 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pset_create_intermediate_group: " + err);
}
- assertTrue(ret_val>=0);
+ assertTrue(ret_val >= 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Pset_create_intermediate_group_invalidobject() throws Throwable {
+ public void testH5Pset_create_intermediate_group_invalidobject() throws Throwable
+ {
H5.H5Pset_create_intermediate_group(ocp_plist_id, true);
}
@Test
- public void testH5Pget_create_intermediate_group() {
+ public void testH5Pget_create_intermediate_group()
+ {
boolean flag = false;
try {
H5.H5Pset_create_intermediate_group(lcpl_id, true);
@@ -388,7 +469,8 @@ public class TestH5P {
}
@Test
- public void testH5Pget_create_intermediate_group_notcreated() {
+ public void testH5Pget_create_intermediate_group_notcreated()
+ {
boolean flag = true;
try {
flag = H5.H5Pget_create_intermediate_group(lcpl_id);
@@ -401,43 +483,48 @@ public class TestH5P {
}
@Test
- public void testH5Pset_data_transform() {
+ public void testH5Pset_data_transform()
+ {
String expression = "(5/9.0)*(x-32)";
- int ret_val = -1;
+ int ret_val = -1;
try {
- ret_val= H5.H5Pset_data_transform(plist_id, expression);
+ ret_val = H5.H5Pset_data_transform(plist_id, expression);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5Pset_data_transform: " + err);
}
- assertTrue(ret_val>=0);
+ assertTrue(ret_val >= 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Pset_data_transform_NullExpression() throws Throwable {
+ public void testH5Pset_data_transform_NullExpression() throws Throwable
+ {
H5.H5Pset_data_transform(plist_id, null);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Pset_data_transform_InvalidExpression1() throws Throwable {
+ public void testH5Pset_data_transform_InvalidExpression1() throws Throwable
+ {
H5.H5Pset_data_transform(plist_id, "");
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Pset_data_transform_InvalidExpression2() throws Throwable {
+ public void testH5Pset_data_transform_InvalidExpression2() throws Throwable
+ {
H5.H5Pset_data_transform(plist_id, "hello");
}
@Test
- public void testH5Pget_data_transform() {
+ public void testH5Pget_data_transform()
+ {
String expression = "(5/9.0)*(x-32)";
- String [] express = {""};
+ String[] express = {""};
long express_size = 0;
- long size = 20;
+ long size = 20;
try {
H5.H5Pset_data_transform(plist_id, expression);
@@ -447,25 +534,28 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_data_transform: " + err);
}
- assertTrue(express_size>=0);
+ assertTrue(express_size >= 0);
assertTrue("The data transform expression: ", expression.equals(express[0]));
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Pget_data_transform_ExpressionNotSet() throws Throwable {
- String [] express = {""};
+ public void testH5Pget_data_transform_ExpressionNotSet() throws Throwable
+ {
+ String[] express = {""};
H5.H5Pget_data_transform(plist_id, express, 20);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Pget_data_transform_IllegalSize() throws Throwable {
- String [] express = {""};
+ public void testH5Pget_data_transform_IllegalSize() throws Throwable
+ {
+ String[] express = {""};
H5.H5Pset_data_transform(plist_id, "(5/9.0)*(x-32)");
H5.H5Pget_data_transform(plist_id, express, 0);
}
@Test
- public void testH5Pget_elink_acc_flags() {
+ public void testH5Pget_elink_acc_flags()
+ {
int get_flags = -1;
try {
@@ -480,12 +570,13 @@ public class TestH5P {
}
@Test
- public void testH5Pset_elink_acc_flags() {
+ public void testH5Pset_elink_acc_flags()
+ {
int get_flags = -1;
- int ret_val = -1;
+ int ret_val = -1;
try {
- ret_val = H5.H5Pset_elink_acc_flags(lapl_id, HDF5Constants.H5F_ACC_RDWR);
+ ret_val = H5.H5Pset_elink_acc_flags(lapl_id, HDF5Constants.H5F_ACC_RDWR);
get_flags = H5.H5Pget_elink_acc_flags(lapl_id);
}
catch (Throwable err) {
@@ -497,21 +588,24 @@ public class TestH5P {
}
@Test(expected = HDF5FunctionArgumentException.class)
- public void testH5Pset_elink_acc_flags_InvalidFlag1() throws Throwable {
+ public void testH5Pset_elink_acc_flags_InvalidFlag1() throws Throwable
+ {
H5.H5Pset_elink_acc_flags(lapl_id, HDF5Constants.H5F_ACC_TRUNC);
}
@Test(expected = HDF5FunctionArgumentException.class)
- public void testH5Pset_elink_acc_flags_InvalidFlag2() throws Throwable {
+ public void testH5Pset_elink_acc_flags_InvalidFlag2() throws Throwable
+ {
H5.H5Pset_elink_acc_flags(lapl_id, -1);
}
@Test
- public void testH5Pset_link_phase_change() {
+ public void testH5Pset_link_phase_change()
+ {
int ret_val = -1;
try {
- ret_val = H5.H5Pset_link_phase_change(fcpl_id , 2, 2);
+ ret_val = H5.H5Pset_link_phase_change(fcpl_id, 2, 2);
}
catch (Throwable err) {
err.printStackTrace();
@@ -521,17 +615,20 @@ public class TestH5P {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Pset_link_phase_change_Highmax_Compact() throws Throwable {
- H5.H5Pset_link_phase_change(fcpl_id , 70000000, 3);
+ public void testH5Pset_link_phase_change_Highmax_Compact() throws Throwable
+ {
+ H5.H5Pset_link_phase_change(fcpl_id, 70000000, 3);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Pset_link_phase_change_max_compactLESSTHANmin_dense() throws Throwable {
- H5.H5Pset_link_phase_change(fcpl_id , 5, 6);
+ public void testH5Pset_link_phase_change_max_compactLESSTHANmin_dense() throws Throwable
+ {
+ H5.H5Pset_link_phase_change(fcpl_id, 5, 6);
}
@Test
- public void testH5Pget_link_phase_change() {
+ public void testH5Pget_link_phase_change()
+ {
int ret_val = -1;
int[] links = new int[2];
@@ -548,10 +645,11 @@ public class TestH5P {
}
@Test
- public void testH5Pget_link_phase_change_EqualsSet() {
+ public void testH5Pget_link_phase_change_EqualsSet()
+ {
int[] links = new int[2];
try {
- H5.H5Pset_link_phase_change(fcpl_id , 10, 7);
+ H5.H5Pset_link_phase_change(fcpl_id, 10, 7);
H5.H5Pget_link_phase_change(fcpl_id, links);
}
catch (Throwable err) {
@@ -563,13 +661,15 @@ public class TestH5P {
}
@Test(expected = NullPointerException.class)
- public void testH5Pget_link_phase_change_Null() throws Throwable {
+ public void testH5Pget_link_phase_change_Null() throws Throwable
+ {
H5.H5Pget_link_phase_change(fcpl_id, null);
}
@Test
- public void testH5Pget_attr_phase_change() {
- int ret_val = -1;
+ public void testH5Pget_attr_phase_change()
+ {
+ int ret_val = -1;
int[] attributes = new int[2];
try {
@@ -580,7 +680,8 @@ public class TestH5P {
fail("H5Pget_attr_phase_change: " + err);
}
assertTrue("testH5Pget_attr_phase_change", ret_val >= 0);
- assertEquals("Default value of the max. no. of attributes stored in compact storage", 8, attributes[0]);
+ assertEquals("Default value of the max. no. of attributes stored in compact storage", 8,
+ attributes[0]);
assertEquals("Default value of the min. no. of attributes stored in dense storage", 6, attributes[1]);
try {
H5.H5Pset_attr_phase_change(ocpl_id, 9, 5);
@@ -597,14 +698,16 @@ public class TestH5P {
fail("H5Pget_attr_phase_change: " + err);
}
assertTrue("testH5Pget_attr_phase_change", ret_val >= 0);
- assertEquals("Default value of the max. no. of attributes stored in compact storage", 9, attributes[0]);
+ assertEquals("Default value of the max. no. of attributes stored in compact storage", 9,
+ attributes[0]);
assertEquals("Default value of the min. no. of attributes stored in dense storage", 5, attributes[1]);
}
@Test
- public void testH5Pget_shared_mesg_phase_change() {
+ public void testH5Pget_shared_mesg_phase_change()
+ {
int ret_val = -1;
- int[] size = new int[2];
+ int[] size = new int[2];
try {
ret_val = H5.H5Pget_shared_mesg_phase_change(fcpl_id, size);
@@ -617,11 +720,12 @@ public class TestH5P {
}
@Test
- public void testH5Pget_shared_mesg_phase_change_EqualsSET() {
+ public void testH5Pget_shared_mesg_phase_change_EqualsSET()
+ {
int[] size = new int[2];
try {
- H5.H5Pset_shared_mesg_phase_change(fcpl_id,50, 40);
+ H5.H5Pset_shared_mesg_phase_change(fcpl_id, 50, 40);
H5.H5Pget_shared_mesg_phase_change(fcpl_id, size);
}
catch (Throwable err) {
@@ -633,11 +737,12 @@ public class TestH5P {
}
@Test
- public void testH5Pset_shared_mesg_phase_change() {
+ public void testH5Pset_shared_mesg_phase_change()
+ {
int ret_val = -1;
try {
- ret_val = H5.H5Pset_shared_mesg_phase_change(fcpl_id,2, 1);
+ ret_val = H5.H5Pset_shared_mesg_phase_change(fcpl_id, 2, 1);
}
catch (Throwable err) {
err.printStackTrace();
@@ -647,22 +752,26 @@ public class TestH5P {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5PH5Pset_shared_mesg_phase_change_HighMaxlistValue() throws Throwable {
+ public void testH5PH5Pset_shared_mesg_phase_change_HighMaxlistValue() throws Throwable
+ {
H5.H5Pset_shared_mesg_phase_change(fcpl_id, 5001, 4000);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5PH5Pset_shared_mesg_phase_change_HighMinbtreeValue() throws Throwable {
+ public void testH5PH5Pset_shared_mesg_phase_change_HighMinbtreeValue() throws Throwable
+ {
H5.H5Pset_shared_mesg_phase_change(fcpl_id, 5000, 5001);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5PH5Pset_shared_mesg_phase_change_MinbtreeGreaterThanMaxlist() throws Throwable {
- H5.H5Pset_link_phase_change(fcpl_id , 3, 7);
+ public void testH5PH5Pset_shared_mesg_phase_change_MinbtreeGreaterThanMaxlist() throws Throwable
+ {
+ H5.H5Pset_link_phase_change(fcpl_id, 3, 7);
}
@Test
- public void testH5Pget_shared_mesg_nindexes() {
+ public void testH5Pget_shared_mesg_nindexes()
+ {
int nindexes = -1;
try {
@@ -676,12 +785,13 @@ public class TestH5P {
}
@Test
- public void testH5Pset_shared_mesg_nindexes() {
+ public void testH5Pset_shared_mesg_nindexes()
+ {
int nindexes = -1;
- int ret_val = -1;
+ int ret_val = -1;
try {
- ret_val = H5.H5Pset_shared_mesg_nindexes(fcpl_id, 7);
+ ret_val = H5.H5Pset_shared_mesg_nindexes(fcpl_id, 7);
nindexes = H5.H5Pget_shared_mesg_nindexes(fcpl_id);
}
catch (Throwable err) {
@@ -689,21 +799,23 @@ public class TestH5P {
fail("H5Pset_shared_mesg_nindexes: " + err);
}
assertTrue("H5Pset_shared_mesg_nindexes", ret_val >= 0);
- assertEquals("Value of nindexes is equal to value set",7 ,nindexes);
+ assertEquals("Value of nindexes is equal to value set", 7, nindexes);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Pset_shared_mesg_nindexes_InvalidHIGHnindexes()throws Throwable {
+ public void testH5Pset_shared_mesg_nindexes_InvalidHIGHnindexes() throws Throwable
+ {
H5.H5Pset_shared_mesg_nindexes(fcpl_id, 9);
}
@Test
- public void testH5Pset_shared_mesg_index() {
+ public void testH5Pset_shared_mesg_index()
+ {
int ret_val = -1;
try {
H5.H5Pset_shared_mesg_nindexes(fcpl_id, 2);
- ret_val = H5.H5Pset_shared_mesg_index(fcpl_id, 0,HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10);
+ ret_val = H5.H5Pset_shared_mesg_index(fcpl_id, 0, HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10);
}
catch (Throwable err) {
err.printStackTrace();
@@ -713,24 +825,27 @@ public class TestH5P {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Pset_shared_mesg_index_Invalid_indexnum() throws Throwable {
- H5.H5Pset_shared_mesg_index(fcpl_id, 2,HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10);
+ public void testH5Pset_shared_mesg_index_Invalid_indexnum() throws Throwable
+ {
+ H5.H5Pset_shared_mesg_index(fcpl_id, 2, HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Pset_shared_mesg_index_InvalidFlag() throws Throwable {
+ public void testH5Pset_shared_mesg_index_InvalidFlag() throws Throwable
+ {
H5.H5Pset_shared_mesg_nindexes(fcpl_id, 7);
- H5.H5Pset_shared_mesg_index(fcpl_id, 2,HDF5Constants.H5O_SHMESG_ALL_FLAG + 1, 10);
+ H5.H5Pset_shared_mesg_index(fcpl_id, 2, HDF5Constants.H5O_SHMESG_ALL_FLAG + 1, 10);
}
@Test
- public void testH5Pget_shared_mesg_index() {
+ public void testH5Pget_shared_mesg_index()
+ {
- int ret_val = -1;
+ int ret_val = -1;
int[] mesg_info = new int[2];
try {
H5.H5Pset_shared_mesg_nindexes(fcpl_id, 2);
- H5.H5Pset_shared_mesg_index(fcpl_id, 0,HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10);
+ H5.H5Pset_shared_mesg_index(fcpl_id, 0, HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10);
ret_val = H5.H5Pget_shared_mesg_index(fcpl_id, 0, mesg_info);
}
catch (Throwable err) {
@@ -743,13 +858,15 @@ public class TestH5P {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Pget_shared_mesg_index_Invalid_indexnum() throws Throwable {
+ public void testH5Pget_shared_mesg_index_Invalid_indexnum() throws Throwable
+ {
int[] mesg_info = new int[2];
H5.H5Pget_shared_mesg_index(fcpl_id, 0, mesg_info);
}
@Test
- public void testH5Pset_local_heap_size_hint() {
+ public void testH5Pset_local_heap_size_hint()
+ {
int ret_val = -1;
try {
ret_val = H5.H5Pset_local_heap_size_hint(gcpl_id, 0);
@@ -762,7 +879,8 @@ public class TestH5P {
}
@Test
- public void testH5Pget_local_heap_size_hint() {
+ public void testH5Pget_local_heap_size_hint()
+ {
long size_hint = -1;
try {
size_hint = H5.H5Pget_local_heap_size_hint(gcpl_id);
@@ -775,7 +893,8 @@ public class TestH5P {
}
@Test
- public void testH5Pset_nbit() {
+ public void testH5Pset_nbit()
+ {
int ret_val = -1;
try {
ret_val = H5.H5Pset_nbit(ocpl_id);
@@ -788,9 +907,10 @@ public class TestH5P {
}
@Test
- public void testH5Pset_scaleoffset() {
- int ret_val = -1;
- int scale_type = HDF5Constants.H5Z_SO_FLOAT_DSCALE;
+ public void testH5Pset_scaleoffset()
+ {
+ int ret_val = -1;
+ int scale_type = HDF5Constants.H5Z_SO_FLOAT_DSCALE;
int scale_factor = HDF5Constants.H5Z_SO_INT_MINBITS_DEFAULT;
try {
ret_val = H5.H5Pset_scaleoffset(ocpl_id, scale_type, scale_factor);
@@ -803,20 +923,23 @@ public class TestH5P {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Pset_scaleoffset_Invalidscale_type() throws Throwable {
+ public void testH5Pset_scaleoffset_Invalidscale_type() throws Throwable
+ {
H5.H5Pset_scaleoffset(ocpl_id, 3, 1);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Pset_scaleoffset_Invalidscale_factor() throws Throwable {
+ public void testH5Pset_scaleoffset_Invalidscale_factor() throws Throwable
+ {
H5.H5Pset_scaleoffset(ocpl_id, HDF5Constants.H5Z_SO_INT, -1);
}
@Test
- public void testH5Pset_est_link_info() {
+ public void testH5Pset_est_link_info()
+ {
int ret_val = -1;
try {
- ret_val = H5.H5Pset_est_link_info(gcpl_id, 0,10);
+ ret_val = H5.H5Pset_est_link_info(gcpl_id, 0, 10);
}
catch (Throwable err) {
err.printStackTrace();
@@ -826,13 +949,15 @@ public class TestH5P {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Pset_est_link_info_InvalidValues() throws Throwable {
- H5.H5Pset_est_link_info(gcpl_id, 100000,10);
+ public void testH5Pset_est_link_info_InvalidValues() throws Throwable
+ {
+ H5.H5Pset_est_link_info(gcpl_id, 100000, 10);
}
@Test
- public void testH5Pget_est_link_info() {
- int ret_val = -1;
+ public void testH5Pget_est_link_info()
+ {
+ int ret_val = -1;
int[] link_info = new int[2];
try {
ret_val = H5.H5Pget_est_link_info(gcpl_id, link_info);
@@ -845,8 +970,9 @@ public class TestH5P {
}
@Test
- public void testH5Pset_elink_prefix() {
- int ret_val = -1;
+ public void testH5Pset_elink_prefix()
+ {
+ int ret_val = -1;
String prefix = "tmp";
try {
ret_val = H5.H5Pset_elink_prefix(plapl_id, prefix);
@@ -859,14 +985,16 @@ public class TestH5P {
}
@Test(expected = NullPointerException.class)
- public void testH5Pset_elink_prefix_null() throws Throwable{
+ public void testH5Pset_elink_prefix_null() throws Throwable
+ {
H5.H5Pset_elink_prefix(plapl_id, null);
}
@Test
- public void testH5Pget_elink_prefix() {
- String prefix = "tmp";
- String[] pre = {""};
+ public void testH5Pget_elink_prefix()
+ {
+ String prefix = "tmp";
+ String[] pre = {""};
long prefix_size = 0;
try {
@@ -877,22 +1005,25 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_elink_prefix: " + err);
}
- assertTrue(prefix_size>=0);
+ assertTrue(prefix_size >= 0);
assertTrue("The prefix: ", prefix.equals(pre[0]));
}
@Test(expected = NullPointerException.class)
- public void testH5Pget_elink_prefix_null() throws Throwable {
+ public void testH5Pget_elink_prefix_null() throws Throwable
+ {
H5.H5Pget_elink_prefix(plapl_id, null);
}
@Test(expected = NullPointerException.class)
- public void testH5Pget_userblock_null() throws Throwable {
+ public void testH5Pget_userblock_null() throws Throwable
+ {
H5.H5Pget_userblock(fcpl_id, null);
}
@Test
- public void testH5P_userblock() {
+ public void testH5P_userblock()
+ {
long[] size = {0};
try {
@@ -903,13 +1034,13 @@ public class TestH5P {
H5.H5Pclose(fcpl_id);
/* Get the file's dataset creation property list */
- fcpl_id = H5.H5Fget_create_plist(H5fid);
+ fcpl_id = H5.H5Fget_create_plist(H5fid);
/* Get the file's version information */
H5F_info2_t finfo = H5.H5Fget_info(H5fid);
- assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0);
- assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0);
- assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0);
+ assertTrue("super block version: " + finfo.super_version, finfo.super_version == 0);
+ assertTrue("free-space manager version: " + finfo.free_version, finfo.free_version == 0);
+ assertTrue("shared object header version: " + finfo.sohm_version, finfo.sohm_version == 0);
H5.H5Pget_userblock(fcpl_id, size);
deleteH5file();
}
@@ -917,17 +1048,19 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_userblock: " + err);
}
- assertTrue("user block size: "+size[0], size[0] == 1024);
+ assertTrue("user block size: " + size[0], size[0] == 1024);
}
@Test(expected = NullPointerException.class)
- public void testH5Pget_sizes_null() throws Throwable {
+ public void testH5Pget_sizes_null() throws Throwable
+ {
H5.H5Pget_sizes(fcpl_id, null);
}
@Test
- public void testH5P_sizes() {
- long[] size = {0,0};
+ public void testH5P_sizes()
+ {
+ long[] size = {0, 0};
try {
H5.H5Pset_sizes(fcpl_id, 4, 8);
@@ -937,13 +1070,13 @@ public class TestH5P {
H5.H5Pclose(fcpl_id);
/* Get the file's dataset creation property list */
- fcpl_id = H5.H5Fget_create_plist(H5fid);
+ fcpl_id = H5.H5Fget_create_plist(H5fid);
/* Get the file's version information */
H5F_info2_t finfo = H5.H5Fget_info(H5fid);
- assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0);
- assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0);
- assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0);
+ assertTrue("super block version: " + finfo.super_version, finfo.super_version == 0);
+ assertTrue("free-space manager version: " + finfo.free_version, finfo.free_version == 0);
+ assertTrue("shared object header version: " + finfo.sohm_version, finfo.sohm_version == 0);
H5.H5Pget_sizes(fcpl_id, size);
deleteH5file();
}
@@ -951,18 +1084,20 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_sizes: " + err);
}
- assertTrue("sizeof_addr size: "+size[0], size[0] == 4);
- assertTrue("sizeof_size size: "+size[1], size[1] == 8);
+ assertTrue("sizeof_addr size: " + size[0], size[0] == 4);
+ assertTrue("sizeof_size size: " + size[1], size[1] == 8);
}
@Test(expected = NullPointerException.class)
- public void testH5Pget_sym_k_null() throws Throwable {
+ public void testH5Pget_sym_k_null() throws Throwable
+ {
H5.H5Pget_sym_k(fcpl_id, null);
}
@Test
- public void testH5P_sym_k() {
- int[] size = {0,0};
+ public void testH5P_sym_k()
+ {
+ int[] size = {0, 0};
try {
H5.H5Pset_sym_k(fcpl_id, 32, 8);
@@ -972,13 +1107,13 @@ public class TestH5P {
H5.H5Pclose(fcpl_id);
/* Get the file's dataset creation property list */
- fcpl_id = H5.H5Fget_create_plist(H5fid);
+ fcpl_id = H5.H5Fget_create_plist(H5fid);
/* Get the file's version information */
H5F_info2_t finfo = H5.H5Fget_info(H5fid);
- assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0);
- assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0);
- assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0);
+ assertTrue("super block version: " + finfo.super_version, finfo.super_version == 0);
+ assertTrue("free-space manager version: " + finfo.free_version, finfo.free_version == 0);
+ assertTrue("shared object header version: " + finfo.sohm_version, finfo.sohm_version == 0);
H5.H5Pget_sym_k(fcpl_id, size);
deleteH5file();
}
@@ -986,17 +1121,19 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_sym_k: " + err);
}
- assertTrue("symbol table tree rank: "+size[0], size[0] == 32);
- assertTrue("symbol table node size: "+size[1], size[1] == 8);
+ assertTrue("symbol table tree rank: " + size[0], size[0] == 32);
+ assertTrue("symbol table node size: " + size[1], size[1] == 8);
}
@Test(expected = NullPointerException.class)
- public void testH5Pget_istore_k_null() throws Throwable {
+ public void testH5Pget_istore_k_null() throws Throwable
+ {
H5.H5Pget_istore_k(fcpl_id, null);
}
@Test
- public void testH5P_istore_k() {
+ public void testH5P_istore_k()
+ {
int[] size = {0};
try {
@@ -1007,13 +1144,13 @@ public class TestH5P {
H5.H5Pclose(fcpl_id);
/* Get the file's dataset creation property list */
- fcpl_id = H5.H5Fget_create_plist(H5fid);
+ fcpl_id = H5.H5Fget_create_plist(H5fid);
/* Get the file's version information */
H5F_info2_t finfo = H5.H5Fget_info(H5fid);
- assertTrue("super block version: "+finfo.super_version, finfo.super_version == 1);
- assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0);
- assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0);
+ assertTrue("super block version: " + finfo.super_version, finfo.super_version == 1);
+ assertTrue("free-space manager version: " + finfo.free_version, finfo.free_version == 0);
+ assertTrue("shared object header version: " + finfo.sohm_version, finfo.sohm_version == 0);
H5.H5Pget_istore_k(fcpl_id, size);
deleteH5file();
}
@@ -1021,13 +1158,14 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_sym_k: " + err);
}
- assertTrue("chunked storage b-tree 1/2-rank: "+size[0], size[0] == 64);
+ assertTrue("chunked storage b-tree 1/2-rank: " + size[0], size[0] == 64);
}
@Test
- public void testH5P_obj_track_times() {
+ public void testH5P_obj_track_times()
+ {
boolean default_ret_val = false;
- boolean ret_val = true;
+ boolean ret_val = true;
try {
default_ret_val = H5.H5Pget_obj_track_times(ocpl_id);
H5.H5Pset_obj_track_times(ocpl_id, false);
@@ -1042,7 +1180,8 @@ public class TestH5P {
}
@Test
- public void testH5Pget_char_encoding() {
+ public void testH5Pget_char_encoding()
+ {
int char_encoding = 0;
try {
@@ -1065,18 +1204,19 @@ public class TestH5P {
}
@Test
- public void testH5P_fill_time() {
+ public void testH5P_fill_time()
+ {
int[] fill_time = {0};
try {
H5.H5Pget_fill_time(ocpl_id, fill_time);
- assertTrue("fill_time: "+fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_IFSET);
+ assertTrue("fill_time: " + fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_IFSET);
H5.H5Pset_fill_time(ocpl_id, HDF5Constants.H5D_FILL_TIME_ALLOC);
H5.H5Pget_fill_time(ocpl_id, fill_time);
- assertTrue("fill_time: "+fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_ALLOC);
+ assertTrue("fill_time: " + fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_ALLOC);
H5.H5Pset_fill_time(ocpl_id, HDF5Constants.H5D_FILL_TIME_NEVER);
H5.H5Pget_fill_time(ocpl_id, fill_time);
- assertTrue("fill_time: "+fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_NEVER);
+ assertTrue("fill_time: " + fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_NEVER);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1085,18 +1225,19 @@ public class TestH5P {
}
@Test
- public void testH5P_alloc_time() {
+ public void testH5P_alloc_time()
+ {
int[] alloc_time = {0};
try {
H5.H5Pget_alloc_time(ocpl_id, alloc_time);
- assertTrue("alloc_time: "+alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_LATE);
+ assertTrue("alloc_time: " + alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_LATE);
H5.H5Pset_alloc_time(ocpl_id, HDF5Constants.H5D_ALLOC_TIME_EARLY);
H5.H5Pget_alloc_time(ocpl_id, alloc_time);
- assertTrue("alloc_time: "+alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_EARLY);
+ assertTrue("alloc_time: " + alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_EARLY);
H5.H5Pset_alloc_time(ocpl_id, HDF5Constants.H5D_ALLOC_TIME_INCR);
H5.H5Pget_alloc_time(ocpl_id, alloc_time);
- assertTrue("alloc_time: "+alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_INCR);
+ assertTrue("alloc_time: " + alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_INCR);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1105,21 +1246,24 @@ public class TestH5P {
}
@Test
- public void testH5P_fill_value() {
- int[] fill_value = {-1};
+ public void testH5P_fill_value()
+ {
+ int[] fill_value = {-1};
int[] fill_value_status = {-1};
try {
H5.H5Pfill_value_defined(ocpl_id, fill_value_status);
- assertTrue("fill_value_status: "+fill_value_status[0], fill_value_status[0] == HDF5Constants.H5D_FILL_VALUE_DEFAULT);
+ assertTrue("fill_value_status: " + fill_value_status[0],
+ fill_value_status[0] == HDF5Constants.H5D_FILL_VALUE_DEFAULT);
H5.H5Pget_fill_value(ocpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value);
- assertTrue("fill_value: "+fill_value[0], fill_value[0] == 0);
+ assertTrue("fill_value: " + fill_value[0], fill_value[0] == 0);
fill_value[0] = 255;
H5.H5Pset_fill_value(ocpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value);
H5.H5Pget_fill_value(ocpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value);
- assertTrue("fill_value: "+fill_value[0], fill_value[0] == 255);
+ assertTrue("fill_value: " + fill_value[0], fill_value[0] == 255);
H5.H5Pfill_value_defined(ocpl_id, fill_value_status);
- assertTrue("fill_value_status: "+fill_value_status[0], fill_value_status[0] == HDF5Constants.H5D_FILL_VALUE_USER_DEFINED);
+ assertTrue("fill_value_status: " + fill_value_status[0],
+ fill_value_status[0] == HDF5Constants.H5D_FILL_VALUE_USER_DEFINED);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1128,15 +1272,16 @@ public class TestH5P {
}
@Test
- public void testH5P_layout() {
+ public void testH5P_layout()
+ {
int layout_type = -1;
try {
layout_type = H5.H5Pget_layout(ocpl_id);
- assertTrue("layout: "+layout_type, layout_type == HDF5Constants.H5D_CONTIGUOUS);
+ assertTrue("layout: " + layout_type, layout_type == HDF5Constants.H5D_CONTIGUOUS);
H5.H5Pset_layout(ocpl_id, HDF5Constants.H5D_COMPACT);
layout_type = H5.H5Pget_layout(ocpl_id);
- assertTrue("layout: "+layout_type, layout_type == HDF5Constants.H5D_COMPACT);
+ assertTrue("layout: " + layout_type, layout_type == HDF5Constants.H5D_COMPACT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1145,18 +1290,19 @@ public class TestH5P {
}
@Test
- public void testH5P_chunk() {
- long[] chunk_size = {0,0};
- long[] chunk_new_size = {2,3};
- int layout_type = -1;
+ public void testH5P_chunk()
+ {
+ long[] chunk_size = {0, 0};
+ long[] chunk_new_size = {2, 3};
+ int layout_type = -1;
try {
H5.H5Pset_chunk(ocpl_id, 2, chunk_new_size);
H5.H5Pget_chunk(ocpl_id, 2, chunk_size);
- assertTrue("chunk: "+chunk_size[0], chunk_size[0] == chunk_new_size[0]);
- assertTrue("chunk: "+chunk_size[1], chunk_size[1] == chunk_new_size[1]);
+ assertTrue("chunk: " + chunk_size[0], chunk_size[0] == chunk_new_size[0]);
+ assertTrue("chunk: " + chunk_size[1], chunk_size[1] == chunk_new_size[1]);
layout_type = H5.H5Pget_layout(ocpl_id);
- assertTrue("layout: "+layout_type, layout_type == HDF5Constants.H5D_CHUNKED);
+ assertTrue("layout: " + layout_type, layout_type == HDF5Constants.H5D_CHUNKED);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1165,20 +1311,22 @@ public class TestH5P {
}
@Test
- public void testH5P_file_space_strategy() {
- long[] threshold = {0};
+ public void testH5P_file_space_strategy()
+ {
+ long[] threshold = {0};
boolean[] persist = {false};
- int strategy = 0;
+ int strategy = 0;
try {
strategy = H5.H5Pget_file_space_strategy(fcpl_id, persist, threshold);
- assertTrue("strategy(default): "+strategy, strategy == HDF5Constants.H5F_FSPACE_STRATEGY_FSM_AGGR);
- assertTrue("persist(default): "+persist[0], persist[0] == false);
- assertTrue("threshold(default): "+threshold[0], threshold[0] == 1);
+ assertTrue("strategy(default): " + strategy,
+ strategy == HDF5Constants.H5F_FSPACE_STRATEGY_FSM_AGGR);
+ assertTrue("persist(default): " + persist[0], persist[0] == false);
+ assertTrue("threshold(default): " + threshold[0], threshold[0] == 1);
H5.H5Pset_file_space_strategy(fcpl_id, HDF5Constants.H5F_FSPACE_STRATEGY_PAGE, true, 1);
strategy = H5.H5Pget_file_space_strategy(fcpl_id, persist, threshold);
- assertTrue("strategy: "+strategy, strategy == HDF5Constants.H5F_FSPACE_STRATEGY_PAGE);
- assertTrue("persist: "+persist[0], persist[0] == true);
- assertTrue("threshold: "+threshold[0], threshold[0] == 1);
+ assertTrue("strategy: " + strategy, strategy == HDF5Constants.H5F_FSPACE_STRATEGY_PAGE);
+ assertTrue("persist: " + persist[0], persist[0] == true);
+ assertTrue("threshold: " + threshold[0], threshold[0] == 1);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1187,23 +1335,25 @@ public class TestH5P {
}
@Test
- public void testH5P_file_space_page_size() {
+ public void testH5P_file_space_page_size()
+ {
long page_size = 0;
try {
page_size = H5.H5Pget_file_space_page_size(fcpl_id);
- assertTrue("page_size(default): "+page_size, page_size == 4096);
+ assertTrue("page_size(default): " + page_size, page_size == 4096);
H5.H5Pset_file_space_page_size(fcpl_id, 512);
page_size = H5.H5Pget_file_space_page_size(fcpl_id);
- assertTrue("page_size: "+page_size, page_size == 512);
+ assertTrue("page_size: " + page_size, page_size == 512);
}
catch (Throwable err) {
err.printStackTrace();
fail("testH5P_file_space_page_size: " + err);
}
- }
+ }
@Test
- public void testH5Pset_efile_prefix() {
+ public void testH5Pset_efile_prefix()
+ {
String prefix = "tmp";
try {
H5.H5Pset_efile_prefix(lapl_id, prefix);
@@ -1215,14 +1365,16 @@ public class TestH5P {
}
@Test(expected = NullPointerException.class)
- public void testH5Pset_efile_prefix_null() throws Throwable{
+ public void testH5Pset_efile_prefix_null() throws Throwable
+ {
H5.H5Pset_efile_prefix(lapl_id, null);
}
@Test
- public void testH5Pget_efile_prefix() {
+ public void testH5Pget_efile_prefix()
+ {
String prefix = "tmp";
- String pre = "";
+ String pre = "";
try {
H5.H5Pset_efile_prefix(lapl_id, prefix);
@@ -1236,15 +1388,17 @@ public class TestH5P {
}
@Ignore
- public void testH5P_chunk_opts() {
+ public void testH5P_chunk_opts()
+ {
int chunk_opts = -1;
try {
chunk_opts = H5.H5Pget_chunk_opts(ocpl_id);
- assertTrue("chunk_opts: "+chunk_opts, chunk_opts == 0);
+ assertTrue("chunk_opts: " + chunk_opts, chunk_opts == 0);
H5.H5Pset_chunk_opts(ocpl_id, HDF5Constants.H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS);
chunk_opts = H5.H5Pget_chunk_opts(ocpl_id);
- assertTrue("chunk_opts: "+chunk_opts, chunk_opts == HDF5Constants.H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS);
+ assertTrue("chunk_opts: " + chunk_opts,
+ chunk_opts == HDF5Constants.H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS);
}
catch (Throwable err) {
err.printStackTrace();
diff --git a/java/test/TestH5PData.java b/java/test/TestH5PData.java
index 8b04629..49a0b7d 100644
--- a/java/test/TestH5PData.java
+++ b/java/test/TestH5PData.java
@@ -31,44 +31,61 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5PData {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_FILE = "testPD.h5";
- private static final int DIM_X = 12;
- private static final int DIM_Y = 18;
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5dsid = HDF5Constants.H5I_INVALID_HID;
- long H5did = HDF5Constants.H5I_INVALID_HID;
- long plist_id = HDF5Constants.H5I_INVALID_HID;
- long[] H5dims = { DIM_X, DIM_Y };
- double windchillF[][] =
- {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0},
- {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0, -41.0, -47.0, -53.0, -59.0, -66.0, -72.0},
- {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0, -45.0, -51.0, -58.0, -64.0, -71.0, -77.0},
- {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0, -48.0, -55.0, -61.0, -68.0, -74.0, -81.0},
- {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0, -51.0, -58.0, -64.0, -71.0, -78.0, -84.0},
- {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0, -53.0, -60.0, -67.0, -73.0, -80.0, -87.0},
- {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0, -55.0, -62.0, -69.0, -76.0, -82.0, -89.0},
- {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0, -57.0, -64.0, -71.0, -78.0, -84.0, -91.0},
- {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0, -58.0, -65.0, -72.0, -79.0, -86.0, -93.0},
- {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0, -60.0, -67.0, -74.0, -81.0, -88.0, -95.0},
- {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0, -61.0, -68.0, -75.0, -82.0, -89.0, -97.0},
- {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0, -62.0, -69.0, -76.0, -84.0, -91.0, -98.0}
- };
-
- private final void _deleteFile(String filename) {
+ private static final int DIM_X = 12;
+ private static final int DIM_Y = 18;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
+ long[] H5dims = {DIM_X, DIM_Y};
+ double windchillF[][] = {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0,
+ -40.0, -46.0, -52.0, -57.0, -63.0},
+ {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0,
+ -41.0, -47.0, -53.0, -59.0, -66.0, -72.0},
+ {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0,
+ -45.0, -51.0, -58.0, -64.0, -71.0, -77.0},
+ {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0,
+ -48.0, -55.0, -61.0, -68.0, -74.0, -81.0},
+ {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0,
+ -51.0, -58.0, -64.0, -71.0, -78.0, -84.0},
+ {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0,
+ -53.0, -60.0, -67.0, -73.0, -80.0, -87.0},
+ {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0,
+ -55.0, -62.0, -69.0, -76.0, -82.0, -89.0},
+ {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0,
+ -57.0, -64.0, -71.0, -78.0, -84.0, -91.0},
+ {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0,
+ -58.0, -65.0, -72.0, -79.0, -86.0, -93.0},
+ {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0,
+ -60.0, -67.0, -74.0, -81.0, -88.0, -95.0},
+ {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0,
+ -61.0, -68.0, -75.0, -82.0, -89.0, -97.0},
+ {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0,
+ -62.0, -69.0, -76.0, -84.0, -91.0, -98.0}};
+
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
- private final long _createFloatDataset(long fid, long dsid, String name, long dapl) {
+ private final long _createFloatDataset(long fid, long dsid, String name, long dapl)
+ {
long did = HDF5Constants.H5I_INVALID_HID;
try {
- did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_NATIVE_FLOAT, dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
+ did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_NATIVE_FLOAT, dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, dapl);
}
catch (Throwable err) {
err.printStackTrace();
@@ -80,49 +97,67 @@ public class TestH5PData {
}
@Before
- public void createH5file()
- throws NullPointerException, HDF5Exception {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void createH5file() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
- H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- H5dsid = H5.H5Screate_simple(2, H5dims, null);
- H5did = _createFloatDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
+ H5dsid = H5.H5Screate_simple(2, H5dims, null);
+ H5did = _createFloatDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER);
}
catch (Throwable err) {
err.printStackTrace();
fail("TestH5PData.createH5file: " + err);
}
- assertTrue("TestH5PData.createH5file: H5.H5Fcreate: ",H5fid > 0);
- assertTrue("TestH5PData.createH5file: H5.H5Screate_simple: ",H5dsid > 0);
- assertTrue("TestH5PData.createH5file: _createFloatDataset: ",H5did > 0);
+ assertTrue("TestH5PData.createH5file: H5.H5Fcreate: ", H5fid > 0);
+ assertTrue("TestH5PData.createH5file: H5.H5Screate_simple: ", H5dsid > 0);
+ assertTrue("TestH5PData.createH5file: _createFloatDataset: ", H5did > 0);
assertTrue(plist_id > 0);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5dsid > 0)
- try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid);
+ }
+ 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) {
+ }
_deleteFile(H5_FILE);
if (plist_id > 0)
- try {H5.H5Pclose(plist_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(plist_id);
+ }
+ catch (Exception ex) {
+ }
System.out.println();
}
@Test
- public void testH5Pdata_transform() {
- String f_to_c = "(5/9.0)*(x-32)";
+ public void testH5Pdata_transform()
+ {
+ String f_to_c = "(5/9.0)*(x-32)";
double windchillFread[][] = new double[DIM_X][DIM_Y];
double windchillC;
NumberFormat formatter = new DecimalFormat("#0.000");
@@ -130,38 +165,40 @@ public class TestH5PData {
try {
H5.H5Pset_data_transform(plist_id, f_to_c);
H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- plist_id, windchillF);
+ plist_id, windchillF);
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, windchillFread);
+ HDF5Constants.H5P_DEFAULT, windchillFread);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5Pdata_transform: " + err);
}
- for(int row = 0; row < DIM_X; row++)
- for(int col = 0; col < DIM_Y; col++) {
- windchillC = (5/9.0)*(windchillF[row][col]-32);
- String Cstr = formatter.format(windchillC);
+ for (int row = 0; row < DIM_X; row++)
+ for (int col = 0; col < DIM_Y; col++) {
+ windchillC = (5 / 9.0) * (windchillF[row][col] - 32);
+ String Cstr = formatter.format(windchillC);
String Fread = formatter.format(windchillFread[row][col]);
- assertTrue("H5Pdata_transform: <"+row+","+col+">"+Fread+"="+Cstr, Fread.compareTo(Cstr)==0);
+ assertTrue("H5Pdata_transform: <" + row + "," + col + ">" + Fread + "=" + Cstr,
+ Fread.compareTo(Cstr) == 0);
}
}
@Test
- public void testH5P_buffer() {
+ public void testH5P_buffer()
+ {
long default_size = 0;
- long size = 0;
+ long size = 0;
try {
default_size = H5.H5Pget_buffer_size(plist_id);
- H5.H5Pset_buffer_size(plist_id, DIM_X*DIM_Y);
+ H5.H5Pset_buffer_size(plist_id, DIM_X * DIM_Y);
size = H5.H5Pget_buffer_size(plist_id);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5P_buffer fail: " + err);
}
- assertTrue("H5P_buffer default: "+default_size, default_size==1024*1024);
- assertTrue("H5P_buffer size: "+size, size==DIM_X*DIM_Y);
+ assertTrue("H5P_buffer default: " + default_size, default_size == 1024 * 1024);
+ assertTrue("H5P_buffer size: " + size, size == DIM_X * DIM_Y);
}
}
diff --git a/java/test/TestH5PL.java b/java/test/TestH5PL.java
index d44cc0b..f6440cd 100644
--- a/java/test/TestH5PL.java
+++ b/java/test/TestH5PL.java
@@ -14,6 +14,7 @@ package test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
@@ -26,39 +27,45 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5PL {
- @Rule public TestName testname = new TestName();
- private static String FILENAME = "h5_dlopenChunk.h5";
- private static String DATASETNAME = "DS1";
- private static final int DIM_X = 6;
- private static final int DIM_Y = 8;
- private static final int CHUNK_X = 4;
- private static final int CHUNK_Y = 4;
- private static final int RANK = 2;
- private static final int NDIMS = 2;
+ @Rule
+ public TestName testname = new TestName();
+ private static String FILENAME = "h5_dlopenChunk.h5";
+ private static String DATASETNAME = "DS1";
+ private static final int DIM_X = 6;
+ private static final int DIM_Y = 8;
+ private static final int CHUNK_X = 4;
+ private static final int CHUNK_Y = 4;
+ private static final int RANK = 2;
+ private static final int NDIMS = 2;
private static final int H5Z_FILTER_DYNLIB4 = 260;
@Before
- public void checkOpenIDs() {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void checkOpenIDs()
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
}
@After
- public void nextTestName() {
+ public void nextTestName()
+ {
System.out.println();
}
@Test
- public void TestH5PLplugins() {
+ public void TestH5PLplugins()
+ {
try {
int plugin_flags = H5.H5PLget_loading_state();
- assertTrue("H5.H5PLget_loading_state: "+plugin_flags, plugin_flags == HDF5Constants.H5PL_ALL_PLUGIN);
+ assertTrue("H5.H5PLget_loading_state: " + plugin_flags,
+ plugin_flags == HDF5Constants.H5PL_ALL_PLUGIN);
int new_setting = plugin_flags & ~HDF5Constants.H5PL_FILTER_PLUGIN;
- H5.H5PLset_loading_state (new_setting);
+ H5.H5PLset_loading_state(new_setting);
int changed_flags = H5.H5PLget_loading_state();
- assertTrue("H5.H5PLget_loading_state: "+changed_flags, changed_flags == new_setting);
- H5.H5PLset_loading_state (plugin_flags);
+ assertTrue("H5.H5PLget_loading_state: " + changed_flags, changed_flags == new_setting);
+ H5.H5PLset_loading_state(plugin_flags);
changed_flags = H5.H5PLget_loading_state();
- assertTrue("H5.H5PLget_loading_state: "+changed_flags, changed_flags == HDF5Constants.H5PL_ALL_PLUGIN);
+ assertTrue("H5.H5PLget_loading_state: " + changed_flags,
+ changed_flags == HDF5Constants.H5PL_ALL_PLUGIN);
}
catch (Throwable err) {
err.printStackTrace();
@@ -67,15 +74,16 @@ public class TestH5PL {
}
@Test
- public void TestH5PLpaths() {
+ public void TestH5PLpaths()
+ {
try {
// Get the original number of paths
int nStartPaths = H5.H5PLsize();
- int nPaths; /* # paths from H5PLSize() */
- int nTruePaths = nStartPaths; /* What the # paths should be */
- int index; /* Path table index */
- String path; /* Path from H5PLget() */
+ int nPaths; /* # paths from H5PLSize() */
+ int nTruePaths = nStartPaths; /* What the # paths should be */
+ int index; /* Path table index */
+ String path; /* Path from H5PLget() */
// APPEND a path and ensure it was added correctly
String pathAppend = "path_append";
@@ -86,8 +94,9 @@ public class TestH5PL {
assertTrue("# paths should be " + nTruePaths + " but was " + nPaths, nTruePaths == nPaths);
index = nTruePaths - 1;
- path = H5.H5PLget(index);
- assertTrue("Path should be " + pathAppend + " but was " + path, path.compareToIgnoreCase(pathAppend) == 0);
+ path = H5.H5PLget(index);
+ assertTrue("Path should be " + pathAppend + " but was " + path,
+ path.compareToIgnoreCase(pathAppend) == 0);
// PREPEND a path and ensure it was added correctly
String pathPrepend = "path_prepend";
@@ -98,13 +107,14 @@ public class TestH5PL {
assertTrue("# paths should be " + nTruePaths + " but was " + nPaths, nTruePaths == nPaths);
index = 0;
- path = H5.H5PLget(index);
- assertTrue("Path should be " + pathPrepend + " but was " + path, path.compareToIgnoreCase(pathPrepend) == 0);
+ path = H5.H5PLget(index);
+ assertTrue("Path should be " + pathPrepend + " but was " + path,
+ path.compareToIgnoreCase(pathPrepend) == 0);
// INSERT a path and ensure it was added correctly
// Inserting at the index == # of start paths ensures we're in the middle
String pathInsert = "path_insert";
- index = nStartPaths;
+ index = nStartPaths;
H5.H5PLinsert(pathInsert, index);
nPaths = H5.H5PLsize();
@@ -112,22 +122,24 @@ public class TestH5PL {
assertTrue("# paths should be " + nTruePaths + " but was " + nPaths, nTruePaths == nPaths);
path = H5.H5PLget(index);
- assertTrue("Path should be " + pathInsert + " but was " + path, path.compareToIgnoreCase(pathInsert) == 0);
+ assertTrue("Path should be " + pathInsert + " but was " + path,
+ path.compareToIgnoreCase(pathInsert) == 0);
// REPLACE the path we just added and ensure it updated correctly
String pathReplace = "path_replace";
- index = nStartPaths;
+ index = nStartPaths;
H5.H5PLreplace(pathReplace, index);
nPaths = H5.H5PLsize();
assertTrue("# paths should be " + nTruePaths + " but was " + nPaths, nTruePaths == nPaths);
path = H5.H5PLget(index);
- assertTrue("Path should be " + pathReplace + " but was " + path, path.compareToIgnoreCase(pathReplace) == 0);
+ assertTrue("Path should be " + pathReplace + " but was " + path,
+ path.compareToIgnoreCase(pathReplace) == 0);
// REMOVE the path we just replaced and check that the table was compacted
// The (index+1) path should move down to fill the space when the path is removed.
- index = nStartPaths;
+ index = nStartPaths;
String pathRemove = H5.H5PLget(index + 1);
H5.H5PLremove(index);
@@ -136,7 +148,8 @@ public class TestH5PL {
assertTrue("# paths should be " + nTruePaths + " but was " + nPaths, nTruePaths == nPaths);
path = H5.H5PLget(index);
- assertTrue("Path should be " + pathRemove + " but was " + path, path.compareToIgnoreCase(pathRemove) == 0);
+ assertTrue("Path should be " + pathRemove + " but was " + path,
+ path.compareToIgnoreCase(pathRemove) == 0);
}
catch (Throwable err) {
err.printStackTrace();
@@ -145,22 +158,23 @@ public class TestH5PL {
}
@Ignore
- public void TestH5PLdlopen() {
- long file_id = HDF5Constants.H5I_INVALID_HID;
+ public void TestH5PLdlopen()
+ {
+ long file_id = HDF5Constants.H5I_INVALID_HID;
long filespace_id = HDF5Constants.H5I_INVALID_HID;
- long dataset_id = HDF5Constants.H5I_INVALID_HID;
- long fapl_id = HDF5Constants.H5I_INVALID_HID;
- long dcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long fapl_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
try {
- int[] cd_values = {9, 0, 0, 0};
- int[] libversion = {0, 0, 0};
- long[] dims = { DIM_X, DIM_Y };
- long[] chunk_dims = { CHUNK_X, CHUNK_Y };
- int[][] dset_data = new int[DIM_X][DIM_Y];
- int[] mdc_nelmts = {0};
+ int[] cd_values = {9, 0, 0, 0};
+ int[] libversion = {0, 0, 0};
+ long[] dims = {DIM_X, DIM_Y};
+ long[] chunk_dims = {CHUNK_X, CHUNK_Y};
+ int[][] dset_data = new int[DIM_X][DIM_Y];
+ int[] mdc_nelmts = {0};
long[] rdcc_nelmts = {0};
long[] rdcc_nbytes = {0};
- double[] rdcc_w0 = {0};
+ double[] rdcc_w0 = {0};
// Initialize data to "1", to make it easier to see the selections.
for (int indx = 0; indx < DIM_X; indx++)
@@ -170,7 +184,7 @@ public class TestH5PL {
// Create a new file using default properties.
try {
file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT);
+ HDF5Constants.H5P_DEFAULT);
}
catch (Exception e) {
e.printStackTrace();
@@ -212,7 +226,8 @@ public class TestH5PL {
cd_values[2] = libversion[1];
cd_values[3] = libversion[2];
if (dcpl_id >= 0)
- H5.H5Pset_filter(dcpl_id, H5Z_FILTER_DYNLIB4, HDF5Constants.H5Z_FLAG_MANDATORY, 4, cd_values);
+ H5.H5Pset_filter(dcpl_id, H5Z_FILTER_DYNLIB4, HDF5Constants.H5Z_FLAG_MANDATORY, 4,
+ cd_values);
}
catch (Exception e) {
e.printStackTrace();
@@ -222,8 +237,9 @@ public class TestH5PL {
// Create the chunked dataset.
try {
if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0))
- dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_NATIVE_INT, filespace_id,
- HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT);
+ dataset_id =
+ H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_NATIVE_INT, filespace_id,
+ HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT);
}
catch (Exception e) {
e.printStackTrace();
@@ -232,8 +248,8 @@ public class TestH5PL {
try {
if (dataset_id >= 0)
- H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5S_ALL, dset_data);
+ H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, dset_data);
}
catch (Exception e) {
e.printStackTrace();
@@ -247,13 +263,29 @@ public class TestH5PL {
finally {
// End access to the dataset and release resources used by it.
if (dcpl_id >= 0)
- try {H5.H5Pclose_class(dcpl_id);} catch (Throwable err) {}
+ try {
+ H5.H5Pclose_class(dcpl_id);
+ }
+ catch (Throwable err) {
+ }
if (dataset_id >= 0)
- try {H5.H5Dclose(dataset_id);} catch (Throwable err) {}
+ try {
+ H5.H5Dclose(dataset_id);
+ }
+ catch (Throwable err) {
+ }
if (filespace_id >= 0)
- try {H5.H5Sclose(filespace_id);} catch (Throwable err) {}
+ try {
+ H5.H5Sclose(filespace_id);
+ }
+ catch (Throwable err) {
+ }
if (file_id >= 0)
- try {H5.H5Fclose(file_id);} catch (Throwable err) {}
+ try {
+ H5.H5Fclose(file_id);
+ }
+ catch (Throwable err) {
+ }
}
}
}
diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java
index f6be24f..307ee74 100644
--- a/java/test/TestH5Pfapl.java
+++ b/java/test/TestH5Pfapl.java
@@ -35,104 +35,140 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Pfapl {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
- private static final String H5_FILE = "testPf.h5";
- private static final String H5_LOG_FILE = "testPf.log";
+ private static final String H5_FILE = "testPf.h5";
+ private static final String H5_LOG_FILE = "testPf.log";
private static final String H5_FAMILY_FILE = "testPf%05d";
- private static final String H5_MULTI_FILE = "testPfmulti";
- private static char MULTI_LETTERS[] = {'X','s','b','r','g','l','o'};
- private static final int DIM_X = 4;
- private static final int DIM_Y = 6;
- private static final int DIMF_X = 12;
- private static final int DIMF_Y = 18;
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5dsid = HDF5Constants.H5I_INVALID_HID;
- long H5did = HDF5Constants.H5I_INVALID_HID;
- long H5Fdsid = HDF5Constants.H5I_INVALID_HID;
- long H5Fdid = HDF5Constants.H5I_INVALID_HID;
- long[] H5dims = { DIM_X, DIM_Y };
- long fapl_id = HDF5Constants.H5I_INVALID_HID;
- long plapl_id = HDF5Constants.H5I_INVALID_HID;
- long dapl_id = HDF5Constants.H5I_INVALID_HID;
- long plist_id = HDF5Constants.H5I_INVALID_HID;
- long btplist_id = HDF5Constants.H5I_INVALID_HID;
- long[] H5Fdims = { DIMF_X, DIMF_Y };
- double windchillF[][] =
- {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0},
- {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0, -41.0, -47.0, -53.0, -59.0, -66.0, -72.0},
- {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0, -45.0, -51.0, -58.0, -64.0, -71.0, -77.0},
- {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0, -48.0, -55.0, -61.0, -68.0, -74.0, -81.0},
- {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0, -51.0, -58.0, -64.0, -71.0, -78.0, -84.0},
- {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0, -53.0, -60.0, -67.0, -73.0, -80.0, -87.0},
- {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0, -55.0, -62.0, -69.0, -76.0, -82.0, -89.0},
- {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0, -57.0, -64.0, -71.0, -78.0, -84.0, -91.0},
- {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0, -58.0, -65.0, -72.0, -79.0, -86.0, -93.0},
- {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0, -60.0, -67.0, -74.0, -81.0, -88.0, -95.0},
- {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0, -61.0, -68.0, -75.0, -82.0, -89.0, -97.0},
- {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0, -62.0, -69.0, -76.0, -84.0, -91.0, -98.0}
- };
-
- private final void _deleteFile(String filename) {
+ private static final String H5_MULTI_FILE = "testPfmulti";
+ private static char MULTI_LETTERS[] = {'X', 's', 'b', 'r', 'g', 'l', 'o'};
+ private static final int DIM_X = 4;
+ private static final int DIM_Y = 6;
+ private static final int DIMF_X = 12;
+ private static final int DIMF_Y = 18;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long H5Fdsid = HDF5Constants.H5I_INVALID_HID;
+ long H5Fdid = HDF5Constants.H5I_INVALID_HID;
+ long[] H5dims = {DIM_X, DIM_Y};
+ long fapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plapl_id = HDF5Constants.H5I_INVALID_HID;
+ long dapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
+ long btplist_id = HDF5Constants.H5I_INVALID_HID;
+ long[] H5Fdims = {DIMF_X, DIMF_Y};
+ double windchillF[][] = {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0,
+ -40.0, -46.0, -52.0, -57.0, -63.0},
+ {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0,
+ -41.0, -47.0, -53.0, -59.0, -66.0, -72.0},
+ {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0,
+ -45.0, -51.0, -58.0, -64.0, -71.0, -77.0},
+ {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0,
+ -48.0, -55.0, -61.0, -68.0, -74.0, -81.0},
+ {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0,
+ -51.0, -58.0, -64.0, -71.0, -78.0, -84.0},
+ {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0,
+ -53.0, -60.0, -67.0, -73.0, -80.0, -87.0},
+ {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0,
+ -55.0, -62.0, -69.0, -76.0, -82.0, -89.0},
+ {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0,
+ -57.0, -64.0, -71.0, -78.0, -84.0, -91.0},
+ {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0,
+ -58.0, -65.0, -72.0, -79.0, -86.0, -93.0},
+ {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0,
+ -60.0, -67.0, -74.0, -81.0, -88.0, -95.0},
+ {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0,
+ -61.0, -68.0, -75.0, -82.0, -89.0, -97.0},
+ {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0,
+ -62.0, -69.0, -76.0, -84.0, -91.0, -98.0}};
+
+ private final void _deleteFile(String filename)
+ {
File file = null;
try {
file = new File(filename);
}
- catch (Throwable err) {}
+ catch (Throwable err) {
+ }
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
- private final void _deleteLogFile() {
+ private final void _deleteLogFile()
+ {
File file = null;
try {
file = new File(H5_LOG_FILE);
}
- catch (Throwable err) {}
+ catch (Throwable err) {
+ }
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
- private final void _deleteFamilyFile() {
+ private final void _deleteFamilyFile()
+ {
File file = null;
- for(int indx = 0; ;indx++) {
+ for (int indx = 0;; indx++) {
java.text.DecimalFormat myFormat = new java.text.DecimalFormat("00000");
try {
- file = new File("test"+myFormat.format(Integer.valueOf(indx))+".h5");
+ file = new File("test" + myFormat.format(Integer.valueOf(indx)) + ".h5");
+ }
+ catch (Throwable err) {
}
- catch (Throwable err) {}
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
else
return;
}
}
- private final void _deleteMultiFile() {
+ private final void _deleteMultiFile()
+ {
File file = null;
- for(int indx = 1;indx<7;indx++) {
+ for (int indx = 1; indx < 7; indx++) {
try {
- file = new File(H5_MULTI_FILE+"-"+MULTI_LETTERS[indx]+".h5");
+ file = new File(H5_MULTI_FILE + "-" + MULTI_LETTERS[indx] + ".h5");
+ }
+ catch (Throwable err) {
}
- catch (Throwable err) {}
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
}
- private final long _createDataset(long fid, long dsid, String name, long dapl) {
+ private final long _createDataset(long fid, long dsid, String name, long dapl)
+ {
long did = HDF5Constants.H5I_INVALID_HID;
try {
- did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
+ did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, dapl);
}
catch (Throwable err) {
err.printStackTrace();
@@ -143,11 +179,13 @@ public class TestH5Pfapl {
return did;
}
- private final void _createFloatDataset() {
+ private final void _createFloatDataset()
+ {
try {
H5Fdsid = H5.H5Screate_simple(2, H5Fdims, null);
- H5Fdid = H5.H5Dcreate(H5fid, "dsfloat", HDF5Constants.H5T_NATIVE_FLOAT, H5Fdsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5Fdid =
+ H5.H5Dcreate(H5fid, "dsfloat", HDF5Constants.H5T_NATIVE_FLOAT, H5Fdsid,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -163,7 +201,8 @@ public class TestH5Pfapl {
}
}
- private final void _createH5multiFileDS() {
+ private final void _createH5multiFileDS()
+ {
try {
H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
}
@@ -181,12 +220,12 @@ public class TestH5Pfapl {
}
}
- private final void _createH5File(long fapl) {
+ private final void _createH5File(long fapl)
+ {
try {
- H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, fapl);
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, fapl);
H5dsid = H5.H5Screate_simple(2, H5dims, null);
- H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
+ H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -204,12 +243,13 @@ public class TestH5Pfapl {
}
}
- private final void _createH5familyFile(long fapl) {
+ private final void _createH5familyFile(long fapl)
+ {
try {
- H5fid = H5.H5Fcreate(H5_FAMILY_FILE+".h5", HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, fapl);
+ H5fid = H5.H5Fcreate(H5_FAMILY_FILE + ".h5", HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, fapl);
H5dsid = H5.H5Screate_simple(2, H5dims, null);
- H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
+ H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -227,10 +267,10 @@ public class TestH5Pfapl {
}
}
- private final void _createH5multiFile(long fapl) {
+ private final void _createH5multiFile(long fapl)
+ {
try {
- H5fid = H5.H5Fcreate(H5_MULTI_FILE, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, fapl);
+ H5fid = H5.H5Fcreate(H5_MULTI_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, fapl);
H5dsid = H5.H5Screate_simple(2, H5dims, null);
}
catch (Throwable err) {
@@ -248,22 +288,16 @@ public class TestH5Pfapl {
}
}
- public void deleteH5file() {
- _deleteFile(H5_FILE);
- }
+ public void deleteH5file() { _deleteFile(H5_FILE); }
- public void deleteH5familyfile() {
- _deleteFamilyFile();
- }
+ public void deleteH5familyfile() { _deleteFamilyFile(); }
- public void deleteH5multifile() {
- _deleteMultiFile();
- }
+ public void deleteH5multifile() { _deleteMultiFile(); }
@Before
- public void createFileAccess()
- throws NullPointerException, HDF5Exception {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void createFileAccess() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
@@ -283,9 +317,9 @@ public class TestH5Pfapl {
}
assertTrue(plapl_id > 0);
try {
- plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER);
+ plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER);
btplist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER);
- dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS);
+ dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS);
}
catch (Throwable err) {
err.printStackTrace();
@@ -297,34 +331,76 @@ public class TestH5Pfapl {
}
@After
- public void deleteFileAccess() throws HDF5LibraryException {
+ public void deleteFileAccess() throws HDF5LibraryException
+ {
if (fapl_id > 0)
- try {H5.H5Pclose(fapl_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(fapl_id);
+ }
+ catch (Exception ex) {
+ }
if (plapl_id > 0)
- try {H5.H5Pclose(plapl_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(plapl_id);
+ }
+ catch (Exception ex) {
+ }
if (dapl_id > 0)
- try {H5.H5Pclose(dapl_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(dapl_id);
+ }
+ catch (Exception ex) {
+ }
if (plist_id > 0)
- try {H5.H5Pclose(plist_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(plist_id);
+ }
+ catch (Exception ex) {
+ }
if (btplist_id > 0)
- try {H5.H5Pclose(btplist_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(btplist_id);
+ }
+ catch (Exception ex) {
+ }
if (H5Fdsid > 0)
- try {H5.H5Sclose(H5Fdsid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5Fdsid);
+ }
+ catch (Exception ex) {
+ }
if (H5Fdid > 0)
- try {H5.H5Dclose(H5Fdid);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5Fdid);
+ }
+ catch (Exception ex) {
+ }
if (H5dsid > 0)
- try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid);
+ }
+ 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) {
+ }
System.out.println();
}
@Test
- public void testH5Pget_libver_bounds() {
- int ret_val = -1;
+ public void testH5Pget_libver_bounds()
+ {
+ int ret_val = -1;
int[] libver = new int[2];
try {
@@ -342,11 +418,12 @@ public class TestH5Pfapl {
}
@Test
- public void testH5Pset_libver_bounds() {
+ public void testH5Pset_libver_bounds()
+ {
- int ret_val = -1;
- int low = HDF5Constants.H5F_LIBVER_EARLIEST;
- int high = HDF5Constants.H5F_LIBVER_LATEST;
+ int ret_val = -1;
+ int low = HDF5Constants.H5F_LIBVER_EARLIEST;
+ int high = HDF5Constants.H5F_LIBVER_LATEST;
int[] libver = new int[2];
try {
@@ -365,15 +442,17 @@ public class TestH5Pfapl {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Pset_elink_fapl_NegativeID() throws Throwable {
- H5.H5Pset_elink_fapl(-1, fapl_id );
+ public void testH5Pset_elink_fapl_NegativeID() throws Throwable
+ {
+ H5.H5Pset_elink_fapl(-1, fapl_id);
}
@Test
- public void testH5Pset_elink_fapl() {
+ public void testH5Pset_elink_fapl()
+ {
int ret_val = -1;
try {
- ret_val = H5.H5Pset_elink_fapl(plapl_id, fapl_id );
+ ret_val = H5.H5Pset_elink_fapl(plapl_id, fapl_id);
}
catch (Throwable err) {
err.printStackTrace();
@@ -383,12 +462,13 @@ public class TestH5Pfapl {
}
@Test
- public void testH5Pget_elink_fapl() {
+ public void testH5Pget_elink_fapl()
+ {
long ret_val_id = HDF5Constants.H5I_INVALID_HID;
try {
ret_val_id = H5.H5Pget_elink_fapl(plapl_id);
assertTrue("H5Pget_elink_fapl", ret_val_id >= 0);
- assertEquals(HDF5Constants.H5P_DEFAULT, ret_val_id );
+ assertEquals(HDF5Constants.H5P_DEFAULT, ret_val_id);
}
catch (Throwable err) {
err.printStackTrace();
@@ -396,15 +476,20 @@ public class TestH5Pfapl {
}
finally {
if (ret_val_id > 0)
- try {H5.H5Pclose(ret_val_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(ret_val_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5P_elink_fapl() {
+ public void testH5P_elink_fapl()
+ {
long ret_val_id = HDF5Constants.H5I_INVALID_HID;
try {
- H5.H5Pset_elink_fapl(plapl_id, fapl_id );
+ H5.H5Pset_elink_fapl(plapl_id, fapl_id);
ret_val_id = H5.H5Pget_elink_fapl(plapl_id);
assertTrue("H5P_elink_fapl", ret_val_id >= 0);
}
@@ -414,16 +499,21 @@ public class TestH5Pfapl {
}
finally {
if (ret_val_id > 0)
- try {H5.H5Pclose(ret_val_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(ret_val_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5P_elink_file_cache_size() {
+ public void testH5P_elink_file_cache_size()
+ {
long elink_fapl_id = HDF5Constants.H5I_INVALID_HID;
- int efc_size = 0;
+ int efc_size = 0;
try {
- H5.H5Pset_elink_fapl(plapl_id, fapl_id );
+ H5.H5Pset_elink_fapl(plapl_id, fapl_id);
elink_fapl_id = H5.H5Pget_elink_fapl(plapl_id);
assertTrue("H5P_elink_file_cache_size", elink_fapl_id >= 0);
try {
@@ -449,15 +539,20 @@ public class TestH5Pfapl {
}
finally {
if (elink_fapl_id > 0)
- try {H5.H5Pclose(elink_fapl_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(elink_fapl_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5P_btree_ratios() {
- double[] left = {0.1};
+ public void testH5P_btree_ratios()
+ {
+ double[] left = {0.1};
double[] middle = {0.5};
- double[] right = {0.7};
+ double[] right = {0.7};
try {
H5.H5Pset_btree_ratios(plist_id, left[0], middle[0], right[0]);
H5.H5Pget_btree_ratios(plist_id, left, middle, right);
@@ -470,7 +565,8 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_edc_check() {
+ public void testH5P_edc_check()
+ {
int ret_val_id = -1;
try {
ret_val_id = H5.H5Pget_edc_check(plist_id);
@@ -486,7 +582,8 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_fclose_degree() {
+ public void testH5P_fclose_degree()
+ {
int ret_val_id = -1;
try {
ret_val_id = H5.H5Pget_fclose_degree(fapl_id);
@@ -517,8 +614,9 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_alignment() {
- long[] align = {0,0};
+ public void testH5P_alignment()
+ {
+ long[] align = {0, 0};
try {
H5.H5Pget_alignment(fapl_id, align);
assertTrue("H5P_alignment threshold default", align[0] == 1);
@@ -543,7 +641,8 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_meta_block_size() {
+ public void testH5P_meta_block_size()
+ {
long meta_size = 0;
try {
meta_size = H5.H5Pget_meta_block_size(fapl_id);
@@ -566,7 +665,8 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_small_data_block_size() {
+ public void testH5P_small_data_block_size()
+ {
long align = 0;
try {
align = H5.H5Pget_small_data_block_size(fapl_id);
@@ -589,7 +689,8 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_hyper_vector_size() {
+ public void testH5P_hyper_vector_size()
+ {
long[] align = {0};
try {
H5.H5Pget_hyper_vector_size(plist_id, align);
@@ -612,14 +713,15 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_cache() {
+ public void testH5P_cache()
+ {
long[] rdcc_nelmts = {0};
long[] rdcc_nbytes = {0};
- double[] rdcc_w0 = {0};
+ double[] rdcc_w0 = {0};
try {
H5.H5Pget_cache(fapl_id, null, rdcc_nelmts, rdcc_nbytes, rdcc_w0);
assertTrue("H5P_cache default", rdcc_nelmts[0] == 521);
- assertTrue("H5P_cache default", rdcc_nbytes[0] == (1024*1024));
+ assertTrue("H5P_cache default", rdcc_nbytes[0] == (1024 * 1024));
assertTrue("H5P_cache default", rdcc_w0[0] == 0.75);
}
catch (Throwable err) {
@@ -639,14 +741,15 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_chunk_cache() {
+ public void testH5P_chunk_cache()
+ {
long[] rdcc_nslots = {0};
long[] rdcc_nbytes = {0};
- double[] rdcc_w0 = {0};
+ double[] rdcc_w0 = {0};
try {
H5.H5Pget_chunk_cache(dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0);
assertTrue("H5P_chunk_cache default", rdcc_nslots[0] == 521);
- assertTrue("H5P_chunk_cache default", rdcc_nbytes[0] == (1024*1024));
+ assertTrue("H5P_chunk_cache default", rdcc_nbytes[0] == (1024 * 1024));
assertTrue("H5P_chunk_cache default", rdcc_w0[0] == 0.75);
}
catch (Throwable err) {
@@ -666,11 +769,12 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_sieve_buf_size() {
+ public void testH5P_sieve_buf_size()
+ {
long buf_size = 0;
try {
buf_size = H5.H5Pget_sieve_buf_size(fapl_id);
- assertTrue("H5P_sieve_buf_size default", buf_size == (64*1024));
+ assertTrue("H5P_sieve_buf_size default", buf_size == (64 * 1024));
}
catch (Throwable err) {
err.printStackTrace();
@@ -689,7 +793,8 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_gc_references() {
+ public void testH5P_gc_references()
+ {
boolean ret_val_id = false;
try {
H5.H5Pset_gc_references(fapl_id, true);
@@ -703,11 +808,13 @@ public class TestH5Pfapl {
}
@Test
- public void testH5Pget_mdc_config() {
+ public void testH5Pget_mdc_config()
+ {
H5AC_cache_config_t cache_config = null;
try {
cache_config = H5.H5Pget_mdc_config(fapl_id);
- assertTrue("H5Pget_mdc_config", cache_config.version==HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION);
+ assertTrue("H5Pget_mdc_config",
+ cache_config.version == HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION);
}
catch (Throwable err) {
err.printStackTrace();
@@ -716,11 +823,13 @@ public class TestH5Pfapl {
}
@Test
- public void testH5Pset_mdc_config() {
+ public void testH5Pset_mdc_config()
+ {
H5AC_cache_config_t cache_config = null;
try {
cache_config = H5.H5Pget_mdc_config(fapl_id);
- assertTrue("H5Pset_mdc_config", cache_config.version==HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION);
+ assertTrue("H5Pset_mdc_config",
+ cache_config.version == HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION);
}
catch (Throwable err) {
err.printStackTrace();
@@ -730,8 +839,9 @@ public class TestH5Pfapl {
cache_config.decr_mode = HDF5Constants.H5C_decr_off;
H5.H5Pset_mdc_config(fapl_id, cache_config);
cache_config = H5.H5Pget_mdc_config(fapl_id);
- assertTrue("H5Pset_mdc_config", cache_config.version==HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION);
- assertTrue("H5Pset_mdc_config", cache_config.decr_mode==HDF5Constants.H5C_decr_off);
+ assertTrue("H5Pset_mdc_config",
+ cache_config.version == HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION);
+ assertTrue("H5Pset_mdc_config", cache_config.decr_mode == HDF5Constants.H5C_decr_off);
}
catch (Throwable err) {
err.printStackTrace();
@@ -740,24 +850,25 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_fapl_core() {
+ public void testH5P_fapl_core()
+ {
if (HDF5Constants.H5FD_CORE < 0)
return;
try {
H5.H5Pset_fapl_core(fapl_id, 4096, false);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: core = "+ driver_type, HDF5Constants.H5FD_CORE==driver_type);
+ assertTrue("H5Pget_driver: core = " + driver_type, HDF5Constants.H5FD_CORE == driver_type);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5Pset_fapl_core: " + err);
}
try {
- long[] increment = {-1};
+ long[] increment = {-1};
boolean[] backingstore = {true};
H5.H5Pget_fapl_core(fapl_id, increment, backingstore);
- assertTrue("H5Pget_fapl_core: increment="+increment[0], increment[0]==4096);
- assertTrue("H5Pget_fapl_core: backingstore="+backingstore[0], !backingstore[0]);
+ assertTrue("H5Pget_fapl_core: increment=" + increment[0], increment[0] == 4096);
+ assertTrue("H5Pget_fapl_core: backingstore=" + backingstore[0], !backingstore[0]);
}
catch (Throwable err) {
err.printStackTrace();
@@ -766,13 +877,14 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_fapl_family() {
+ public void testH5P_fapl_family()
+ {
if (HDF5Constants.H5FD_FAMILY < 0)
return;
try {
H5.H5Pset_fapl_family(fapl_id, 1024, HDF5Constants.H5P_DEFAULT);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: family = "+ driver_type, HDF5Constants.H5FD_FAMILY==driver_type);
+ assertTrue("H5Pget_driver: family = " + driver_type, HDF5Constants.H5FD_FAMILY == driver_type);
}
catch (Throwable err) {
err.printStackTrace();
@@ -782,8 +894,9 @@ public class TestH5Pfapl {
long[] member_size = {0};
long[] member_fapl = {-1};
H5.H5Pget_fapl_family(fapl_id, member_size, member_fapl);
- assertTrue("H5Pget_fapl_family: member_size="+member_size[0], member_size[0]==1024);
- assertTrue("H5Pget_fapl_family: member_fapl ", H5.H5P_equal(member_fapl[0], HDF5Constants.H5P_FILE_ACCESS_DEFAULT));
+ assertTrue("H5Pget_fapl_family: member_size=" + member_size[0], member_size[0] == 1024);
+ assertTrue("H5Pget_fapl_family: member_fapl ",
+ H5.H5P_equal(member_fapl[0], HDF5Constants.H5P_FILE_ACCESS_DEFAULT));
}
catch (Throwable err) {
err.printStackTrace();
@@ -794,13 +907,14 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_family_offset() {
+ public void testH5P_family_offset()
+ {
if (HDF5Constants.H5FD_FAMILY < 0)
return;
try {
H5.H5Pset_fapl_family(fapl_id, 1024, HDF5Constants.H5P_DEFAULT);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: family = "+ driver_type, HDF5Constants.H5FD_FAMILY==driver_type);
+ assertTrue("H5Pget_driver: family = " + driver_type, HDF5Constants.H5FD_FAMILY == driver_type);
}
catch (Throwable err) {
err.printStackTrace();
@@ -817,7 +931,7 @@ public class TestH5Pfapl {
}
try {
long offset = H5.H5Pget_family_offset(fapl_id);
- assertTrue("H5Pget_fapl_family: offset="+offset, offset==family_offset);
+ assertTrue("H5Pget_fapl_family: offset=" + offset, offset == family_offset);
}
catch (Throwable err) {
err.printStackTrace();
@@ -827,13 +941,14 @@ public class TestH5Pfapl {
}
@Test
- public void testH5Pset_fapl_sec2() {
+ public void testH5Pset_fapl_sec2()
+ {
if (HDF5Constants.H5FD_SEC2 < 0)
return;
try {
H5.H5Pset_fapl_sec2(fapl_id);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: sec2 = "+ driver_type, HDF5Constants.H5FD_SEC2==driver_type);
+ assertTrue("H5Pget_driver: sec2 = " + driver_type, HDF5Constants.H5FD_SEC2 == driver_type);
}
catch (Throwable err) {
err.printStackTrace();
@@ -844,13 +959,14 @@ public class TestH5Pfapl {
}
@Test
- public void testH5Pset_fapl_stdio() {
+ public void testH5Pset_fapl_stdio()
+ {
if (HDF5Constants.H5FD_STDIO < 0)
return;
try {
H5.H5Pset_fapl_stdio(fapl_id);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: stdio = "+ driver_type, HDF5Constants.H5FD_STDIO==driver_type);
+ assertTrue("H5Pget_driver: stdio = " + driver_type, HDF5Constants.H5FD_STDIO == driver_type);
}
catch (Throwable err) {
err.printStackTrace();
@@ -861,14 +977,15 @@ public class TestH5Pfapl {
}
@Test
- public void testH5Pset_fapl_log() {
+ public void testH5Pset_fapl_log()
+ {
if (HDF5Constants.H5FD_LOG < 0)
return;
try {
long log_flags = HDF5Constants.H5FD_LOG_LOC_IO;
H5.H5Pset_fapl_log(fapl_id, H5_LOG_FILE, log_flags, 1024);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: log = "+ driver_type, HDF5Constants.H5FD_LOG==driver_type);
+ assertTrue("H5Pget_driver: log = " + driver_type, HDF5Constants.H5FD_LOG == driver_type);
}
catch (Throwable err) {
err.printStackTrace();
@@ -880,19 +997,20 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_fapl_muti_nulls() {
+ public void testH5P_fapl_muti_nulls()
+ {
if (HDF5Constants.H5FD_MULTI < 0)
return;
- int[] member_map = null;
- long[] member_fapl = null;
+ int[] member_map = null;
+ long[] member_fapl = null;
String[] member_name = null;
- long[] member_addr = null;
+ long[] member_addr = null;
try {
H5.H5Pset_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr, true);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: multi = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type);
+ assertTrue("H5Pget_driver: multi = " + driver_type, HDF5Constants.H5FD_MULTI == driver_type);
}
catch (Throwable err) {
err.printStackTrace();
@@ -911,53 +1029,68 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_fapl_muti_defaults() {
+ public void testH5P_fapl_muti_defaults()
+ {
if (HDF5Constants.H5FD_MULTI < 0)
return;
int H5FD_MEM_NTYPES = HDF5Constants.H5FD_MEM_NTYPES; // 7
long sH5FD_MEM_DEFAULT_HADDR = HDF5Constants.H5FD_DEFAULT_HADDR_SIZE;
- long sH5FD_MEM_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_SIZE;
- long sH5FD_MEM_SUPER_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_SUPER_SIZE;
- long sH5FD_MEM_BTREE_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_BTREE_SIZE;
- long sH5FD_MEM_DRAW_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_DRAW_SIZE;
- long sH5FD_MEM_GHEAP_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_GHEAP_SIZE;
- long sH5FD_MEM_LHEAP_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_LHEAP_SIZE;
- long sH5FD_MEM_OHDR_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_OHDR_SIZE;
- int[] member_map = null;
- long[] member_fapl = null;
- String[] member_name = null;
- long[] member_addr = null;
+ long sH5FD_MEM_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_SIZE;
+ long sH5FD_MEM_SUPER_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_SUPER_SIZE;
+ long sH5FD_MEM_BTREE_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_BTREE_SIZE;
+ long sH5FD_MEM_DRAW_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_DRAW_SIZE;
+ long sH5FD_MEM_GHEAP_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_GHEAP_SIZE;
+ long sH5FD_MEM_LHEAP_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_LHEAP_SIZE;
+ long sH5FD_MEM_OHDR_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_OHDR_SIZE;
+ int[] member_map = null;
+ long[] member_fapl = null;
+ String[] member_name = null;
+ long[] member_addr = null;
try {
H5.H5Pset_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr, true);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: multi = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type);
+ assertTrue("H5Pget_driver: multi = " + driver_type, HDF5Constants.H5FD_MULTI == driver_type);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5Pset_fapl_muti: " + err);
}
try {
- member_map = new int[HDF5Constants.H5FD_MEM_NTYPES];
- member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES];
- member_name = new String[HDF5Constants.H5FD_MEM_NTYPES];
- member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES];
+ member_map = new int[HDF5Constants.H5FD_MEM_NTYPES];
+ member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES];
+ member_name = new String[HDF5Constants.H5FD_MEM_NTYPES];
+ member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES];
boolean relax = H5.H5Pget_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr);
assertTrue("H5Pget_fapl_muti: relax ", relax);
- assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_DEFAULT], member_map[HDF5Constants.H5FD_MEM_DEFAULT] == HDF5Constants.H5FD_MEM_DEFAULT);
- assertTrue("H5Pget_fapl_muti: member_fapl ", H5.H5P_equal(member_fapl[HDF5Constants.H5FD_MEM_DEFAULT], HDF5Constants.H5P_FILE_ACCESS_DEFAULT));
- assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_DEFAULT], member_name[HDF5Constants.H5FD_MEM_DEFAULT].compareTo("%s-X.h5")==0);
- assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_SUPER], member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-s.h5")==0);
- assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_BTREE], member_name[HDF5Constants.H5FD_MEM_BTREE].compareTo("%s-b.h5")==0);
- assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_DRAW], member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-r.h5")==0);
- assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_DEFAULT], member_addr[HDF5Constants.H5FD_MEM_DEFAULT] == sH5FD_MEM_HADDR);
- assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_SUPER], member_addr[HDF5Constants.H5FD_MEM_SUPER] == sH5FD_MEM_SUPER_HADDR);
- assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_BTREE], member_addr[HDF5Constants.H5FD_MEM_BTREE] == sH5FD_MEM_BTREE_HADDR);
- assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_DRAW], member_addr[HDF5Constants.H5FD_MEM_DRAW] == sH5FD_MEM_DRAW_HADDR);
- assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_GHEAP], member_addr[HDF5Constants.H5FD_MEM_GHEAP] == sH5FD_MEM_GHEAP_HADDR);
- assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_LHEAP], member_addr[HDF5Constants.H5FD_MEM_LHEAP] == sH5FD_MEM_LHEAP_HADDR);
- assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_OHDR], member_addr[HDF5Constants.H5FD_MEM_OHDR] == sH5FD_MEM_OHDR_HADDR);
+ assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_DEFAULT],
+ member_map[HDF5Constants.H5FD_MEM_DEFAULT] == HDF5Constants.H5FD_MEM_DEFAULT);
+ assertTrue("H5Pget_fapl_muti: member_fapl ",
+ H5.H5P_equal(member_fapl[HDF5Constants.H5FD_MEM_DEFAULT],
+ HDF5Constants.H5P_FILE_ACCESS_DEFAULT));
+ assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_DEFAULT],
+ member_name[HDF5Constants.H5FD_MEM_DEFAULT].compareTo("%s-X.h5") == 0);
+ assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_SUPER],
+ member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-s.h5") == 0);
+ assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_BTREE],
+ member_name[HDF5Constants.H5FD_MEM_BTREE].compareTo("%s-b.h5") == 0);
+ assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_DRAW],
+ member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-r.h5") == 0);
+ assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_DEFAULT],
+ member_addr[HDF5Constants.H5FD_MEM_DEFAULT] == sH5FD_MEM_HADDR);
+ assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_SUPER],
+ member_addr[HDF5Constants.H5FD_MEM_SUPER] == sH5FD_MEM_SUPER_HADDR);
+ assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_BTREE],
+ member_addr[HDF5Constants.H5FD_MEM_BTREE] == sH5FD_MEM_BTREE_HADDR);
+ assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_DRAW],
+ member_addr[HDF5Constants.H5FD_MEM_DRAW] == sH5FD_MEM_DRAW_HADDR);
+ assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_GHEAP],
+ member_addr[HDF5Constants.H5FD_MEM_GHEAP] == sH5FD_MEM_GHEAP_HADDR);
+ assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_LHEAP],
+ member_addr[HDF5Constants.H5FD_MEM_LHEAP] == sH5FD_MEM_LHEAP_HADDR);
+ assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_OHDR],
+ member_addr[HDF5Constants.H5FD_MEM_OHDR] == sH5FD_MEM_OHDR_HADDR);
}
catch (Throwable err) {
err.printStackTrace();
@@ -969,20 +1102,21 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_fapl_muti() {
+ public void testH5P_fapl_muti()
+ {
if (HDF5Constants.H5FD_MULTI < 0)
return;
long HADDR_DEFAULT_SIZE = HDF5Constants.H5FD_DEFAULT_HADDR_SIZE;
- int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES];
- long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES];
- String[] member_name = new String[HDF5Constants.H5FD_MEM_NTYPES];
- long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES];
+ int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES];
+ long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES];
+ String[] member_name = new String[HDF5Constants.H5FD_MEM_NTYPES];
+ long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES];
- for(int mt=HDF5Constants.H5FD_MEM_DEFAULT; mt<HDF5Constants.H5FD_MEM_NTYPES; mt++) {
+ for (int mt = HDF5Constants.H5FD_MEM_DEFAULT; mt < HDF5Constants.H5FD_MEM_NTYPES; mt++) {
member_fapl[mt] = HDF5Constants.H5P_DEFAULT;
- member_map[mt] = HDF5Constants.H5FD_MEM_SUPER;
+ member_map[mt] = HDF5Constants.H5FD_MEM_SUPER;
}
- member_map[HDF5Constants.H5FD_MEM_DRAW] = HDF5Constants.H5FD_MEM_DRAW;
+ member_map[HDF5Constants.H5FD_MEM_DRAW] = HDF5Constants.H5FD_MEM_DRAW;
member_map[HDF5Constants.H5FD_MEM_BTREE] = HDF5Constants.H5FD_MEM_BTREE;
member_map[HDF5Constants.H5FD_MEM_GHEAP] = HDF5Constants.H5FD_MEM_GHEAP;
@@ -990,18 +1124,18 @@ public class TestH5Pfapl {
member_addr[HDF5Constants.H5FD_MEM_SUPER] = 0;
member_name[HDF5Constants.H5FD_MEM_BTREE] = new String("%s-btree.h5");
- member_addr[HDF5Constants.H5FD_MEM_BTREE] = HADDR_DEFAULT_SIZE/4;
+ member_addr[HDF5Constants.H5FD_MEM_BTREE] = HADDR_DEFAULT_SIZE / 4;
member_name[HDF5Constants.H5FD_MEM_DRAW] = new String("%s-draw.h5");
- member_addr[HDF5Constants.H5FD_MEM_DRAW] = HADDR_DEFAULT_SIZE/2;
+ member_addr[HDF5Constants.H5FD_MEM_DRAW] = HADDR_DEFAULT_SIZE / 2;
member_name[HDF5Constants.H5FD_MEM_GHEAP] = new String("%s-gheap.h5");
- member_addr[HDF5Constants.H5FD_MEM_GHEAP] = (HADDR_DEFAULT_SIZE/4)*3;
+ member_addr[HDF5Constants.H5FD_MEM_GHEAP] = (HADDR_DEFAULT_SIZE / 4) * 3;
try {
H5.H5Pset_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr, true);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: multi = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type);
+ assertTrue("H5Pget_driver: multi = " + driver_type, HDF5Constants.H5FD_MULTI == driver_type);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1010,23 +1144,37 @@ public class TestH5Pfapl {
try {
boolean relax = H5.H5Pget_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr);
assertTrue("H5Pget_fapl_muti: relax ", relax);
- assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_DEFAULT], member_map[HDF5Constants.H5FD_MEM_DEFAULT] == HDF5Constants.H5FD_MEM_SUPER);
- assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_DRAW], member_map[HDF5Constants.H5FD_MEM_DRAW] == HDF5Constants.H5FD_MEM_DRAW);
- assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_BTREE], member_map[HDF5Constants.H5FD_MEM_BTREE] == HDF5Constants.H5FD_MEM_BTREE);
- assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_GHEAP], member_map[HDF5Constants.H5FD_MEM_GHEAP] == HDF5Constants.H5FD_MEM_GHEAP);
-
- assertTrue("H5Pget_fapl_muti: member_fapl ", H5.H5P_equal(member_fapl[HDF5Constants.H5FD_MEM_DEFAULT], HDF5Constants.H5P_FILE_ACCESS_DEFAULT));
- assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_DEFAULT], member_addr[HDF5Constants.H5FD_MEM_DEFAULT] == 0);
- assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_SUPER], member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-super.h5")==0);
-
- assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_BTREE], member_name[HDF5Constants.H5FD_MEM_BTREE].compareTo("%s-btree.h5")==0);
- assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_BTREE], member_addr[HDF5Constants.H5FD_MEM_BTREE] == HADDR_DEFAULT_SIZE/4);
-
- assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_DRAW], member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-draw.h5")==0);
- assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_DRAW], member_addr[HDF5Constants.H5FD_MEM_DRAW] == HADDR_DEFAULT_SIZE/2);
-
- assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_GHEAP], member_name[HDF5Constants.H5FD_MEM_GHEAP].compareTo("%s-gheap.h5")==0);
- assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_GHEAP], member_addr[HDF5Constants.H5FD_MEM_GHEAP] == (HADDR_DEFAULT_SIZE/4)*3);
+ assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_DEFAULT],
+ member_map[HDF5Constants.H5FD_MEM_DEFAULT] == HDF5Constants.H5FD_MEM_SUPER);
+ assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_DRAW],
+ member_map[HDF5Constants.H5FD_MEM_DRAW] == HDF5Constants.H5FD_MEM_DRAW);
+ assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_BTREE],
+ member_map[HDF5Constants.H5FD_MEM_BTREE] == HDF5Constants.H5FD_MEM_BTREE);
+ assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_GHEAP],
+ member_map[HDF5Constants.H5FD_MEM_GHEAP] == HDF5Constants.H5FD_MEM_GHEAP);
+
+ assertTrue("H5Pget_fapl_muti: member_fapl ",
+ H5.H5P_equal(member_fapl[HDF5Constants.H5FD_MEM_DEFAULT],
+ HDF5Constants.H5P_FILE_ACCESS_DEFAULT));
+ assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_DEFAULT],
+ member_addr[HDF5Constants.H5FD_MEM_DEFAULT] == 0);
+ assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_SUPER],
+ member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-super.h5") == 0);
+
+ assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_BTREE],
+ member_name[HDF5Constants.H5FD_MEM_BTREE].compareTo("%s-btree.h5") == 0);
+ assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_BTREE],
+ member_addr[HDF5Constants.H5FD_MEM_BTREE] == HADDR_DEFAULT_SIZE / 4);
+
+ assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_DRAW],
+ member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-draw.h5") == 0);
+ assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_DRAW],
+ member_addr[HDF5Constants.H5FD_MEM_DRAW] == HADDR_DEFAULT_SIZE / 2);
+
+ assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_GHEAP],
+ member_name[HDF5Constants.H5FD_MEM_GHEAP].compareTo("%s-gheap.h5") == 0);
+ assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_GHEAP],
+ member_addr[HDF5Constants.H5FD_MEM_GHEAP] == (HADDR_DEFAULT_SIZE / 4) * 3);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1035,7 +1183,8 @@ public class TestH5Pfapl {
_createH5multiFile(fapl_id);
try {
long file_size = H5.H5Fget_filesize(H5fid);
- assertTrue("H5Pget_fapl_muti: file_size ", file_size >= HADDR_DEFAULT_SIZE/4 || file_size <= HADDR_DEFAULT_SIZE/2);
+ assertTrue("H5Pget_fapl_muti: file_size ",
+ file_size >= HADDR_DEFAULT_SIZE / 4 || file_size <= HADDR_DEFAULT_SIZE / 2);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1043,67 +1192,71 @@ public class TestH5Pfapl {
}
_createH5multiFileDS();
deleteH5multifile();
- File file = new File(H5_MULTI_FILE+"-super.h5");
+ File file = new File(H5_MULTI_FILE + "-super.h5");
if (file.exists()) {
try {
file.delete();
}
catch (SecurityException e) {
- ;// e.printStackTrace();
+ ; // e.printStackTrace();
}
}
- file = new File(H5_MULTI_FILE+"-btree.h5");
+ file = new File(H5_MULTI_FILE + "-btree.h5");
if (file.exists()) {
try {
file.delete();
}
catch (SecurityException e) {
- ;// e.printStackTrace();
+ ; // e.printStackTrace();
}
}
- file = new File(H5_MULTI_FILE+"-draw.h5");
+ file = new File(H5_MULTI_FILE + "-draw.h5");
if (file.exists()) {
try {
file.delete();
}
catch (SecurityException e) {
- ;// e.printStackTrace();
+ ; // e.printStackTrace();
}
}
- file = new File(H5_MULTI_FILE+"-gheap.h5");
+ file = new File(H5_MULTI_FILE + "-gheap.h5");
if (file.exists()) {
try {
file.delete();
}
catch (SecurityException e) {
- ;// e.printStackTrace();
+ ; // e.printStackTrace();
}
}
}
@Test
- public void testH5P_fapl_split() {
+ public void testH5P_fapl_split()
+ {
if (HDF5Constants.H5FD_MULTI < 0)
return;
try {
- H5.H5Pset_fapl_split(fapl_id, "-meta.h5", HDF5Constants.H5P_DEFAULT, "-raw.h5", HDF5Constants.H5P_DEFAULT);
+ H5.H5Pset_fapl_split(fapl_id, "-meta.h5", HDF5Constants.H5P_DEFAULT, "-raw.h5",
+ HDF5Constants.H5P_DEFAULT);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: split = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type);
+ assertTrue("H5Pget_driver: split = " + driver_type, HDF5Constants.H5FD_MULTI == driver_type);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5Pset_fapl_split: " + err);
}
try {
- int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES];
- long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES];
+ int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES];
+ long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES];
String[] member_name = new String[HDF5Constants.H5FD_MEM_NTYPES];
- long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES];
+ long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES];
boolean relax = H5.H5Pget_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr);
assertTrue("H5Pget_fapl_multi: relax ", relax);
- assertTrue("H5Pget_fapl_multi: member_name="+member_name[HDF5Constants.H5FD_MEM_SUPER], member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-meta.h5")==0);
- assertTrue("H5Pget_fapl_multi: member_name="+member_name[HDF5Constants.H5FD_MEM_DRAW], member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-raw.h5")==0);
+ assertTrue("H5Pget_fapl_multi: member_name=" + member_name[HDF5Constants.H5FD_MEM_SUPER],
+ member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-meta.h5") == 0);
+ assertTrue("H5Pget_fapl_multi: member_name=" + member_name[HDF5Constants.H5FD_MEM_DRAW],
+ member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-raw.h5") == 0);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1111,34 +1264,35 @@ public class TestH5Pfapl {
}
_createH5multiFile(fapl_id);
deleteH5multifile();
- File file = new File(H5_MULTI_FILE+"-meta.h5");
+ File file = new File(H5_MULTI_FILE + "-meta.h5");
if (file.exists()) {
try {
file.delete();
}
catch (SecurityException e) {
- ;// e.printStackTrace();
+ ; // e.printStackTrace();
}
}
- file = new File(H5_MULTI_FILE+"-raw.h5");
+ file = new File(H5_MULTI_FILE + "-raw.h5");
if (file.exists()) {
try {
file.delete();
}
catch (SecurityException e) {
- ;// e.printStackTrace();
+ ; // e.printStackTrace();
}
}
}
@Test
- public void testH5P_fapl_direct() {
+ public void testH5P_fapl_direct()
+ {
if (HDF5Constants.H5FD_DIRECT < 0)
return;
try {
- H5.H5Pset_fapl_direct(fapl_id, 1024, 4096, 8*4096);
+ H5.H5Pset_fapl_direct(fapl_id, 1024, 4096, 8 * 4096);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: direct = "+ driver_type, HDF5Constants.H5FD_DIRECT==driver_type);
+ assertTrue("H5Pget_driver: direct = " + driver_type, HDF5Constants.H5FD_DIRECT == driver_type);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1147,9 +1301,9 @@ public class TestH5Pfapl {
try {
long[] params = {-1, -1, -1};
H5.H5Pget_fapl_direct(fapl_id, params);
- assertTrue("H5Pget_fapl_direct: alignment="+params[0], params[0]==1024);
- assertTrue("H5Pget_fapl_direct: block_size="+params[1], params[1]==4096);
- assertTrue("H5Pget_fapl_direct: cbuf_size="+params[2], params[2]==8*4096);
+ assertTrue("H5Pget_fapl_direct: alignment=" + params[0], params[0] == 1024);
+ assertTrue("H5Pget_fapl_direct: block_size=" + params[1], params[1] == 4096);
+ assertTrue("H5Pget_fapl_direct: cbuf_size=" + params[2], params[2] == 8 * 4096);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1160,13 +1314,14 @@ public class TestH5Pfapl {
}
@Test
- public void testH5Pset_fapl_windows() {
+ public void testH5Pset_fapl_windows()
+ {
if (HDF5Constants.H5FD_WINDOWS < 0)
return;
try {
H5.H5Pset_fapl_windows(fapl_id);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: windows = "+ driver_type, HDF5Constants.H5FD_WINDOWS==driver_type);
+ assertTrue("H5Pget_driver: windows = " + driver_type, HDF5Constants.H5FD_WINDOWS == driver_type);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1177,19 +1332,20 @@ public class TestH5Pfapl {
}
@Test
- public void testH5Pmulti_transform() {
+ public void testH5Pmulti_transform()
+ {
if (HDF5Constants.H5FD_MULTI < 0)
return;
- String f_to_c = "(5/9.0)*(x-32)";
+ String f_to_c = "(5/9.0)*(x-32)";
double windchillFread[][] = new double[DIMF_X][DIMF_Y];
double windchillC;
NumberFormat formatter = new DecimalFormat("#0.000");
- long HADDRMAX = HDF5Constants.H5FD_DEFAULT_HADDR_SIZE;
+ long HADDRMAX = HDF5Constants.H5FD_DEFAULT_HADDR_SIZE;
- int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES];
- long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES];
+ int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES];
+ long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES];
String[] member_name = new String[HDF5Constants.H5FD_MEM_NTYPES];
- long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES];
+ long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES];
try {
H5.H5Pset_data_transform(plist_id, f_to_c);
@@ -1200,11 +1356,11 @@ public class TestH5Pfapl {
fail("H5Pdata_transform: " + err);
}
- for(int mt=HDF5Constants.H5FD_MEM_DEFAULT; mt<HDF5Constants.H5FD_MEM_NTYPES; mt++) {
+ for (int mt = HDF5Constants.H5FD_MEM_DEFAULT; mt < HDF5Constants.H5FD_MEM_NTYPES; mt++) {
member_fapl[mt] = HDF5Constants.H5P_DEFAULT;
- member_map[mt] = HDF5Constants.H5FD_MEM_SUPER;
+ member_map[mt] = HDF5Constants.H5FD_MEM_SUPER;
}
- member_map[HDF5Constants.H5FD_MEM_DRAW] = HDF5Constants.H5FD_MEM_DRAW;
+ member_map[HDF5Constants.H5FD_MEM_DRAW] = HDF5Constants.H5FD_MEM_DRAW;
member_map[HDF5Constants.H5FD_MEM_BTREE] = HDF5Constants.H5FD_MEM_BTREE;
member_map[HDF5Constants.H5FD_MEM_GHEAP] = HDF5Constants.H5FD_MEM_GHEAP;
@@ -1212,18 +1368,18 @@ public class TestH5Pfapl {
member_addr[HDF5Constants.H5FD_MEM_SUPER] = 0;
member_name[HDF5Constants.H5FD_MEM_BTREE] = new String("%s-btree.h5");
- member_addr[HDF5Constants.H5FD_MEM_BTREE] = HADDRMAX/4;
+ member_addr[HDF5Constants.H5FD_MEM_BTREE] = HADDRMAX / 4;
member_name[HDF5Constants.H5FD_MEM_DRAW] = new String("%s-draw.h5");
- member_addr[HDF5Constants.H5FD_MEM_DRAW] = HADDRMAX/2;
+ member_addr[HDF5Constants.H5FD_MEM_DRAW] = HADDRMAX / 2;
member_name[HDF5Constants.H5FD_MEM_GHEAP] = new String("%s-gheap.h5");
- member_addr[HDF5Constants.H5FD_MEM_GHEAP] = (HADDRMAX/4)*3;
+ member_addr[HDF5Constants.H5FD_MEM_GHEAP] = (HADDRMAX / 4) * 3;
try {
H5.H5Pset_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr, true);
long driver_type = H5.H5Pget_driver(fapl_id);
- assertTrue("H5Pget_driver: multi = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type);
+ assertTrue("H5Pget_driver: multi = " + driver_type, HDF5Constants.H5FD_MULTI == driver_type);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1232,23 +1388,37 @@ public class TestH5Pfapl {
try {
boolean relax = H5.H5Pget_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr);
assertTrue("H5Pget_fapl_muti: relax ", relax);
- assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_DEFAULT], member_map[HDF5Constants.H5FD_MEM_DEFAULT] == HDF5Constants.H5FD_MEM_SUPER);
- assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_DRAW], member_map[HDF5Constants.H5FD_MEM_DRAW] == HDF5Constants.H5FD_MEM_DRAW);
- assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_BTREE], member_map[HDF5Constants.H5FD_MEM_BTREE] == HDF5Constants.H5FD_MEM_BTREE);
- assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_GHEAP], member_map[HDF5Constants.H5FD_MEM_GHEAP] == HDF5Constants.H5FD_MEM_GHEAP);
-
- assertTrue("H5Pget_fapl_muti: member_fapl ", H5.H5P_equal(member_fapl[HDF5Constants.H5FD_MEM_DEFAULT], HDF5Constants.H5P_FILE_ACCESS_DEFAULT));
- assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_DEFAULT], member_addr[HDF5Constants.H5FD_MEM_DEFAULT] == 0);
- assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_SUPER], member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-super.h5")==0);
-
- assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_BTREE], member_name[HDF5Constants.H5FD_MEM_BTREE].compareTo("%s-btree.h5")==0);
- assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_BTREE], member_addr[HDF5Constants.H5FD_MEM_BTREE] == HADDRMAX/4);
-
- assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_DRAW], member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-draw.h5")==0);
- assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_DRAW], member_addr[HDF5Constants.H5FD_MEM_DRAW] == HADDRMAX/2);
-
- assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_GHEAP], member_name[HDF5Constants.H5FD_MEM_GHEAP].compareTo("%s-gheap.h5")==0);
- assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_GHEAP], member_addr[HDF5Constants.H5FD_MEM_GHEAP] == (HADDRMAX/4)*3);
+ assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_DEFAULT],
+ member_map[HDF5Constants.H5FD_MEM_DEFAULT] == HDF5Constants.H5FD_MEM_SUPER);
+ assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_DRAW],
+ member_map[HDF5Constants.H5FD_MEM_DRAW] == HDF5Constants.H5FD_MEM_DRAW);
+ assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_BTREE],
+ member_map[HDF5Constants.H5FD_MEM_BTREE] == HDF5Constants.H5FD_MEM_BTREE);
+ assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_GHEAP],
+ member_map[HDF5Constants.H5FD_MEM_GHEAP] == HDF5Constants.H5FD_MEM_GHEAP);
+
+ assertTrue("H5Pget_fapl_muti: member_fapl ",
+ H5.H5P_equal(member_fapl[HDF5Constants.H5FD_MEM_DEFAULT],
+ HDF5Constants.H5P_FILE_ACCESS_DEFAULT));
+ assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_DEFAULT],
+ member_addr[HDF5Constants.H5FD_MEM_DEFAULT] == 0);
+ assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_SUPER],
+ member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-super.h5") == 0);
+
+ assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_BTREE],
+ member_name[HDF5Constants.H5FD_MEM_BTREE].compareTo("%s-btree.h5") == 0);
+ assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_BTREE],
+ member_addr[HDF5Constants.H5FD_MEM_BTREE] == HADDRMAX / 4);
+
+ assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_DRAW],
+ member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-draw.h5") == 0);
+ assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_DRAW],
+ member_addr[HDF5Constants.H5FD_MEM_DRAW] == HADDRMAX / 2);
+
+ assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_GHEAP],
+ member_name[HDF5Constants.H5FD_MEM_GHEAP].compareTo("%s-gheap.h5") == 0);
+ assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_GHEAP],
+ member_addr[HDF5Constants.H5FD_MEM_GHEAP] == (HADDRMAX / 4) * 3);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1257,7 +1427,8 @@ public class TestH5Pfapl {
try {
_createH5multiFile(fapl_id);
long file_size = H5.H5Fget_filesize(H5fid);
- assertTrue("H5Pget_fapl_muti: file_size ", file_size >= HADDRMAX/4 || file_size <= HADDRMAX/2);
+ assertTrue("H5Pget_fapl_muti: file_size ",
+ file_size >= HADDRMAX / 4 || file_size <= HADDRMAX / 2);
_createH5multiFileDS();
_createFloatDataset();
}
@@ -1267,68 +1438,70 @@ public class TestH5Pfapl {
}
try {
H5.H5Dwrite(H5Fdid, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- plist_id, windchillF);
+ plist_id, windchillF);
H5.H5Dread(H5Fdid, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, windchillFread);
+ HDF5Constants.H5P_DEFAULT, windchillFread);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5Pdata_transform: " + err);
}
- for(int row = 0; row < DIMF_X; row++) {
- for(int col = 0; col < DIMF_Y; col++) {
- windchillC = (5/9.0)*(windchillF[row][col]-32);
- String Cstr = formatter.format(windchillC);
+ for (int row = 0; row < DIMF_X; row++) {
+ for (int col = 0; col < DIMF_Y; col++) {
+ windchillC = (5 / 9.0) * (windchillF[row][col] - 32);
+ String Cstr = formatter.format(windchillC);
String Fread = formatter.format(windchillFread[row][col]);
- assertTrue("H5Pdata_transform: <"+row+","+col+">"+Fread+"="+Cstr, Fread.compareTo(Cstr)==0);
+ assertTrue("H5Pdata_transform: <" + row + "," + col + ">" + Fread + "=" + Cstr,
+ Fread.compareTo(Cstr) == 0);
}
}
deleteH5multifile();
- File file = new File(H5_MULTI_FILE+"-super.h5");
+ File file = new File(H5_MULTI_FILE + "-super.h5");
if (file.exists()) {
try {
file.delete();
}
catch (SecurityException e) {
- ;// e.printStackTrace();
+ ; // e.printStackTrace();
}
}
- file = new File(H5_MULTI_FILE+"-btree.h5");
+ file = new File(H5_MULTI_FILE + "-btree.h5");
if (file.exists()) {
try {
file.delete();
}
catch (SecurityException e) {
- ;// e.printStackTrace();
+ ; // e.printStackTrace();
}
}
- file = new File(H5_MULTI_FILE+"-draw.h5");
+ file = new File(H5_MULTI_FILE + "-draw.h5");
if (file.exists()) {
try {
file.delete();
}
catch (SecurityException e) {
- ;// e.printStackTrace();
+ ; // e.printStackTrace();
}
}
- file = new File(H5_MULTI_FILE+"-gheap.h5");
+ file = new File(H5_MULTI_FILE + "-gheap.h5");
if (file.exists()) {
try {
file.delete();
}
catch (SecurityException e) {
- ;// e.printStackTrace();
+ ; // e.printStackTrace();
}
}
}
@Test
- public void testH5Fmdc_logging() {
+ public void testH5Fmdc_logging()
+ {
boolean[] mdc_logging_status = {false, false};
- boolean[] mdc_log_options = {false, false};
+ boolean[] mdc_log_options = {false, false};
try {
- boolean is_enabled = true;
+ boolean is_enabled = true;
boolean start_on_access = false;
H5.H5Pset_mdc_log_options(fapl_id, is_enabled, H5_LOG_FILE, start_on_access);
@@ -1336,7 +1509,8 @@ public class TestH5Pfapl {
assertTrue("H5.H5Pget_mdc_log_options: is_enabled", mdc_log_options[0]);
assertFalse("H5.H5Pget_mdc_log_options: start_on_access_out", mdc_log_options[1]);
- H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST);
+ H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST,
+ HDF5Constants.H5F_LIBVER_LATEST);
}
catch (Throwable err) {
err.printStackTrace();
@@ -1370,7 +1544,7 @@ public class TestH5Pfapl {
catch (Throwable err) {
fail("stop H5.H5Fget_mdc_logging_status: " + err);
}
-// assertFalse("stop: is_enabled", mdc_logging_status[0]);
+ // assertFalse("stop: is_enabled", mdc_logging_status[0]);
assertFalse("stop: is_currently_logging", mdc_logging_status[1]);
deleteH5file();
@@ -1378,7 +1552,8 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_evict_on_close() {
+ public void testH5P_evict_on_close()
+ {
boolean ret_val_id = false;
try {
H5.H5Pset_evict_on_close(fapl_id, true);
@@ -1399,20 +1574,21 @@ public class TestH5Pfapl {
}
@Test
- public void testH5P_file_locking() {
- boolean use_file_locking = false;
+ public void testH5P_file_locking()
+ {
+ boolean use_file_locking = false;
boolean ignore_disabled_file_locking = false;
try {
// false values (usually not the default)
H5.H5Pset_file_locking(fapl_id, false, false);
- use_file_locking = H5.H5Pget_use_file_locking(fapl_id);
+ use_file_locking = H5.H5Pget_use_file_locking(fapl_id);
ignore_disabled_file_locking = H5.H5Pget_ignore_disabled_file_locking(fapl_id);
assertFalse("H5P_file_locking", use_file_locking);
assertFalse("H5P_file_locking", ignore_disabled_file_locking);
// true values (typically the default)
H5.H5Pset_file_locking(fapl_id, true, true);
- use_file_locking = H5.H5Pget_use_file_locking(fapl_id);
+ use_file_locking = H5.H5Pget_use_file_locking(fapl_id);
ignore_disabled_file_locking = H5.H5Pget_ignore_disabled_file_locking(fapl_id);
assertTrue("H5P_file_locking", use_file_locking);
assertTrue("H5P_file_locking", ignore_disabled_file_locking);
diff --git a/java/test/TestH5Pfaplhdfs.java b/java/test/TestH5Pfaplhdfs.java
index d922666..e99967b 100644
--- a/java/test/TestH5Pfaplhdfs.java
+++ b/java/test/TestH5Pfaplhdfs.java
@@ -31,12 +31,13 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Pfaplhdfs {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
- long fapl_id = HDF5Constants.H5I_INVALID_HID;
- long plapl_id = HDF5Constants.H5I_INVALID_HID;
- long dapl_id = HDF5Constants.H5I_INVALID_HID;
- long plist_id = HDF5Constants.H5I_INVALID_HID;
+ long fapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plapl_id = HDF5Constants.H5I_INVALID_HID;
+ long dapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
long btplist_id = HDF5Constants.H5I_INVALID_HID;
@Before
@@ -62,9 +63,9 @@ public class TestH5Pfaplhdfs {
}
assertTrue(plapl_id > 0);
try {
- plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER);
+ plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER);
btplist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER);
- dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS);
+ dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS);
}
catch (Throwable err) {
err.printStackTrace();
@@ -79,15 +80,35 @@ public class TestH5Pfaplhdfs {
public void deleteFileAccess() throws HDF5LibraryException
{
if (fapl_id > 0)
- try {H5.H5Pclose(fapl_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(fapl_id);
+ }
+ catch (Exception ex) {
+ }
if (plapl_id > 0)
- try {H5.H5Pclose(plapl_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(plapl_id);
+ }
+ catch (Exception ex) {
+ }
if (dapl_id > 0)
- try {H5.H5Pclose(dapl_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(dapl_id);
+ }
+ catch (Exception ex) {
+ }
if (plist_id > 0)
- try {H5.H5Pclose(plist_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(plist_id);
+ }
+ catch (Exception ex) {
+ }
if (btplist_id > 0)
- try {H5.H5Pclose(btplist_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(btplist_id);
+ }
+ catch (Exception ex) {
+ }
System.out.println();
}
@@ -97,19 +118,21 @@ public class TestH5Pfaplhdfs {
if (HDF5Constants.H5FD_HDFS < 0)
throw new HDF5LibraryException("skip");
- String nodename = "blues";
- int nodeport = 12345;
- String username = "sparticus";
+ String nodename = "blues";
+ int nodeport = 12345;
+ String username = "sparticus";
String kerbcache = "/dev/null";
- int streamsize = 1024;
+ int streamsize = 1024;
- final H5FD_hdfs_fapl_t config = new H5FD_hdfs_fapl_t(nodename, nodeport, username, kerbcache, streamsize);
+ final H5FD_hdfs_fapl_t config =
+ new H5FD_hdfs_fapl_t(nodename, nodeport, username, kerbcache, streamsize);
assertTrue("setting fapl should succeed", -1 < H5.H5Pset_fapl_hdfs(fapl_id, config));
assertEquals("driver types should match", HDF5Constants.H5FD_HDFS, H5.H5Pget_driver(fapl_id));
H5FD_hdfs_fapl_t copy = H5.H5Pget_fapl_hdfs(fapl_id);
- assertEquals("fapl contents should match", new H5FD_hdfs_fapl_t(nodename, nodeport, username, kerbcache, streamsize), copy);
+ assertEquals("fapl contents should match",
+ new H5FD_hdfs_fapl_t(nodename, nodeport, username, kerbcache, streamsize), copy);
}
@Test(expected = HDF5LibraryException.class)
@@ -125,13 +148,12 @@ public class TestH5Pfaplhdfs {
{
if (HDF5Constants.H5FD_HDFS < 0)
throw new HDF5LibraryException("skip");
- if (HDF5Constants.H5FD_SEC2 < 0 )
+ if (HDF5Constants.H5FD_SEC2 < 0)
throw new HDF5LibraryException("skip");
- /* TODO: for now, test against a sec2 fapl only */
+ /* TODO: for now, test against a sec2 fapl only */
H5.H5Pset_fapl_sec2(fapl_id);
assertEquals("fapl_id was not set properly", HDF5Constants.H5FD_SEC2, H5.H5Pget_driver(fapl_id));
H5FD_hdfs_fapl_t fails = H5.H5Pget_fapl_hdfs(fapl_id);
}
-
}
diff --git a/java/test/TestH5Pfapls3.java b/java/test/TestH5Pfapls3.java
index dda2716..06baef2 100644
--- a/java/test/TestH5Pfapls3.java
+++ b/java/test/TestH5Pfapls3.java
@@ -31,12 +31,13 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Pfapls3 {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
- long fapl_id = HDF5Constants.H5I_INVALID_HID;
- long plapl_id = HDF5Constants.H5I_INVALID_HID;
- long dapl_id = HDF5Constants.H5I_INVALID_HID;
- long plist_id = HDF5Constants.H5I_INVALID_HID;
+ long fapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plapl_id = HDF5Constants.H5I_INVALID_HID;
+ long dapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
long btplist_id = HDF5Constants.H5I_INVALID_HID;
@Before
@@ -62,9 +63,9 @@ public class TestH5Pfapls3 {
}
assertTrue(plapl_id > 0);
try {
- plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER);
+ plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER);
btplist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER);
- dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS);
+ dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS);
}
catch (Throwable err) {
err.printStackTrace();
@@ -79,15 +80,35 @@ public class TestH5Pfapls3 {
public void deleteFileAccess() throws HDF5LibraryException
{
if (fapl_id > 0)
- try {H5.H5Pclose(fapl_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(fapl_id);
+ }
+ catch (Exception ex) {
+ }
if (plapl_id > 0)
- try {H5.H5Pclose(plapl_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(plapl_id);
+ }
+ catch (Exception ex) {
+ }
if (dapl_id > 0)
- try {H5.H5Pclose(dapl_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(dapl_id);
+ }
+ catch (Exception ex) {
+ }
if (plist_id > 0)
- try {H5.H5Pclose(plist_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(plist_id);
+ }
+ catch (Exception ex) {
+ }
if (btplist_id > 0)
- try {H5.H5Pclose(btplist_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(btplist_id);
+ }
+ catch (Exception ex) {
+ }
System.out.println();
}
@@ -98,18 +119,15 @@ public class TestH5Pfapls3 {
return;
final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t();
- assertEquals("Default fapl has unexpected contents",
- new H5FD_ros3_fapl_t("", "", ""), config);
+ assertEquals("Default fapl has unexpected contents", new H5FD_ros3_fapl_t("", "", ""), config);
H5.H5Pset_fapl_ros3(fapl_id, config);
- assertEquals("driver types don't match",
- HDF5Constants.H5FD_ROS3, H5.H5Pget_driver(fapl_id));
+ assertEquals("driver types don't match", HDF5Constants.H5FD_ROS3, H5.H5Pget_driver(fapl_id));
/* get_fapl_ros3 can throw exception in error cases */
H5FD_ros3_fapl_t copy = H5.H5Pget_fapl_ros3(fapl_id);
- assertEquals("contents of fapl set and get don't match",
- new H5FD_ros3_fapl_t("", "", ""), copy);
+ assertEquals("contents of fapl set and get don't match", new H5FD_ros3_fapl_t("", "", ""), copy);
}
@Test(expected = HDF5LibraryException.class)
@@ -125,13 +143,12 @@ public class TestH5Pfapls3 {
{
if (HDF5Constants.H5FD_ROS3 < 0)
throw new HDF5LibraryException("skip");
- if (HDF5Constants.H5FD_SEC2 < 0 )
+ if (HDF5Constants.H5FD_SEC2 < 0)
throw new HDF5LibraryException("skip");
- /* TODO: for now, test against a sec2 fapl only */
+ /* TODO: for now, test against a sec2 fapl only */
H5.H5Pset_fapl_sec2(fapl_id);
- assertEquals("fapl_id was not set properly",
- HDF5Constants.H5FD_SEC2, H5.H5Pget_driver(fapl_id));
+ assertEquals("fapl_id was not set properly", HDF5Constants.H5FD_SEC2, H5.H5Pget_driver(fapl_id));
H5FD_ros3_fapl_t fails = H5.H5Pget_fapl_ros3(fapl_id);
}
@@ -147,12 +164,10 @@ public class TestH5Pfapls3 {
final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t(region, acc_id, acc_key);
H5.H5Pset_fapl_ros3(fapl_id, config);
- assertEquals("driver types don't match",
- HDF5Constants.H5FD_ROS3, H5.H5Pget_driver(fapl_id));
+ assertEquals("driver types don't match", HDF5Constants.H5FD_ROS3, H5.H5Pget_driver(fapl_id));
H5FD_ros3_fapl_t copy = H5.H5Pget_fapl_ros3(fapl_id);
assertEquals("contents of fapl set and get don't match",
- new H5FD_ros3_fapl_t(region, acc_id, acc_key), copy);
+ new H5FD_ros3_fapl_t(region, acc_id, acc_key), copy);
}
-
}
diff --git a/java/test/TestH5Plist.java b/java/test/TestH5Plist.java
index 03e1c8f..d8a429b 100644
--- a/java/test/TestH5Plist.java
+++ b/java/test/TestH5Plist.java
@@ -17,11 +17,11 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import java.util.ArrayList;
import java.io.File;
+import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat;
import java.text.NumberFormat;
-import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
@@ -32,15 +32,15 @@ import hdf.hdf5lib.callbacks.H5P_cls_copy_func_cb;
import hdf.hdf5lib.callbacks.H5P_cls_copy_func_t;
import hdf.hdf5lib.callbacks.H5P_cls_create_func_cb;
import hdf.hdf5lib.callbacks.H5P_cls_create_func_t;
-import hdf.hdf5lib.callbacks.H5P_prp_set_func_cb;
-import hdf.hdf5lib.callbacks.H5P_prp_get_func_cb;
-import hdf.hdf5lib.callbacks.H5P_prp_delete_func_cb;
-import hdf.hdf5lib.callbacks.H5P_prp_copy_func_cb;
-import hdf.hdf5lib.callbacks.H5P_prp_compare_func_cb;
-import hdf.hdf5lib.callbacks.H5P_prp_close_func_cb;
-import hdf.hdf5lib.callbacks.H5P_prp_create_func_cb;
import hdf.hdf5lib.callbacks.H5P_iterate_cb;
import hdf.hdf5lib.callbacks.H5P_iterate_t;
+import hdf.hdf5lib.callbacks.H5P_prp_close_func_cb;
+import hdf.hdf5lib.callbacks.H5P_prp_compare_func_cb;
+import hdf.hdf5lib.callbacks.H5P_prp_copy_func_cb;
+import hdf.hdf5lib.callbacks.H5P_prp_create_func_cb;
+import hdf.hdf5lib.callbacks.H5P_prp_delete_func_cb;
+import hdf.hdf5lib.callbacks.H5P_prp_get_func_cb;
+import hdf.hdf5lib.callbacks.H5P_prp_set_func_cb;
import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5AC_cache_config_t;
@@ -52,7 +52,8 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Plist {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
// Property definitions
private static final String CLASS1_NAME = "Class 1";
@@ -63,33 +64,31 @@ public class TestH5Plist {
// Property definitions
private static final String PROP1_NAME = "Property 1";
- private static final int prop1_def = 10; // Property 1 default value
- private static final int PROP1_SIZE = 2;
+ private static final int prop1_def = 10; // Property 1 default value
+ private static final int PROP1_SIZE = 2;
private static final String PROP2_NAME = "Property 2";
- private static final float prop2_def = 3.14F; // Property 2 default value
- private static final int PROP2_SIZE = 8;
+ private static final float prop2_def = 3.14F; // Property 2 default value
+ private static final int PROP2_SIZE = 8;
- private static final String PROP3_NAME = "Property 3";
- private static final char[] prop3_def = {'T','e','n',' ','c','h','a','r','s',' '}; // Property 3 default value
- private static final int PROP3_SIZE = 10;
+ private static final String PROP3_NAME = "Property 3";
+ private static final char[] prop3_def = {'T', 'e', 'n', ' ', 'c',
+ 'h', 'a', 'r', 's', ' '}; // Property 3 default value
+ private static final int PROP3_SIZE = 10;
- private static final String PROP4_NAME = "Property 4";
- private static final double prop4_def = 1.41F; // Property 4 default value
- private static final int PROP4_SIZE = 8;
+ private static final String PROP4_NAME = "Property 4";
+ private static final double prop4_def = 1.41F; // Property 4 default value
+ private static final int PROP4_SIZE = 8;
- private static final String [] pnames = { // Names of properties for iterator
- PROP1_NAME,
- PROP2_NAME,
- PROP3_NAME,
- PROP4_NAME};
+ private static final String[] pnames = { // Names of properties for iterator
+ PROP1_NAME, PROP2_NAME, PROP3_NAME, PROP4_NAME};
long plist_class_id = HDF5Constants.H5I_INVALID_HID;
@Before
- public void createPropClass()throws NullPointerException, HDF5Exception
+ public void createPropClass() throws NullPointerException, HDF5Exception
{
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
// Create a new generic class, derived from the root of the class hierarchy
try {
@@ -103,20 +102,26 @@ public class TestH5Plist {
}
@After
- public void deleteFileAccess() throws HDF5LibraryException {
+ public void deleteFileAccess() throws HDF5LibraryException
+ {
if (plist_class_id > 0)
- try {H5.H5Pclose(plist_class_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(plist_class_id);
+ }
+ catch (Exception ex) {
+ }
System.out.println();
}
// Test basic generic property list code. Tests creating new generic classes.
@Test
- public void testH5P_genprop_basic_class() {
- int status = -1;
- long cid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
- long cid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
- long cid3 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
- String name = null; // Name of class
+ public void testH5P_genprop_basic_class()
+ {
+ int status = -1;
+ long cid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
+ long cid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
+ long cid3 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
+ String name = null; // Name of class
try {
// Check class name
@@ -127,7 +132,8 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pget_class_name plist_class_id: " + err);
}
- assertTrue("Class names don't match!, "+name+"="+CLASS1_NAME+"\n", name.compareTo(CLASS1_NAME)==0);
+ assertTrue("Class names don't match!, " + name + "=" + CLASS1_NAME + "\n",
+ name.compareTo(CLASS1_NAME) == 0);
// Check class parent
try {
@@ -196,7 +202,8 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pget_class_name cid1: " + err);
}
- assertTrue("Class names don't match!, "+name+"="+CLASS2_NAME+"\n", name.compareTo(CLASS2_NAME)==0);
+ assertTrue("Class names don't match!, " + name + "=" + CLASS2_NAME + "\n",
+ name.compareTo(CLASS2_NAME) == 0);
// Check class parent
try {
@@ -270,20 +277,33 @@ public class TestH5Plist {
}
finally {
if (cid3 > 0)
- try {H5.H5Pclose_class(cid3);} catch (Throwable err) {}
+ try {
+ H5.H5Pclose_class(cid3);
+ }
+ catch (Throwable err) {
+ }
if (cid2 > 0)
- try {H5.H5Pclose_class(cid2);} catch (Throwable err) {}
+ try {
+ H5.H5Pclose_class(cid2);
+ }
+ catch (Throwable err) {
+ }
if (cid1 > 0)
- try {H5.H5Pclose_class(cid1);} catch (Throwable err) {}
+ try {
+ H5.H5Pclose_class(cid1);
+ }
+ catch (Throwable err) {
+ }
}
}
// Test basic generic property list code. Tests adding properties to generic classes.
@Test
- public void testH5P_genprop_basic_class_prop() {
- boolean status = false;
- long size = -1; // Generic Property size
- long nprops = -1; // Generic Property class number
+ public void testH5P_genprop_basic_class_prop()
+ {
+ boolean status = false;
+ long size = -1; // Generic Property size
+ long nprops = -1; // Generic Property class number
// Check the number of properties in class
try {
@@ -293,7 +313,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pget_nprops plist_class_id: " + err);
}
- assertTrue("H5Pget_nprops: "+nprops, nprops==0);
+ assertTrue("H5Pget_nprops: " + nprops, nprops == 0);
// Check the existence of the first property (should fail)
try {
@@ -303,7 +323,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pexist plist_class_id: " + err);
}
- assertFalse("H5Pexist plist_class_id "+PROP1_NAME, status);
+ assertFalse("H5Pexist plist_class_id " + PROP1_NAME, status);
// Insert first property into class (with no callbacks)
try {
@@ -313,7 +333,7 @@ public class TestH5Plist {
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5Pregister2 plist_class_id: "+PROP1_NAME + err);
+ fail("H5Pregister2 plist_class_id: " + PROP1_NAME + err);
}
// Try to insert the first property again (should fail)
@@ -321,7 +341,7 @@ public class TestH5Plist {
byte[] prop_value = HDFNativeData.intToByte(prop1_def);
H5.H5Pregister2_nocb(plist_class_id, PROP1_NAME, PROP1_SIZE, prop_value);
- fail("H5Pregister2 plist_class_id: "+PROP1_NAME);
+ fail("H5Pregister2 plist_class_id: " + PROP1_NAME);
}
catch (Throwable err) {
}
@@ -334,7 +354,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pexist plist_class_id: " + err);
}
- assertTrue("H5Pexist plist_class_id "+PROP1_NAME, status);
+ assertTrue("H5Pexist plist_class_id " + PROP1_NAME, status);
// Check the size of the first property
try {
@@ -344,7 +364,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pget_size PROP1_NAME: " + err);
}
- assertTrue("H5Pget_size "+PROP1_NAME +" size: "+size, size == PROP1_SIZE);
+ assertTrue("H5Pget_size " + PROP1_NAME + " size: " + size, size == PROP1_SIZE);
// Check the number of properties in class
try {
@@ -354,7 +374,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pget_nprops plist_class_id: " + err);
}
- assertTrue("H5Pget_nprops: "+nprops, nprops==1);
+ assertTrue("H5Pget_nprops: " + nprops, nprops == 1);
// Insert second property into class (with no callbacks)
try {
@@ -364,7 +384,7 @@ public class TestH5Plist {
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5Pregister2 plist_class_id: "+PROP2_NAME + err);
+ fail("H5Pregister2 plist_class_id: " + PROP2_NAME + err);
}
// Try to insert the second property again (should fail)
@@ -372,7 +392,7 @@ public class TestH5Plist {
byte[] prop_value = HDFNativeData.floatToByte(prop2_def);
H5.H5Pregister2_nocb(plist_class_id, PROP2_NAME, PROP2_SIZE, prop_value);
- fail("H5Pregister2 plist_class_id: "+PROP2_NAME);
+ fail("H5Pregister2 plist_class_id: " + PROP2_NAME);
}
catch (Throwable err) {
}
@@ -385,7 +405,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pexist plist_class_id: " + err);
}
- assertTrue("H5Pexist plist_class_id "+PROP2_NAME, status);
+ assertTrue("H5Pexist plist_class_id " + PROP2_NAME, status);
// Check the size of the second property
try {
@@ -395,7 +415,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pget_size PROP2_NAME: " + err);
}
- assertTrue("H5Pget_size "+PROP2_NAME +" size: "+size, size == PROP2_SIZE);
+ assertTrue("H5Pget_size " + PROP2_NAME + " size: " + size, size == PROP2_SIZE);
// Check the number of properties in class
try {
@@ -405,7 +425,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pget_nprops plist_class_id: " + err);
}
- assertTrue("H5Pget_nprops: "+nprops, nprops==2);
+ assertTrue("H5Pget_nprops: " + nprops, nprops == 2);
// Insert third property into class (with no callbacks)
try {
@@ -415,7 +435,7 @@ public class TestH5Plist {
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5Pregister2 plist_class_id: "+PROP3_NAME + err);
+ fail("H5Pregister2 plist_class_id: " + PROP3_NAME + err);
}
// Check the existence of the third property
@@ -426,7 +446,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pexist plist_class_id: " + err);
}
- assertTrue("H5Pexist plist_class_id "+PROP3_NAME, status);
+ assertTrue("H5Pexist plist_class_id " + PROP3_NAME, status);
// Check the size of the third property
try {
@@ -436,7 +456,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pget_size PROP3_NAME: " + err);
}
- assertTrue("H5Pget_size "+PROP3_NAME +" size: "+size, size == PROP3_SIZE);
+ assertTrue("H5Pget_size " + PROP3_NAME + " size: " + size, size == PROP3_SIZE);
// Check the number of properties in class
try {
@@ -446,7 +466,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pget_nprops plist_class_id: " + err);
}
- assertTrue("H5Pget_nprops: "+nprops, nprops==3);
+ assertTrue("H5Pget_nprops: " + nprops, nprops == 3);
// Unregister first property
try {
@@ -454,7 +474,7 @@ public class TestH5Plist {
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5Punregister plist_class_id: "+PROP1_NAME + err);
+ fail("H5Punregister plist_class_id: " + PROP1_NAME + err);
}
// Try to check the size of the first property (should fail)
@@ -473,7 +493,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pget_nprops plist_class_id: " + err);
}
- assertTrue("H5Pget_nprops: "+nprops, nprops==2);
+ assertTrue("H5Pget_nprops: " + nprops, nprops == 2);
// Unregister second property
try {
@@ -481,7 +501,7 @@ public class TestH5Plist {
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5Punregister plist_class_id: "+PROP2_NAME + err);
+ fail("H5Punregister plist_class_id: " + PROP2_NAME + err);
}
// Check the number of properties in class
@@ -492,7 +512,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pget_nprops plist_class_id: " + err);
}
- assertTrue("H5Pget_nprops: "+nprops, nprops==1);
+ assertTrue("H5Pget_nprops: " + nprops, nprops == 1);
// Unregister third property
try {
@@ -500,7 +520,7 @@ public class TestH5Plist {
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5Punregister plist_class_id: "+PROP3_NAME + err);
+ fail("H5Punregister plist_class_id: " + PROP3_NAME + err);
}
// Check the number of properties in class
@@ -511,16 +531,18 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pget_nprops plist_class_id: " + err);
}
- assertTrue("H5Pget_nprops: "+nprops, nprops==0);
+ assertTrue("H5Pget_nprops: " + nprops, nprops == 0);
}
// Test basic generic property list code. Tests iterating over properties in a generic class.
@Test
- public void testH5P_genprop_class_iter() {
+ public void testH5P_genprop_class_iter()
+ {
class idata {
- public String[] iter_names= null;
- public int iter_count = -1;
- idata(String[] names, int count) {
+ public String[] iter_names = null;
+ public int iter_count = -1;
+ idata(String[] names, int count)
+ {
this.iter_names = names;
this.iter_count = count;
}
@@ -531,16 +553,17 @@ public class TestH5Plist {
H5P_iterate_t iter_data = new H5P_iter_data();
class H5P_iter_callback implements H5P_iterate_cb {
- public int callback(long list_id, String name, H5P_iterate_t op_data) {
+ public int callback(long list_id, String name, H5P_iterate_t op_data)
+ {
idata id = ((H5P_iter_data)op_data).iterdata.get(0);
return name.compareTo(id.iter_names[id.iter_count++]);
}
}
H5P_iterate_cb iter_cb = new H5P_iter_callback();
- long size = -1; // Generic Property size
- long nprops = -1; // Generic Property class number
- int[] idx = {0}; // Index to start iteration at
+ long size = -1; // Generic Property size
+ long nprops = -1; // Generic Property class number
+ int[] idx = {0}; // Index to start iteration at
// Insert first property into class (with no callbacks) */
try {
@@ -550,7 +573,7 @@ public class TestH5Plist {
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5Pregister2 plist_class_id: "+PROP1_NAME + err);
+ fail("H5Pregister2 plist_class_id: " + PROP1_NAME + err);
}
// Insert second property into class (with no callbacks) */
@@ -561,7 +584,7 @@ public class TestH5Plist {
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5Pregister2 plist_class_id: "+PROP2_NAME + err);
+ fail("H5Pregister2 plist_class_id: " + PROP2_NAME + err);
}
// Insert third property into class (with no callbacks) */
@@ -572,7 +595,7 @@ public class TestH5Plist {
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5Pregister2 plist_class_id: "+PROP3_NAME + err);
+ fail("H5Pregister2 plist_class_id: " + PROP3_NAME + err);
}
// Insert fourth property into class (with no callbacks) */
@@ -583,7 +606,7 @@ public class TestH5Plist {
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5Pregister2 plist_class_id: "+PROP4_NAME + err);
+ fail("H5Pregister2 plist_class_id: " + PROP4_NAME + err);
}
// Check the number of properties in class */
@@ -594,7 +617,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pget_nprops plist_class_id: " + err);
}
- assertTrue("H5Pget_nprops: "+nprops, nprops==4);
+ assertTrue("H5Pget_nprops: " + nprops, nprops == 4);
// Iterate over all properties in class */
idata id = new idata(pnames, 0);
@@ -606,12 +629,14 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5.H5Piterate: " + err);
}
- assertFalse("H5Piterate ",((H5P_iter_data)iter_data).iterdata.isEmpty());
- assertTrue("H5Piterate "+((H5P_iter_data)iter_data).iterdata.size(),((H5P_iter_data)iter_data).iterdata.size()==1);
- assertTrue("H5Piterate "+(((H5P_iter_data)iter_data).iterdata.get(0)).iter_count,((idata)((H5P_iter_data)iter_data).iterdata.get(0)).iter_count==4);
+ assertFalse("H5Piterate ", ((H5P_iter_data)iter_data).iterdata.isEmpty());
+ assertTrue("H5Piterate " + ((H5P_iter_data)iter_data).iterdata.size(),
+ ((H5P_iter_data)iter_data).iterdata.size() == 1);
+ assertTrue("H5Piterate " + (((H5P_iter_data)iter_data).iterdata.get(0)).iter_count,
+ ((idata)((H5P_iter_data)iter_data).iterdata.get(0)).iter_count == 4);
// Iterate over last three properties in class */
- idx[0] = 1;
+ idx[0] = 1;
((H5P_iter_data)iter_data).iterdata.get(0).iter_count = 1;
try {
H5.H5Piterate(plist_class_id, idx, iter_cb, iter_data);
@@ -620,21 +645,24 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5.H5Piterate: " + err);
}
- assertFalse("H5Piterate ",((H5P_iter_data)iter_data).iterdata.isEmpty());
- assertTrue("H5Piterate "+((H5P_iter_data)iter_data).iterdata.size(),((H5P_iter_data)iter_data).iterdata.size()==1);
- assertTrue("H5Piterate "+(((H5P_iter_data)iter_data).iterdata.get(0)).iter_count,((idata)((H5P_iter_data)iter_data).iterdata.get(0)).iter_count==4);
+ assertFalse("H5Piterate ", ((H5P_iter_data)iter_data).iterdata.isEmpty());
+ assertTrue("H5Piterate " + ((H5P_iter_data)iter_data).iterdata.size(),
+ ((H5P_iter_data)iter_data).iterdata.size() == 1);
+ assertTrue("H5Piterate " + (((H5P_iter_data)iter_data).iterdata.get(0)).iter_count,
+ ((idata)((H5P_iter_data)iter_data).iterdata.get(0)).iter_count == 4);
- assertTrue("H5Piterate: "+nprops+"="+idx[0], nprops == idx[0]);
+ assertTrue("H5Piterate: " + nprops + "=" + idx[0], nprops == idx[0]);
}
// Test basic generic property list code.
// Tests creating new generic property lists and adding and
// removing properties from them.
@Test
- public void testH5P_genprop_basic_list_prop() {
- boolean status = false;
- long lid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
- long nprops = -1; // Number of properties in class
+ public void testH5P_genprop_basic_list_prop()
+ {
+ boolean status = false;
+ long lid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
+ long nprops = -1; // Number of properties in class
try {
// Add several properties (several w/default values)
@@ -647,7 +675,7 @@ public class TestH5Plist {
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5Pregister2 plist_class_id: "+PROP1_NAME + err);
+ fail("H5Pregister2 plist_class_id: " + PROP1_NAME + err);
}
// Insert second property into class (with no callbacks)
@@ -658,7 +686,7 @@ public class TestH5Plist {
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5Pregister2 plist_class_id: "+PROP2_NAME + err);
+ fail("H5Pregister2 plist_class_id: " + PROP2_NAME + err);
}
// Create a property list from the class
@@ -678,7 +706,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pget_nprops lid1: " + err);
}
- assertTrue("H5Pget_nprops: "+nprops, nprops==2);
+ assertTrue("H5Pget_nprops: " + nprops, nprops == 2);
// Add temporary properties
@@ -690,7 +718,7 @@ public class TestH5Plist {
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5Pinsertr2 lid1: "+PROP3_NAME + err);
+ fail("H5Pinsertr2 lid1: " + PROP3_NAME + err);
}
// Insert second temporary property into list (with no callbacks)
@@ -701,7 +729,7 @@ public class TestH5Plist {
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5Pinsert2 lid1: "+PROP4_NAME + err);
+ fail("H5Pinsert2 lid1: " + PROP4_NAME + err);
}
// Check the number of properties in class
@@ -712,7 +740,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pget_nprops lid1: " + err);
}
- assertTrue("H5Pget_nprops: "+nprops, nprops==4);
+ assertTrue("H5Pget_nprops: " + nprops, nprops == 4);
// Check existence of all properties
try {
@@ -722,7 +750,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pexist plist_class_id: " + err);
}
- assertTrue("H5Pexist lid1 "+PROP1_NAME, status);
+ assertTrue("H5Pexist lid1 " + PROP1_NAME, status);
try {
status = H5.H5Pexist(lid1, PROP2_NAME);
}
@@ -730,7 +758,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pexist plist_class_id: " + err);
}
- assertTrue("H5Pexist lid1 "+PROP2_NAME, status);
+ assertTrue("H5Pexist lid1 " + PROP2_NAME, status);
try {
status = H5.H5Pexist(lid1, PROP3_NAME);
}
@@ -738,7 +766,7 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pexist plist_class_id: " + err);
}
- assertTrue("H5Pexist lid1 "+PROP3_NAME, status);
+ assertTrue("H5Pexist lid1 " + PROP3_NAME, status);
try {
status = H5.H5Pexist(lid1, PROP4_NAME);
}
@@ -746,265 +774,279 @@ public class TestH5Plist {
err.printStackTrace();
fail("H5Pexist plist_class_id: " + err);
}
- assertTrue("H5Pexist lid1 "+PROP4_NAME, status);
-
+ assertTrue("H5Pexist lid1 " + PROP4_NAME, status);
}
finally {
if (lid1 > 0)
- try {H5.H5Pclose(lid1);} catch (Throwable err) {}
+ try {
+ H5.H5Pclose(lid1);
+ }
+ catch (Throwable err) {
+ }
}
}
-// // Test basic generic property list code. Tests callbacks for property lists in a generic class.
-// @Test
-// public void testH5P_genprop_class_callback() {
-// class cdata {
-// public long cls_id = HDF5Constants.H5I_INVALID_HID;
-// public int cls_count = -1;
-// cdata(long id, int count) {
-// this.cls_id = id;
-// this.cls_count = count;
-// }
-// }
-// class H5P_cls_create_data implements H5P_cls_create_func_t {
-// public ArrayList<cdata> clsdata = new ArrayList<cdata>();
-// }
-// H5P_cls_create_func_t cls_create_data = new H5P_cls_create_data();
-//
-// class H5P_cls_create_callback implements H5P_cls_create_func_cb {
-// public int callback(long list_id, H5P_cls_create_func_t cls_data) {
-// System.err.println("H5P_cls_create_callback enter");
-// cdata cd = ((H5P_cls_create_data)cls_create_data).clsdata.get(0);
-// cd.cls_count++;
-// cd.cls_id = list_id;
-// return 0;
-// }
-// }
-// H5P_cls_create_func_cb cls_create_cb = new H5P_cls_create_callback();
-//
-// class H5P_cls_copy_data implements H5P_cls_copy_func_t {
-// public ArrayList<cdata> clsdata = new ArrayList<cdata>();
-// }
-// H5P_cls_copy_func_t cls_copy_data = new H5P_cls_copy_data();
-//
-// class H5P_cls_copy_callback implements H5P_cls_copy_func_cb {
-// public int callback(long list_id1, long list_id2, H5P_cls_copy_func_t cls_data) {
-// cdata cd = ((H5P_cls_copy_data)cls_copy_data).clsdata.get(0);
-// cd.cls_count++;
-// cd.cls_id = list_id1;
-// return 0;
-// }
-// }
-// H5P_cls_copy_func_cb cls_copy_cb = new H5P_cls_copy_callback();
-//
-// class H5P_cls_close_data implements H5P_cls_close_func_t {
-// public ArrayList<cdata> clsdata = new ArrayList<cdata>();
-// }
-// H5P_cls_close_func_t cls_close_data = new H5P_cls_close_data();
-//
-// class H5P_cls_close_callback implements H5P_cls_close_func_cb {
-// public int callback(long list_id, H5P_cls_close_func_t cls_data) {
-// cdata cd = ((H5P_cls_close_data)cls_close_data).clsdata.get(0);
-// cd.cls_count++;
-// cd.cls_id = list_id;
-// return 0;
-// }
-// }
-// H5P_cls_close_func_cb cls_close_cb = new H5P_cls_close_callback();
-//
-// long cid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
-// long cid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
-// long lid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
-// long lid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
-// long lid3 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
-// long nprops = -1; // Number of properties in class
-//
-// try {
-// // Create a new generic class, derived from the root of the class hierarchy
-// try {
-// cid1 = H5.H5Pcreate_class(HDF5Constants.H5P_ROOT, CLASS1_NAME, cls_create_cb, cls_create_data, cls_copy_cb, cls_copy_data, cls_close_cb, cls_close_data);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("H5Pcreate_class cid1: " + err);
-// }
-// assertTrue("H5Pcreate_class cid1", cid1 >= 0);
-//
-// // Insert first property into class (with no callbacks)
-// try {
-// byte[] prop_value = HDFNativeData.intToByte(prop1_def);
-//
-// H5.H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, prop_value, null, null, null, null, null, null, null);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("H5Pregister2 cid1: "+PROP1_NAME + err);
-// }
-//
-// // Insert second property into class (with no callbacks)
-// try {
-// byte[] prop_value = HDFNativeData.floatToByte(prop2_def);
-//
-// H5.H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, prop_value, null, null, null, null, null, null, null);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("H5Pregister2 cid1: "+PROP2_NAME + err);
-// }
-//
-// // Insert third property into class (with no callbacks)
-// try {
-// byte[] prop_value = new String(prop3_def).getBytes(StandardCharsets.UTF_8);
-//
-// H5.H5Pregister2(cid1, PROP3_NAME, PROP3_SIZE, prop_value, null, null, null, null, null, null, null);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("H5Pregister2 cid1: "+PROP3_NAME + err);
-// }
-//
-// // Check the number of properties in class
-// try {
-// nprops = H5.H5Pget_nprops(cid1);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("H5Pget_nprops cid1: " + err);
-// }
-// assertTrue("H5Pget_nprops: "+nprops, nprops==3);
-//
-// // Initialize class callback structs
-// cdata create_id = new cdata(-1, 0);
-// cdata copy_id = new cdata(-1, 0);
-// cdata close_id = new cdata(-1, 0);
-// ((H5P_cls_create_data)cls_create_data).clsdata.add(create_id);
-// ((H5P_cls_copy_data)cls_copy_data).clsdata.add(copy_id);
-// ((H5P_cls_close_data)cls_close_data).clsdata.add(close_id);
-//
-// // Create a property list from the class
-// try {
-// lid1 = H5.H5Pcreate(cid1);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("H5Pcreate lid1: " + err);
-// }
-//
-// // Verify that the creation callback occurred
-// assertFalse("H5Pcreate ",((H5P_cls_create_data)cls_create_data).clsdata.isEmpty());
-// assertTrue("H5Pcreate "+((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id ,((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id == lid1);
-// assertTrue("H5Pcreate "+(((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count==1);
-//
-// // Check the number of properties in list
-// try {
-// nprops = H5.H5Pget_nprops(lid1);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("H5Pget_nprops lid1: " + err);
-// }
-// assertTrue("H5Pget_nprops: "+nprops, nprops==3);
-//
-// // Create another property list from the class
-// try {
-// lid2 = H5.H5Pcreate(cid1);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("H5Pcreate lid2: " + err);
-// }
-//
-// /* Verify that the creation callback occurred */
-// assertFalse("H5Pcreate ",((H5P_cls_create_data)cls_create_data).clsdata.isEmpty());
-// assertTrue("H5Pcreate "+((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id ,((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id == lid2);
-// assertTrue("H5Pcreate "+(((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count==2);
-//
-// // Check the number of properties in list
-// try {
-// nprops = H5.H5Pget_nprops(lid2);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("H5Pget_nprops lid2: " + err);
-// }
-// assertTrue("H5Pget_nprops: "+nprops, nprops==3);
-//
-// // Create another property list by copying an existing list
-// try {
-// lid3= H5.H5Pcopy(lid1);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("H5Pcopy lid3: " + err);
-// }
-//
-// // Verify that the copy callback occurred
-// assertFalse("H5Pcopy ",((H5P_cls_copy_data)cls_copy_data).clsdata.isEmpty());
-// assertTrue("H5Pcopy "+((H5P_cls_copy_data)cls_copy_data).clsdata.get(0).cls_id ,((H5P_cls_copy_data)cls_copy_data).clsdata.get(0).cls_id == lid3);
-// assertTrue("H5Pcopy "+(((H5P_cls_copy_data)cls_copy_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_copy_data)cls_copy_data).clsdata.get(0)).cls_count==1);
-//
-// // Check the number of properties in list
-// try {
-// nprops = H5.H5Pget_nprops(lid3);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("H5Pget_nprops lid3: " + err);
-// }
-// assertTrue("H5Pget_nprops: "+nprops, nprops==3);
-//
-// // Close first list
-// try {
-// H5.H5Pclose(lid1);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("H5Pclose lid1: " + err);
-// }
-//
-// /* Verify that the close callback occurred */
-// assertFalse("H5Pclose ",((H5P_cls_close_data)cls_close_data).clsdata.isEmpty());
-// assertTrue("H5Pclose "+((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id ,((H5P_cls_close_data)cls_copy_data).clsdata.get(0).cls_id == lid1);
-// assertTrue("H5Pclose "+(((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_close_data)cls_copy_data).clsdata.get(0)).cls_count==1);
-//
-// // Close second list
-// try {
-// H5.H5Pclose(lid2);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("H5Pclose lid2: " + err);
-// }
-//
-// // Verify that the close callback occurred
-// assertTrue("H5Pclose "+((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id ,((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id == lid2);
-// assertTrue("H5Pclose "+(((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count==2);
-//
-// // Close third list
-// try {
-// H5.H5Pclose(lid3);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("H5Pclose lid3: " + err);
-// }
-//
-// // Verify that the close callback occurred
-// assertTrue("H5Pclose "+((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id ,((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id == lid3);
-// assertTrue("H5Pclose "+(((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count==3);
-// }
-// finally {
-// if (lid3 > 0)
-// try {H5.H5Pclose(lid3);} catch (Throwable err) {}
-// if (lid2 > 0)
-// try {H5.H5Pclose(lid2);} catch (Throwable err) {}
-// if (lid1 > 0)
-// try {H5.H5Pclose(lid1);} catch (Throwable err) {}
-// if (cid2 > 0)
-// try {H5.H5Pclose_class(cid2);} catch (Throwable err) {}
-// if (cid1 > 0)
-// try {H5.H5Pclose_class(cid1);} catch (Throwable err) {}
-// }
-// }
-
+ // // Test basic generic property list code. Tests callbacks for property lists in a generic class.
+ // @Test
+ // public void testH5P_genprop_class_callback() {
+ // class cdata {
+ // public long cls_id = HDF5Constants.H5I_INVALID_HID;
+ // public int cls_count = -1;
+ // cdata(long id, int count) {
+ // this.cls_id = id;
+ // this.cls_count = count;
+ // }
+ // }
+ // class H5P_cls_create_data implements H5P_cls_create_func_t {
+ // public ArrayList<cdata> clsdata = new ArrayList<cdata>();
+ // }
+ // H5P_cls_create_func_t cls_create_data = new H5P_cls_create_data();
+ //
+ // class H5P_cls_create_callback implements H5P_cls_create_func_cb {
+ // public int callback(long list_id, H5P_cls_create_func_t cls_data) {
+ // System.err.println("H5P_cls_create_callback enter");
+ // cdata cd = ((H5P_cls_create_data)cls_create_data).clsdata.get(0);
+ // cd.cls_count++;
+ // cd.cls_id = list_id;
+ // return 0;
+ // }
+ // }
+ // H5P_cls_create_func_cb cls_create_cb = new H5P_cls_create_callback();
+ //
+ // class H5P_cls_copy_data implements H5P_cls_copy_func_t {
+ // public ArrayList<cdata> clsdata = new ArrayList<cdata>();
+ // }
+ // H5P_cls_copy_func_t cls_copy_data = new H5P_cls_copy_data();
+ //
+ // class H5P_cls_copy_callback implements H5P_cls_copy_func_cb {
+ // public int callback(long list_id1, long list_id2, H5P_cls_copy_func_t cls_data) {
+ // cdata cd = ((H5P_cls_copy_data)cls_copy_data).clsdata.get(0);
+ // cd.cls_count++;
+ // cd.cls_id = list_id1;
+ // return 0;
+ // }
+ // }
+ // H5P_cls_copy_func_cb cls_copy_cb = new H5P_cls_copy_callback();
+ //
+ // class H5P_cls_close_data implements H5P_cls_close_func_t {
+ // public ArrayList<cdata> clsdata = new ArrayList<cdata>();
+ // }
+ // H5P_cls_close_func_t cls_close_data = new H5P_cls_close_data();
+ //
+ // class H5P_cls_close_callback implements H5P_cls_close_func_cb {
+ // public int callback(long list_id, H5P_cls_close_func_t cls_data) {
+ // cdata cd = ((H5P_cls_close_data)cls_close_data).clsdata.get(0);
+ // cd.cls_count++;
+ // cd.cls_id = list_id;
+ // return 0;
+ // }
+ // }
+ // H5P_cls_close_func_cb cls_close_cb = new H5P_cls_close_callback();
+ //
+ // long cid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
+ // long cid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
+ // long lid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
+ // long lid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
+ // long lid3 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
+ // long nprops = -1; // Number of properties in class
+ //
+ // try {
+ // // Create a new generic class, derived from the root of the class hierarchy
+ // try {
+ // cid1 = H5.H5Pcreate_class(HDF5Constants.H5P_ROOT, CLASS1_NAME, cls_create_cb,
+ // cls_create_data, cls_copy_cb, cls_copy_data, cls_close_cb, cls_close_data);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("H5Pcreate_class cid1: " + err);
+ // }
+ // assertTrue("H5Pcreate_class cid1", cid1 >= 0);
+ //
+ // // Insert first property into class (with no callbacks)
+ // try {
+ // byte[] prop_value = HDFNativeData.intToByte(prop1_def);
+ //
+ // H5.H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, prop_value, null, null, null, null, null,
+ // null, null);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("H5Pregister2 cid1: "+PROP1_NAME + err);
+ // }
+ //
+ // // Insert second property into class (with no callbacks)
+ // try {
+ // byte[] prop_value = HDFNativeData.floatToByte(prop2_def);
+ //
+ // H5.H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, prop_value, null, null, null, null, null,
+ // null, null);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("H5Pregister2 cid1: "+PROP2_NAME + err);
+ // }
+ //
+ // // Insert third property into class (with no callbacks)
+ // try {
+ // byte[] prop_value = new String(prop3_def).getBytes(StandardCharsets.UTF_8);
+ //
+ // H5.H5Pregister2(cid1, PROP3_NAME, PROP3_SIZE, prop_value, null, null, null, null, null,
+ // null, null);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("H5Pregister2 cid1: "+PROP3_NAME + err);
+ // }
+ //
+ // // Check the number of properties in class
+ // try {
+ // nprops = H5.H5Pget_nprops(cid1);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("H5Pget_nprops cid1: " + err);
+ // }
+ // assertTrue("H5Pget_nprops: "+nprops, nprops==3);
+ //
+ // // Initialize class callback structs
+ // cdata create_id = new cdata(-1, 0);
+ // cdata copy_id = new cdata(-1, 0);
+ // cdata close_id = new cdata(-1, 0);
+ // ((H5P_cls_create_data)cls_create_data).clsdata.add(create_id);
+ // ((H5P_cls_copy_data)cls_copy_data).clsdata.add(copy_id);
+ // ((H5P_cls_close_data)cls_close_data).clsdata.add(close_id);
+ //
+ // // Create a property list from the class
+ // try {
+ // lid1 = H5.H5Pcreate(cid1);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("H5Pcreate lid1: " + err);
+ // }
+ //
+ // // Verify that the creation callback occurred
+ // assertFalse("H5Pcreate ",((H5P_cls_create_data)cls_create_data).clsdata.isEmpty());
+ // assertTrue("H5Pcreate "+((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id
+ // ,((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id == lid1);
+ // assertTrue("H5Pcreate
+ // "+(((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count==1);
+ //
+ // // Check the number of properties in list
+ // try {
+ // nprops = H5.H5Pget_nprops(lid1);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("H5Pget_nprops lid1: " + err);
+ // }
+ // assertTrue("H5Pget_nprops: "+nprops, nprops==3);
+ //
+ // // Create another property list from the class
+ // try {
+ // lid2 = H5.H5Pcreate(cid1);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("H5Pcreate lid2: " + err);
+ // }
+ //
+ // /* Verify that the creation callback occurred */
+ // assertFalse("H5Pcreate ",((H5P_cls_create_data)cls_create_data).clsdata.isEmpty());
+ // assertTrue("H5Pcreate "+((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id
+ // ,((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id == lid2);
+ // assertTrue("H5Pcreate
+ // "+(((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count==2);
+ //
+ // // Check the number of properties in list
+ // try {
+ // nprops = H5.H5Pget_nprops(lid2);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("H5Pget_nprops lid2: " + err);
+ // }
+ // assertTrue("H5Pget_nprops: "+nprops, nprops==3);
+ //
+ // // Create another property list by copying an existing list
+ // try {
+ // lid3= H5.H5Pcopy(lid1);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("H5Pcopy lid3: " + err);
+ // }
+ //
+ // // Verify that the copy callback occurred
+ // assertFalse("H5Pcopy ",((H5P_cls_copy_data)cls_copy_data).clsdata.isEmpty());
+ // assertTrue("H5Pcopy "+((H5P_cls_copy_data)cls_copy_data).clsdata.get(0).cls_id
+ // ,((H5P_cls_copy_data)cls_copy_data).clsdata.get(0).cls_id == lid3); assertTrue("H5Pcopy
+ // "+(((H5P_cls_copy_data)cls_copy_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_copy_data)cls_copy_data).clsdata.get(0)).cls_count==1);
+ //
+ // // Check the number of properties in list
+ // try {
+ // nprops = H5.H5Pget_nprops(lid3);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("H5Pget_nprops lid3: " + err);
+ // }
+ // assertTrue("H5Pget_nprops: "+nprops, nprops==3);
+ //
+ // // Close first list
+ // try {
+ // H5.H5Pclose(lid1);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("H5Pclose lid1: " + err);
+ // }
+ //
+ // /* Verify that the close callback occurred */
+ // assertFalse("H5Pclose ",((H5P_cls_close_data)cls_close_data).clsdata.isEmpty());
+ // assertTrue("H5Pclose "+((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id
+ // ,((H5P_cls_close_data)cls_copy_data).clsdata.get(0).cls_id == lid1); assertTrue("H5Pclose
+ // "+(((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_close_data)cls_copy_data).clsdata.get(0)).cls_count==1);
+ //
+ // // Close second list
+ // try {
+ // H5.H5Pclose(lid2);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("H5Pclose lid2: " + err);
+ // }
+ //
+ // // Verify that the close callback occurred
+ // assertTrue("H5Pclose "+((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id
+ // ,((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id == lid2); assertTrue("H5Pclose
+ // "+(((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count==2);
+ //
+ // // Close third list
+ // try {
+ // H5.H5Pclose(lid3);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("H5Pclose lid3: " + err);
+ // }
+ //
+ // // Verify that the close callback occurred
+ // assertTrue("H5Pclose "+((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id
+ // ,((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id == lid3); assertTrue("H5Pclose
+ // "+(((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count==3);
+ // }
+ // finally {
+ // if (lid3 > 0)
+ // try {H5.H5Pclose(lid3);} catch (Throwable err) {}
+ // if (lid2 > 0)
+ // try {H5.H5Pclose(lid2);} catch (Throwable err) {}
+ // if (lid1 > 0)
+ // try {H5.H5Pclose(lid1);} catch (Throwable err) {}
+ // if (cid2 > 0)
+ // try {H5.H5Pclose_class(cid2);} catch (Throwable err) {}
+ // if (cid1 > 0)
+ // try {H5.H5Pclose_class(cid1);} catch (Throwable err) {}
+ // }
+ // }
}
diff --git a/java/test/TestH5Pvirtual.java b/java/test/TestH5Pvirtual.java
index 0478356..41ae6d1 100644
--- a/java/test/TestH5Pvirtual.java
+++ b/java/test/TestH5Pvirtual.java
@@ -32,48 +32,47 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Pvirtual {
- @Rule public TestName testname = new TestName();
-
- private static final String H5_FILE = "vds.h5";
- private static final String SRC_FILE[] = {
- "v-0.h5",
- "v-1.h5",
- "v-2.h5"
- };
- private static final String SRC_DATASET[] = {
- "A",
- "B",
- "C"
- };
- private static final int DIM_Y = 6;
- private static final int VDSDIM_X = 4;
- private static final int VDSDIM_Y = 6;
- private static final int fill_value = -1;
- long[] H5dims = { DIM_Y };
- long[] VDSH5dims = { VDSDIM_X, VDSDIM_Y };
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5dsid = HDF5Constants.H5I_INVALID_HID;
- long H5dssid = HDF5Constants.H5I_INVALID_HID;
- long H5dvsid = HDF5Constants.H5I_INVALID_HID;
- long H5did = HDF5Constants.H5I_INVALID_HID;
- long H5dcplid = HDF5Constants.H5I_INVALID_HID;
- long H5dapl_id = HDF5Constants.H5I_INVALID_HID;
-
- private final void _deleteFile(String filename) {
+ @Rule
+ public TestName testname = new TestName();
+
+ private static final String H5_FILE = "vds.h5";
+ private static final String SRC_FILE[] = {"v-0.h5", "v-1.h5", "v-2.h5"};
+ private static final String SRC_DATASET[] = {"A", "B", "C"};
+ private static final int DIM_Y = 6;
+ private static final int VDSDIM_X = 4;
+ private static final int VDSDIM_Y = 6;
+ private static final int fill_value = -1;
+ long[] H5dims = {DIM_Y};
+ long[] VDSH5dims = {VDSDIM_X, VDSDIM_Y};
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5dssid = HDF5Constants.H5I_INVALID_HID;
+ long H5dvsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long H5dcplid = HDF5Constants.H5I_INVALID_HID;
+ long H5dapl_id = HDF5Constants.H5I_INVALID_HID;
+
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
- private final long _createDataset(long fid, long dsid, String name, long dcpl, long dapl) {
- long did = HDF5Constants.H5I_INVALID_HID;
+ private final long _createDataset(long fid, long dsid, String name, long dcpl, long dapl)
+ {
+ long did = HDF5Constants.H5I_INVALID_HID;
long space_id = HDF5Constants.H5I_INVALID_HID;
- long[] start = {0, 0};
+ long[] start = {0, 0};
long[] stride = null;
- long[] count = {1, 1};
- long[] block = {1, VDSDIM_Y};
+ long[] count = {1, 1};
+ long[] block = {1, VDSDIM_Y};
try {
H5dssid = H5.H5Screate_simple(1, H5dims, null);
@@ -83,8 +82,8 @@ public class TestH5Pvirtual {
H5.H5Sselect_hyperslab(dsid, HDF5Constants.H5S_SELECT_SET, start, stride, count, block);
H5.H5Pset_virtual(dcpl, dsid, SRC_FILE[i], SRC_DATASET[i], H5dssid);
}
- did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_NATIVE_INT, dsid,
- HDF5Constants.H5P_DEFAULT, dcpl, dapl);
+ did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_NATIVE_INT, dsid, HDF5Constants.H5P_DEFAULT, dcpl,
+ dapl);
}
catch (Throwable err) {
err.printStackTrace();
@@ -95,23 +94,26 @@ public class TestH5Pvirtual {
return did;
}
- private final void _createH5File(long fcpl, long fapl) {
+ private final void _createH5File(long fcpl, long fapl)
+ {
int[] dset_data = new int[DIM_Y];
// Create source files and datasets
- for (int i=0; i < 3; i++) {
+ for (int i = 0; i < 3; i++) {
long space_id = HDF5Constants.H5I_INVALID_HID;
- long dset_id = HDF5Constants.H5I_INVALID_HID;
- long file_id = HDF5Constants.H5I_INVALID_HID;
- for (int j = 0; j < DIM_Y; j++) dset_data[j] = i+1;
+ long dset_id = HDF5Constants.H5I_INVALID_HID;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ for (int j = 0; j < DIM_Y; j++)
+ dset_data[j] = i + 1;
try {
- file_id = H5.H5Fcreate(SRC_FILE[i], HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ file_id = H5.H5Fcreate(SRC_FILE[i], HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
space_id = H5.H5Screate_simple(1, H5dims, null);
- dset_id = H5.H5Dcreate(file_id, SRC_DATASET[i], HDF5Constants.H5T_NATIVE_INT, space_id,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- H5.H5Dwrite (dset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT,
- dset_data);
+ dset_id = H5.H5Dcreate(file_id, SRC_DATASET[i], HDF5Constants.H5T_NATIVE_INT, space_id,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
+ H5.H5Dwrite(dset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data);
}
catch (Throwable err) {
err.printStackTrace();
@@ -119,19 +121,32 @@ public class TestH5Pvirtual {
}
finally {
if (dset_id > 0)
- try {H5.H5Dclose(dset_id);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(dset_id);
+ }
+ catch (Exception ex) {
+ }
if (space_id > 0)
- try {H5.H5Sclose(space_id);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(space_id);
+ }
+ catch (Exception ex) {
+ }
if (file_id > 0)
- try {H5.H5Fclose(file_id);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(file_id);
+ }
+ catch (Exception ex) {
+ }
}
}
try {
int[] fill_value = {-1};
- H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- H5dsid = H5.H5Screate_simple(2, VDSH5dims, null);
- H5dcplid = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE);
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
+ H5dsid = H5.H5Screate_simple(2, VDSH5dims, null);
+ H5dcplid = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE);
H5.H5Pset_fill_value(H5dcplid, HDF5Constants.H5T_NATIVE_INT, fill_value);
}
catch (Throwable err) {
@@ -151,25 +166,42 @@ public class TestH5Pvirtual {
}
@Before
- public void createH5file()
- throws NullPointerException, HDF5Exception {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void createH5file() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
_createH5File(HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
H5dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS);
assertTrue("TestH5Pvirtual.createH5file: H5.H5Pcreate: ", H5dapl_id > 0);
- }
+ }
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5dapl_id > 0)
- try {H5.H5Pclose(H5dapl_id);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(H5dapl_id);
+ }
+ catch (Exception ex) {
+ }
if (H5dcplid > 0)
- try {H5.H5Pclose(H5dcplid);} catch (Exception ex) {}
+ try {
+ H5.H5Pclose(H5dcplid);
+ }
+ catch (Exception ex) {
+ }
if (H5dsid > 0)
- try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid);
+ }
+ catch (Exception ex) {
+ }
if (H5fid > 0)
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
for (int i = 0; i < 3; i++) {
_deleteFile(SRC_FILE[i]);
}
@@ -178,12 +210,13 @@ public class TestH5Pvirtual {
}
@Test
- public void testH5Pvirtual_storage() {
+ public void testH5Pvirtual_storage()
+ {
int layout = -1;
H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id);
try {
- layout = H5.H5Pget_layout (H5dcplid);
+ layout = H5.H5Pget_layout(H5dcplid);
}
catch (Throwable err) {
err.printStackTrace();
@@ -191,15 +224,24 @@ public class TestH5Pvirtual {
}
finally {
if (H5dssid > 0)
- try {H5.H5Sclose(H5dssid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dssid);
+ }
+ catch (Exception ex) {
+ }
if (H5did > 0)
- try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception ex) {
+ }
}
assertTrue("testH5Pvirtual_storage", HDF5Constants.H5D_VIRTUAL == layout);
}
@Test
- public void testH5Pget_virtual_count() {
+ public void testH5Pget_virtual_count()
+ {
long num_map = -1;
H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id);
@@ -212,21 +254,30 @@ public class TestH5Pvirtual {
}
finally {
if (H5dssid > 0)
- try {H5.H5Sclose(H5dssid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dssid);
+ }
+ catch (Exception ex) {
+ }
if (H5did > 0)
- try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception ex) {
+ }
}
- assertTrue("testH5Pget_virtual_count: "+num_map, num_map >= 0);
+ assertTrue("testH5Pget_virtual_count: " + num_map, num_map >= 0);
assertEquals(3, num_map);
}
@Test
- public void testH5Pget_source_filename() throws Throwable {
+ public void testH5Pget_source_filename() throws Throwable
+ {
String filename = null;
H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id);
try {
- filename = (H5.H5Pget_virtual_filename (H5dcplid, 2));
+ filename = (H5.H5Pget_virtual_filename(H5dcplid, 2));
}
catch (Throwable err) {
err.printStackTrace();
@@ -234,20 +285,29 @@ public class TestH5Pvirtual {
}
finally {
if (H5dssid > 0)
- try {H5.H5Sclose(H5dssid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dssid);
+ }
+ catch (Exception ex) {
+ }
if (H5did > 0)
- try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception ex) {
+ }
}
- assertTrue("testH5Pget_source_filename: "+filename, filename.compareTo("v-2.h5") == 0);
+ assertTrue("testH5Pget_source_filename: " + filename, filename.compareTo("v-2.h5") == 0);
}
@Test
- public void testH5Pget_source_datasetname() throws Throwable {
+ public void testH5Pget_source_datasetname() throws Throwable
+ {
String datasetname = null;
H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id);
try {
- datasetname = H5.H5Pget_virtual_dsetname (H5dcplid, 1);
+ datasetname = H5.H5Pget_virtual_dsetname(H5dcplid, 1);
}
catch (Throwable err) {
err.printStackTrace();
@@ -255,21 +315,30 @@ public class TestH5Pvirtual {
}
finally {
if (H5dssid > 0)
- try {H5.H5Sclose(H5dssid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dssid);
+ }
+ catch (Exception ex) {
+ }
if (H5did > 0)
- try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception ex) {
+ }
}
- assertTrue("testH5Pget_source_datasetname: "+datasetname, datasetname.compareTo("B") == 0);
+ assertTrue("testH5Pget_source_datasetname: " + datasetname, datasetname.compareTo("B") == 0);
}
@Test
- public void testH5Pget_selection_source_dataset() throws Throwable {
- long src_space = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Pget_selection_source_dataset() throws Throwable
+ {
+ long src_space = HDF5Constants.H5I_INVALID_HID;
long src_selection = -1;
H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id);
try {
- src_space = H5.H5Pget_virtual_srcspace (H5dcplid, 0);
+ src_space = H5.H5Pget_virtual_srcspace(H5dcplid, 0);
src_selection = H5.H5Sget_select_type(src_space);
}
catch (Throwable err) {
@@ -278,17 +347,30 @@ public class TestH5Pvirtual {
}
finally {
if (src_space > 0)
- try {H5.H5Sclose(src_space);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(src_space);
+ }
+ catch (Exception ex) {
+ }
if (H5dssid > 0)
- try {H5.H5Sclose(H5dssid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dssid);
+ }
+ catch (Exception ex) {
+ }
if (H5did > 0)
- try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception ex) {
+ }
}
assertTrue("testH5Pget_selection_source_dataset", src_selection == HDF5Constants.H5S_SEL_ALL);
}
@Test
- public void testH5Pget_mapping_parameters() {
+ public void testH5Pget_mapping_parameters()
+ {
long num_map = -1;
H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id);
@@ -302,22 +384,22 @@ public class TestH5Pvirtual {
}
for (int i = 0; i < num_map; i++) {
int vselection = -1;
- long vspace = -1;
- long nblocks; // Number of hyperslab blocks
- long blocks[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; // List of blocks
- long[] start = {i, 0};
- long[] stride = {1, 1};
- long[] count = {1, 1};
- long[] block = {1, VDSDIM_Y};
- long q_start[] = new long[2];
- long q_stride[] = new long[2];
- long q_count[] = new long[2];
- long q_block[] = new long[2];
+ long vspace = -1;
+ long nblocks; // Number of hyperslab blocks
+ long blocks[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; // List of blocks
+ long[] start = {i, 0};
+ long[] stride = {1, 1};
+ long[] count = {1, 1};
+ long[] block = {1, VDSDIM_Y};
+ long q_start[] = new long[2];
+ long q_stride[] = new long[2];
+ long q_count[] = new long[2];
+ long q_block[] = new long[2];
boolean is_regular = false;
try {
try {
- vspace = H5.H5Pget_virtual_vspace (H5dcplid, i);
+ vspace = H5.H5Pget_virtual_vspace(H5dcplid, i);
}
catch (Throwable err) {
err.printStackTrace();
@@ -330,7 +412,8 @@ public class TestH5Pvirtual {
err.printStackTrace();
fail("H5.H5Sget_select_type: " + err);
}
- assertTrue("testH5Pget_mapping_parameters["+i+"]", vselection == HDF5Constants.H5S_SEL_HYPERSLABS);
+ assertTrue("testH5Pget_mapping_parameters[" + i + "]",
+ vselection == HDF5Constants.H5S_SEL_HYPERSLABS);
// Verify that there is only one block
nblocks = H5.H5Sget_select_hyper_nblocks(vspace);
@@ -340,30 +423,38 @@ public class TestH5Pvirtual {
H5.H5Sget_select_hyper_blocklist(vspace, 0, nblocks, blocks);
// Verify that the correct block is defined
- assertTrue("H5.H5Sget_select_hyper_blocklist["+i+"] [0]: "+blocks[0], start[0] == blocks[0]);
- assertTrue("H5.H5Sget_select_hyper_blocklist["+i+"] [1]: "+blocks[1], start[1] == blocks[1]);
- assertTrue("H5.H5Sget_select_hyper_blocklist["+i+"] [2]: "+blocks[2], (block[0]-1+i) == blocks[2]);
- assertTrue("H5.H5Sget_select_hyper_blocklist["+i+"] [3]: "+blocks[3], (block[1]-1) == blocks[3]);
+ assertTrue("H5.H5Sget_select_hyper_blocklist[" + i + "] [0]: " + blocks[0],
+ start[0] == blocks[0]);
+ assertTrue("H5.H5Sget_select_hyper_blocklist[" + i + "] [1]: " + blocks[1],
+ start[1] == blocks[1]);
+ assertTrue("H5.H5Sget_select_hyper_blocklist[" + i + "] [2]: " + blocks[2],
+ (block[0] - 1 + i) == blocks[2]);
+ assertTrue("H5.H5Sget_select_hyper_blocklist[" + i + "] [3]: " + blocks[3],
+ (block[1] - 1) == blocks[3]);
// We also can use new APIs to get start, stride, count and block
is_regular = H5.H5Sis_regular_hyperslab(vspace);
assertTrue("H5.H5Sis_regular_hyperslab", is_regular);
- H5.H5Sget_regular_hyperslab (vspace, q_start, q_stride, q_count, q_block);
+ H5.H5Sget_regular_hyperslab(vspace, q_start, q_stride, q_count, q_block);
// Verify the hyperslab parameters
- for(int u = 0; u < 2; u++) {
+ for (int u = 0; u < 2; u++) {
assertTrue("H5Sget_regular_hyperslab, start", start[u] == q_start[u]);
assertTrue("H5Sget_regular_hyperslab, stride", stride[u] == q_stride[u]);
assertTrue("H5Sget_regular_hyperslab, count", count[u] == q_count[u]);
assertTrue("H5Sget_regular_hyperslab, block", block[u] == q_block[u]);
}
- }
+ }
catch (Throwable err) {
err.printStackTrace();
fail("H5.testH5Pget_mapping_parameters: " + err);
}
finally {
if (vspace > 0)
- try {H5.H5Sclose(vspace);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(vspace);
+ }
+ catch (Exception ex) {
+ }
}
}
}
@@ -373,16 +464,25 @@ public class TestH5Pvirtual {
}
finally {
if (H5dssid > 0)
- try {H5.H5Sclose(H5dssid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dssid);
+ }
+ catch (Exception ex) {
+ }
if (H5did > 0)
- try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Pset_get_virtual_view() {
+ public void testH5Pset_get_virtual_view()
+ {
int ret_val = -1;
- H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id);
+ H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id);
try {
ret_val = H5.H5Pget_virtual_view(H5dapl_id);
assertTrue("H5Pget_virtual_view", ret_val >= 0);
@@ -398,16 +498,25 @@ public class TestH5Pvirtual {
}
finally {
if (H5dssid > 0)
- try {H5.H5Sclose(H5dssid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dssid);
+ }
+ catch (Exception ex) {
+ }
if (H5did > 0)
- try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Pset_get_virtual_printf_gap() {
+ public void testH5Pset_get_virtual_printf_gap()
+ {
long ret_val = -1;
- H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id);
+ H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id);
try {
ret_val = H5.H5Pget_virtual_printf_gap(H5dapl_id);
assertTrue("H5Pget_virtual_printf_gap", ret_val >= 0);
@@ -423,14 +532,23 @@ public class TestH5Pvirtual {
}
finally {
if (H5dssid > 0)
- try {H5.H5Sclose(H5dssid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dssid);
+ }
+ catch (Exception ex) {
+ }
if (H5did > 0)
- try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Pset_virtual_prefix() {
+ public void testH5Pset_virtual_prefix()
+ {
String prefix = "tmp";
try {
H5.H5Pset_virtual_prefix(H5dapl_id, prefix);
@@ -442,14 +560,16 @@ public class TestH5Pvirtual {
}
@Test(expected = NullPointerException.class)
- public void testH5Pset_virtual_prefix_null() throws Throwable{
+ public void testH5Pset_virtual_prefix_null() throws Throwable
+ {
H5.H5Pset_virtual_prefix(H5dapl_id, null);
}
@Test
- public void testH5Pget_virtual_prefix() {
+ public void testH5Pget_virtual_prefix()
+ {
String prefix = "tmp";
- String pre = "";
+ String pre = "";
try {
H5.H5Pset_virtual_prefix(H5dapl_id, prefix);
diff --git a/java/test/TestH5R.java b/java/test/TestH5R.java
index 031b8e4..4e610bc 100644
--- a/java/test/TestH5R.java
+++ b/java/test/TestH5R.java
@@ -23,8 +23,8 @@ import java.io.File;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5Exception;
-import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException;
+import hdf.hdf5lib.exceptions.HDF5LibraryException;
import org.junit.After;
import org.junit.Before;
@@ -34,38 +34,46 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5R {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_FILE = "testH5R.h5";
- private static final int DIM_X = 4;
- private static final int DIM_Y = 6;
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5dsid = HDF5Constants.H5I_INVALID_HID;
- long H5did = HDF5Constants.H5I_INVALID_HID;
- long H5gid = HDF5Constants.H5I_INVALID_HID;
- long H5did2 = HDF5Constants.H5I_INVALID_HID;
- long[] H5dims = { DIM_X, DIM_Y };
- int[][] dset_data = new int[DIM_X][DIM_Y];
- int FILLVAL = 99;
-
- private final void _deleteFile(String filename) {
+ private static final int DIM_X = 4;
+ private static final int DIM_Y = 6;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long H5gid = HDF5Constants.H5I_INVALID_HID;
+ long H5did2 = HDF5Constants.H5I_INVALID_HID;
+ long[] H5dims = {DIM_X, DIM_Y};
+ int[][] dset_data = new int[DIM_X][DIM_Y];
+ int FILLVAL = 99;
+
+ private final void _deleteFile(String filename)
+ {
File file = null;
try {
file = new File(filename);
}
- catch (Throwable err) {}
+ catch (Throwable err) {
+ }
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {e.printStackTrace();}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ e.printStackTrace();
+ }
}
assertFalse("TestH5R._deleteFile file still exists ", file.exists());
}
- private final long _createDataset(long fid, long dsid, String name, long dapl) {
+ private final long _createDataset(long fid, long dsid, String name, long dapl)
+ {
long did = HDF5Constants.H5I_INVALID_HID;
try {
- did = H5.H5Dcreate(fid, name,
- HDF5Constants.H5T_STD_I32BE, dsid,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
+ did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT, dapl);
}
catch (Throwable err) {
err.printStackTrace();
@@ -76,34 +84,35 @@ public class TestH5R {
return did;
}
- private final long _createGroup(long fid, String name) {
+ private final long _createGroup(long fid, String name)
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
try {
- gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Gcreate: " + err);
}
- assertTrue("TestH5R._createGroup: ",gid > 0);
+ assertTrue("TestH5R._createGroup: ", gid > 0);
return gid;
}
@Before
- public void createH5file()
- throws NullPointerException, HDF5Exception {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void createH5file() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
- H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5dsid = H5.H5Screate_simple(2, H5dims, null);
- H5gid = _createGroup(H5fid, "Group1");
+ H5gid = _createGroup(H5fid, "Group1");
H5did2 = _createDataset(H5gid, H5dsid, "dset2", HDF5Constants.H5P_DEFAULT);
- H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
+ H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
// Initialize the dataset.
for (int indx = 0; indx < DIM_X; indx++)
@@ -112,38 +121,57 @@ public class TestH5R {
try {
if (H5did >= 0)
- H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, dset_data[0]);
+ H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data[0]);
}
catch (Exception e) {
e.printStackTrace();
}
-
}
catch (Throwable err) {
err.printStackTrace();
fail("TestH5R.createH5file: " + err);
}
- assertTrue("TestH5R.createH5file: H5.H5Fcreate: ",H5fid > 0);
- assertTrue("TestH5R.createH5file: H5.H5Screate_simple: ",H5dsid > 0);
- assertTrue("TestH5R.createH5file: _createDataset: ",H5did > 0);
+ assertTrue("TestH5R.createH5file: H5.H5Fcreate: ", H5fid > 0);
+ assertTrue("TestH5R.createH5file: H5.H5Screate_simple: ", H5dsid > 0);
+ assertTrue("TestH5R.createH5file: _createDataset: ", H5did > 0);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5dsid > 0)
- try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid);
+ }
+ 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) {
+ }
if (H5gid > 0)
- try {H5.H5Gclose(H5gid);} catch (Exception ex) {}
+ try {
+ H5.H5Gclose(H5gid);
+ }
+ catch (Exception ex) {
+ }
if (H5did2 > 0)
- try {H5.H5Dclose(H5did2);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did2);
+ }
+ catch (Exception ex) {
+ }
_deleteFile(H5_FILE);
System.out.println();
@@ -152,11 +180,12 @@ public class TestH5R {
// Test v1.12 APIs params
@Test
- public void testH5Rget_object() {
- int ref_type = HDF5Constants.H5R_OBJECT2;
- long ret_val = -1;
- byte[] ref = null;
- String name = "";
+ public void testH5Rget_object()
+ {
+ int ref_type = HDF5Constants.H5R_OBJECT2;
+ long ret_val = -1;
+ byte[] ref = null;
+ String name = "";
String objName = "/dset";
try {
@@ -197,9 +226,10 @@ public class TestH5R {
}
@Test
- public void testH5Rget_obj_type3() {
- int obj_type = -1;
- byte[] ref = null;
+ public void testH5Rget_obj_type3()
+ {
+ int obj_type = -1;
+ byte[] ref = null;
String objName = "/dset";
try {
@@ -222,13 +252,14 @@ public class TestH5R {
}
@Test
- public void testH5Rcreate_regionref_object() {
- byte[] ref = null;
+ public void testH5Rcreate_regionref_object()
+ {
+ byte[] ref = null;
String objName = "/dset";
- long start[] = {2,2}; // Starting location of hyperslab
- long stride[] = {1,1}; // Stride of hyperslab
- long count[] = {1,1}; // Element count of hyperslab
- long block[] = {3,3}; // Block size of hyperslab
+ long start[] = {2, 2}; // Starting location of hyperslab
+ long stride[] = {1, 1}; // Stride of hyperslab
+ long count[] = {1, 1}; // Element count of hyperslab
+ long block[] = {3, 3}; // Block size of hyperslab
// Select 3x3 hyperslab for reference
try {
@@ -249,235 +280,252 @@ public class TestH5R {
H5.H5Rdestroy(ref);
}
-// These tests need to be updated with new APIs
-// @Test//
-// public void testH5Rget_group() {
-// long loc_id = H5fid;
-// int ref_type = HDF5Constants.H5R_OBJECT2;
-// long ret_val = -1;
-// byte[] ref = null;
-// String name = "";
-// String objName = "/dset";
-//
-// try {
-// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("testH5Rget_object: H5Rcreate_object " + err);
-// }
-// try {
-// dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1);
-//
-// //Create reference on group
-// ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1);
-// group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2);
-// assertNotNull(ref1);
-// assertNotNull(ref2);
-// assertTrue(dataset_id >= 0);
-// assertTrue(group_id >= 0);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("TestH5Rdereference " + err);
-// }
-// finally {
-// try {H5.H5Dclose(dataset_id);} catch (Exception ex) {}
-// try {H5.H5Gclose(group_id);} catch (Exception ex) {}
-// }
-// }
-
-// @Test//
-// public void testH5Rget_region_dataset() {
-// long loc_id = H5fid;
-// int ref_type = HDF5Constants.H5R_OBJECT2;
-// long ret_val = -1;
-// byte[] ref = null;
-// String name = "";
-// String objName = "/dset";
-//
-// try {
-// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("testH5Rget_object: H5Rcreate_object " + err);
-// }
-// try {
-// dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref);
-// assertNotNull(ref);
-// assertTrue(dsid >= 0);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("TestH5Rget_region: " + err);
-// }
-// finally {
-// try {H5.H5Sclose(dsid);} catch (Exception ex) {}
-// }
-// }
-
-// @Test//
-// public void testH5Rget_attr() {
-// long loc_id = H5fid;
-// int ref_type = HDF5Constants.H5R_OBJECT2;
-// long ret_val = -1;
-// byte[] ref = null;
-// String name = "";
-// String objName = "/dset";
-//
-// try {
-// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("testH5Rget_object: H5Rcreate_object " + err);
-// }
-// try {
-// dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref);
-// assertNotNull(ref);
-// assertTrue(dsid >= 0);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("TestH5Rget_region: " + err);
-// }
-// finally {
-// try {H5.H5Sclose(dsid);} catch (Exception ex) {}
-// }
-// }
+ // These tests need to be updated with new APIs
+ // @Test//
+ // public void testH5Rget_group() {
+ // long loc_id = H5fid;
+ // int ref_type = HDF5Constants.H5R_OBJECT2;
+ // long ret_val = -1;
+ // byte[] ref = null;
+ // String name = "";
+ // String objName = "/dset";
+ //
+ // try {
+ // ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("testH5Rget_object: H5Rcreate_object " + err);
+ // }
+ // try {
+ // dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT,
+ // HDF5Constants.H5R_DATASET_REGION, ref1);
+ //
+ // //Create reference on group
+ // ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1);
+ // group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT,
+ // ref2); assertNotNull(ref1); assertNotNull(ref2); assertTrue(dataset_id >= 0);
+ // assertTrue(group_id >= 0);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("TestH5Rdereference " + err);
+ // }
+ // finally {
+ // try {H5.H5Dclose(dataset_id);} catch (Exception ex) {}
+ // try {H5.H5Gclose(group_id);} catch (Exception ex) {}
+ // }
+ // }
+
+ // @Test//
+ // public void testH5Rget_region_dataset() {
+ // long loc_id = H5fid;
+ // int ref_type = HDF5Constants.H5R_OBJECT2;
+ // long ret_val = -1;
+ // byte[] ref = null;
+ // String name = "";
+ // String objName = "/dset";
+ //
+ // try {
+ // ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("testH5Rget_object: H5Rcreate_object " + err);
+ // }
+ // try {
+ // dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref);
+ // assertNotNull(ref);
+ // assertTrue(dsid >= 0);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("TestH5Rget_region: " + err);
+ // }
+ // finally {
+ // try {H5.H5Sclose(dsid);} catch (Exception ex) {}
+ // }
+ // }
+
+ // @Test//
+ // public void testH5Rget_attr() {
+ // long loc_id = H5fid;
+ // int ref_type = HDF5Constants.H5R_OBJECT2;
+ // long ret_val = -1;
+ // byte[] ref = null;
+ // String name = "";
+ // String objName = "/dset";
+ //
+ // try {
+ // ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("testH5Rget_object: H5Rcreate_object " + err);
+ // }
+ // try {
+ // dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref);
+ // assertNotNull(ref);
+ // assertTrue(dsid >= 0);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("TestH5Rget_region: " + err);
+ // }
+ // finally {
+ // try {H5.H5Sclose(dsid);} catch (Exception ex) {}
+ // }
+ // }
// Test parameters to H5Rcreate_object
@Test(expected = NullPointerException.class)
- public void testH5Rcreate_object_Nullname() throws Throwable {
+ public void testH5Rcreate_object_Nullname() throws Throwable
+ {
String name = null;
H5.H5Rcreate_object(H5fid, name, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5FunctionArgumentException.class)
- public void testH5Rget_name_Invalidloc() throws Throwable {
- String name= "";
+ public void testH5Rget_name_Invalidloc() throws Throwable
+ {
+ String name = "";
H5.H5Rcreate_object(-1, name, HDF5Constants.H5P_DEFAULT);
}
// Test parameters to H5Rcreate_region
@Test(expected = NullPointerException.class)
- public void testH5Rcreate_region_Nullname() throws Throwable {
+ public void testH5Rcreate_region_Nullname() throws Throwable
+ {
String name = null;
H5.H5Rcreate_region(H5fid, name, -1, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5FunctionArgumentException.class)
- public void testH5Rcreate_region_Invalidloc() throws Throwable {
- String name= "";
+ public void testH5Rcreate_region_Invalidloc() throws Throwable
+ {
+ String name = "";
H5.H5Rcreate_region(-1, name, -1, HDF5Constants.H5P_DEFAULT);
}
// Test parameters to H5Rcreate_attr
@Test(expected = NullPointerException.class)
- public void testH5Rcreate_attr_Nullname() throws Throwable {
- String name = null;
+ public void testH5Rcreate_attr_Nullname() throws Throwable
+ {
+ String name = null;
String attrname = "";
H5.H5Rcreate_attr(H5fid, name, attrname, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = NullPointerException.class)
- public void testH5Rcreate_attr_Nullattrname() throws Throwable {
- String name = "";
+ public void testH5Rcreate_attr_Nullattrname() throws Throwable
+ {
+ String name = "";
String attrname = null;
H5.H5Rcreate_attr(H5fid, name, attrname, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5FunctionArgumentException.class)
- public void testH5Rcreate_attr_Invalidloc() throws Throwable {
- String name= "";
- String attrname= "";
+ public void testH5Rcreate_attr_Invalidloc() throws Throwable
+ {
+ String name = "";
+ String attrname = "";
H5.H5Rcreate_attr(-1, name, attrname, HDF5Constants.H5P_DEFAULT);
}
// Test parameters to H5Rdestroy
@Test(expected = NullPointerException.class)
- public void testH5Rdestroy_Nullref() throws Throwable {
+ public void testH5Rdestroy_Nullref() throws Throwable
+ {
byte[] ref = null;
H5.H5Rdestroy(ref);
}
// Test parameters to H5Rget_type
@Test(expected = NullPointerException.class)
- public void testH5Rget_type_Nullref() throws Throwable {
+ public void testH5Rget_type_Nullref() throws Throwable
+ {
byte[] ref = null;
H5.H5Rget_type(ref);
}
// Test parameters to H5Requal
@Test(expected = NullPointerException.class)
- public void testH5Requal_Nullref1() throws Throwable {
+ public void testH5Requal_Nullref1() throws Throwable
+ {
byte[] ref1 = null;
- byte[] ref2 = {0,0,0,0};
+ byte[] ref2 = {0, 0, 0, 0};
H5.H5Requal(ref1, ref2);
}
@Test(expected = NullPointerException.class)
- public void testH5Requal_Nullref2() throws Throwable {
- byte[] ref1 = {0,0,0,0};
+ public void testH5Requal_Nullref2() throws Throwable
+ {
+ byte[] ref1 = {0, 0, 0, 0};
byte[] ref2 = null;
H5.H5Requal(ref1, ref2);
}
// Test parameters to H5Rcopy
@Test(expected = NullPointerException.class)
- public void testH5Rcopy_Nullref1() throws Throwable {
+ public void testH5Rcopy_Nullref1() throws Throwable
+ {
byte[] ref1 = null;
byte[] ref2 = H5.H5Rcopy(ref1);
}
// Test parameters to H5Ropen_object
@Test(expected = NullPointerException.class)
- public void testH5Ropen_object_Nullref() throws Throwable {
+ public void testH5Ropen_object_Nullref() throws Throwable
+ {
byte[] ref = null;
H5.H5Ropen_object(ref, -1, -1);
}
// Test parameters to H5Ropen_region
@Test(expected = NullPointerException.class)
- public void testH5Ropen_region_Nullref() throws Throwable {
+ public void testH5Ropen_region_Nullref() throws Throwable
+ {
byte[] ref = null;
H5.H5Ropen_region(ref, -1, -1);
}
// Test parameters to H5Ropen_attr
@Test(expected = NullPointerException.class)
- public void testH5Ropen_attr_Nullref() throws Throwable {
+ public void testH5Ropen_attr_Nullref() throws Throwable
+ {
byte[] ref = null;
H5.H5Ropen_attr(ref, -1, -1);
}
// Test parameters to H5Rget_obj_type3
@Test(expected = NullPointerException.class)
- public void testH5Rget_obj_type3_Nullref() throws Throwable {
+ public void testH5Rget_obj_type3_Nullref() throws Throwable
+ {
byte[] ref = null;
H5.H5Rget_obj_type3(ref, -1);
}
// Test parameters to H5Rget_file_name
@Test(expected = NullPointerException.class)
- public void testH5Rget_file_name_Nullref() throws Throwable {
+ public void testH5Rget_file_name_Nullref() throws Throwable
+ {
byte[] ref = null;
H5.H5Rget_file_name(ref);
}
// Test parameters to H5Rget_obj_name
@Test(expected = NullPointerException.class)
- public void testH5Rget_obj_name_Nullref() throws Throwable {
+ public void testH5Rget_obj_name_Nullref() throws Throwable
+ {
byte[] ref = null;
H5.H5Rget_obj_name(ref, -1);
}
// Test parameters to H5Rget_attr_name
@Test(expected = NullPointerException.class)
- public void testH5Rget_attr_name_Nullref() throws Throwable {
+ public void testH5Rget_attr_name_Nullref() throws Throwable
+ {
byte[] ref = null;
H5.H5Rget_attr_name(ref);
}
-
}
diff --git a/java/test/TestH5Rref.java b/java/test/TestH5Rref.java
index 5733aae..520de74 100644
--- a/java/test/TestH5Rref.java
+++ b/java/test/TestH5Rref.java
@@ -23,8 +23,8 @@ import java.io.File;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5Exception;
-import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException;
+import hdf.hdf5lib.exceptions.HDF5LibraryException;
import org.junit.After;
import org.junit.Before;
@@ -34,14 +34,16 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Rref {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_DREG_FILE = "trefer_reg.h5";
private static final String H5_AREG_FILE = "trefer_attr.h5";
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5dsid = HDF5Constants.H5I_INVALID_HID;
- long H5did = HDF5Constants.H5I_INVALID_HID;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
- private boolean byteArrayCheck(final byte[] array) {
+ private boolean byteArrayCheck(final byte[] array)
+ {
for (byte b : array) {
if (b != 0) {
return false;
@@ -50,67 +52,81 @@ public class TestH5Rref {
return true;
}
- 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("TestH5R._openH5file: " + err);
- }
- assertTrue("TestH5R._openH5file: H5.H5Fopen: ", H5fid >= 0);
- try {
- H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("TestH5R._openH5file: " + err);
- }
- assertTrue("TestH5R._openH5file: H5.H5Dopen: ", H5did >= 0);
- try {
- H5dsid = H5.H5Dget_space(H5did);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("TestH5R._openH5file: " + err);
- }
- assertTrue("TestH5R._openH5file: H5.H5Screate_simple: ",H5dsid > 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("TestH5R._openH5file: " + err);
+ }
+ assertTrue("TestH5R._openH5file: H5.H5Fopen: ", H5fid >= 0);
+ try {
+ H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5R._openH5file: " + err);
+ }
+ assertTrue("TestH5R._openH5file: H5.H5Dopen: ", H5did >= 0);
+ try {
+ H5dsid = H5.H5Dget_space(H5did);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5R._openH5file: " + err);
+ }
+ assertTrue("TestH5R._openH5file: H5.H5Screate_simple: ", H5dsid > 0);
}
@After
- public void closeH5file() throws HDF5LibraryException {
+ public void closeH5file() throws HDF5LibraryException
+ {
if (H5did >= 0)
- try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ try {
+ H5.H5Dclose(H5did);
+ }
+ catch (Exception ex) {
+ }
if (H5dsid > 0)
- try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5dsid);
+ }
+ catch (Exception ex) {
+ }
if (H5fid > 0)
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = HDF5Constants.H5I_INVALID_HID;
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
+ H5fid = HDF5Constants.H5I_INVALID_HID;
H5dsid = HDF5Constants.H5I_INVALID_HID;
- H5did = 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);
+ public void verifyCount() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
}
// Test v1.12 APIs params
@Test
- public void testH5Rget_object() {
- int ref_type = HDF5Constants.H5R_OBJECT1;
- long f_type = HDF5Constants.H5I_INVALID_HID;
- int obj_type = -1;
- int ndims = 1;
- long ret_val = -1;
+ public void testH5Rget_object()
+ {
+ int ref_type = HDF5Constants.H5R_OBJECT1;
+ long f_type = HDF5Constants.H5I_INVALID_HID;
+ int obj_type = -1;
+ int ndims = 1;
+ long ret_val = -1;
byte[][] refbuf = null;
- String name = "";
- String objName = "/DS_NA";
+ String name = "";
+ String objName = "/DS_NA";
try {
openH5file(H5_DREG_FILE, objName);
@@ -120,18 +136,22 @@ public class TestH5Rref {
fail("testH5Rget_object: openH5file: " + err);
}
try {
- f_type = H5.H5Dget_type(H5did);
+ f_type = H5.H5Dget_type(H5did);
int result = H5.H5Tget_class(f_type);
assertTrue("testH5Rget_object: H5Tget_class", result > 0);
String class_name = H5.H5Tget_class_name(result);
- assertTrue("testH5Rget_object: H5Tget_class", class_name.compareTo("H5T_REFERENCE")==0);
+ assertTrue("testH5Rget_object: H5Tget_class", class_name.compareTo("H5T_REFERENCE") == 0);
}
catch (Throwable err) {
err.printStackTrace();
fail("testH5Rget_object: " + err);
}
finally {
- try {H5.H5Tclose(f_type);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(f_type);
+ }
+ catch (Exception ex) {
+ }
}
try {
ndims = (int)H5.H5Sget_simple_extent_npoints(H5dsid);
@@ -143,9 +163,8 @@ public class TestH5Rref {
refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE];
// Read the reference from the dataset.
try {
- H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, refbuf);
+ H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, refbuf);
}
catch (Exception err) {
err.printStackTrace();
@@ -155,7 +174,7 @@ public class TestH5Rref {
for (int i = 0; i < ndims; i++) {
try {
ret_val = H5.H5Rget_type(refbuf[i]);
- assertTrue("testH5Rget_object: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type);
+ assertTrue("testH5Rget_object: H5Rget_type[" + i + "]=" + ret_val, ret_val == ref_type);
if (!byteArrayCheck(refbuf[i])) {
try {
obj_type = H5.H5Rget_obj_type3(refbuf[i], HDF5Constants.H5P_DEFAULT);
@@ -178,14 +197,15 @@ public class TestH5Rref {
}
@Test
- public void testH5Rget_obj_type3() {
- long f_type = HDF5Constants.H5I_INVALID_HID;
- int ref_type = HDF5Constants.H5R_DATASET_REGION2;
- int obj_type = -1;
- int ndims = 1;
- long ret_val = -1;
+ public void testH5Rget_obj_type3()
+ {
+ long f_type = HDF5Constants.H5I_INVALID_HID;
+ int ref_type = HDF5Constants.H5R_DATASET_REGION2;
+ int obj_type = -1;
+ int ndims = 1;
+ long ret_val = -1;
byte[][] refbuf = null;
- String objName = "/Dataset1";
+ String objName = "/Dataset1";
try {
openH5file(H5_DREG_FILE, objName);
@@ -195,18 +215,23 @@ public class TestH5Rref {
fail("testH5Rget_obj_type3: openH5file: " + err);
}
try {
- f_type = H5.H5Dget_type(H5did);
+ f_type = H5.H5Dget_type(H5did);
int result = H5.H5Tget_class(f_type);
assertTrue("testH5Rget_obj_type3: H5Tget_class", result > 0);
String class_name = H5.H5Tget_class_name(result);
- assertTrue("testH5Rget_obj_type3: H5Tget_class="+class_name, class_name.compareTo("H5T_REFERENCE")==0);
+ assertTrue("testH5Rget_obj_type3: H5Tget_class=" + class_name,
+ class_name.compareTo("H5T_REFERENCE") == 0);
}
catch (Throwable err) {
err.printStackTrace();
fail("testH5Rget_obj_type3: " + err);
}
finally {
- try {H5.H5Tclose(f_type);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(f_type);
+ }
+ catch (Exception ex) {
+ }
}
try {
ndims = (int)H5.H5Sget_simple_extent_npoints(H5dsid);
@@ -218,9 +243,8 @@ public class TestH5Rref {
refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE];
// Read the reference from the dataset.
try {
- H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, refbuf);
+ H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, refbuf);
}
catch (Exception err) {
err.printStackTrace();
@@ -230,7 +254,7 @@ public class TestH5Rref {
for (int i = 0; i < ndims; i++) {
try {
ret_val = H5.H5Rget_type(refbuf[i]);
- assertTrue("testH5Rget_obj_type3: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type);
+ assertTrue("testH5Rget_obj_type3: H5Rget_type[" + i + "]=" + ret_val, ret_val == ref_type);
if (!byteArrayCheck(refbuf[i])) {
try {
obj_type = H5.H5Rget_obj_type3(refbuf[i], HDF5Constants.H5P_DEFAULT);
@@ -252,312 +276,341 @@ public class TestH5Rref {
}
}
- @Test
- public void testH5Rget_region_dataset() {
- long f_type = HDF5Constants.H5I_INVALID_HID;
- long loc_id = HDF5Constants.H5I_INVALID_HID;
- long loc_sid = HDF5Constants.H5I_INVALID_HID;
- int ref_type = HDF5Constants.H5R_DATASET_REGION2;
- int ndims = 1;
- long ret_val = -1;
- byte[][] refbuf = null;
- String name = "";
- String objName = "/Dataset1";
-
- try {
- openH5file(H5_DREG_FILE, objName);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("testH5Rget_region_dataset: openH5file: " + err);
- }
- try {
- f_type = H5.H5Dget_type(H5did);
- int result = H5.H5Tget_class(f_type);
- assertTrue("testH5Rget_region_dataset: H5Tget_class", result > 0);
- String class_name = H5.H5Tget_class_name(result);
- assertTrue("testH5Rget_region_dataset: H5Tget_class="+class_name, class_name.compareTo("H5T_REFERENCE")==0);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("testH5Rget_region_dataset: " + err);
- }
- finally {
- try {H5.H5Tclose(f_type);} catch (Exception ex) {}
- }
- try {
- ndims = (int)H5.H5Sget_simple_extent_npoints(H5dsid);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("testH5Rget_region_dataset: H5Sget_simple_extent_ndims: " + err);
- }
- refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE];
- // Read the reference from the dataset.
- try {
- H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, refbuf);
- }
- catch (Exception err) {
- err.printStackTrace();
- fail("testH5Rget_obj_type3: H5Dread: " + err);
- }
- for (int i = 0; i < ndims; i++) {
- try {
- try {
- ret_val = H5.H5Rget_type(refbuf[i]);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("testH5Rget_region_dataset: H5Rget_type["+i+"]: " + err);
- }
- assertTrue("testH5Rget_region_dataset: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type);
- try {
- loc_id = H5.H5Ropen_object(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- assertTrue(loc_id >= 0);
- try {
- loc_sid = H5.H5Ropen_region(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- assertTrue(loc_sid >= 0);
- int region_type = -1;
- try {
- int reg_ndims = H5.H5Sget_simple_extent_ndims(loc_sid);
- region_type = H5.H5Sget_select_type(loc_sid);
- if (i == 1)
- assertTrue(region_type == HDF5Constants.H5S_SEL_POINTS);
- else
- assertTrue(region_type == HDF5Constants.H5S_SEL_HYPERSLABS);
- if (region_type == HDF5Constants.H5S_SEL_POINTS) {
- long reg_npoints = H5.H5Sget_select_elem_npoints(loc_sid);
- // Coordinates for get point selection
- long getcoord[] = new long[reg_ndims * (int)reg_npoints];
- // Known coordinates for point selection
- long coord[][] = {{6,9},{2,2},{8,4},{1,6},{2,8},{3,2},
- {0,4},{9,0},{7,1},{3,3}};
- try {
- H5.H5Sget_select_elem_pointlist(loc_sid, 0, reg_npoints, getcoord);
- assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][0] == getcoord[0]);
- assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][1] == getcoord[1]);
- assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][0] == getcoord[2]);
- assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][1] == getcoord[3]);
- assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][0] == getcoord[4]);
- assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][1] == getcoord[5]);
- }
- catch (Throwable err3) {
- err3.printStackTrace();
- fail("H5.H5Sget_select_elem_pointlist: " + err3);
- }
- }
- else if (region_type == HDF5Constants.H5S_SEL_HYPERSLABS) {
- long reg_nblocks = H5.H5Sget_select_hyper_nblocks(loc_sid);
- assertTrue("H5Sget_select_hyper_nblocks", reg_nblocks == 1);
- // Coordinates for get block selection
- long getblocks[] = new long[reg_ndims * (int)reg_nblocks * 2];
- long start[] = {2,2};
- long block[] = {8,8};
- try {
- H5.H5Sget_select_hyper_blocklist(loc_sid, 0, reg_nblocks, getblocks);
- assertTrue("H5.H5Sget_select_hyper_blocklist", start[0] == getblocks[0]);
- assertTrue("H5.H5Sget_select_hyper_blocklist", start[1] == getblocks[1]);
- assertTrue("H5.H5Sget_select_hyper_blocklist", (block[0]-1) == getblocks[2]);
- assertTrue("H5.H5Sget_select_hyper_blocklist", (block[1]-1) == getblocks[3]);
- }
- catch (Throwable err3) {
- err3.printStackTrace();
- fail("H5.H5Sget_select_hyper_blocklist: " + err3);
- }
- }
- }
- catch (Throwable err2) {
- err2.printStackTrace();
- assertTrue("testH5Rget_region_dataset: H5Sget_select_type: " + err2, i > 1);
- }
- }
- catch (Throwable err1) {
- err1.printStackTrace();
- fail("testH5Rget_region_dataset: " + err1);
- }
- finally {
- try {H5.H5Sclose(loc_sid);} catch (Exception ex) {}
- }
- }
- catch (Throwable err0) {
- err0.printStackTrace();
- fail("testH5Rget_region_dataset: " + err0);
- }
- finally {
- try {H5.H5Dclose(loc_id);} catch (Exception ex) {}
- }
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("testH5Rget_region_dataset: H5Rget_type: " + err);
- }
- finally {
- H5.H5Rdestroy(refbuf[i]);
- }
- } //for (int i = 0; i < ndims; i++)
- }
-
- @Test
- public void testH5Rget_region_attribute() {
- long f_type = HDF5Constants.H5I_INVALID_HID;
- long loc_id = HDF5Constants.H5I_INVALID_HID;
- long loc_sid = HDF5Constants.H5I_INVALID_HID;
- int ref_type = HDF5Constants.H5R_ATTR;
- int obj_type = -1;
- int ndims = 1;
- long ret_val = -1;
- byte[][] refbuf = null;
- String objName = "/Dataset3";
+ @Test
+ public void testH5Rget_region_dataset()
+ {
+ long f_type = HDF5Constants.H5I_INVALID_HID;
+ long loc_id = HDF5Constants.H5I_INVALID_HID;
+ long loc_sid = HDF5Constants.H5I_INVALID_HID;
+ int ref_type = HDF5Constants.H5R_DATASET_REGION2;
+ int ndims = 1;
+ long ret_val = -1;
+ byte[][] refbuf = null;
+ String name = "";
+ String objName = "/Dataset1";
- try {
- openH5file(H5_AREG_FILE, objName);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("testH5Rget_region_attribute: openH5file: " + err);
- }
- try {
- f_type = H5.H5Dget_type(H5did);
- int result = H5.H5Tget_class(f_type);
- assertTrue("testH5Rget_region_attribute: H5Tget_class", result > 0);
- String class_name = H5.H5Tget_class_name(result);
- assertTrue("testH5Rget_region_attribute: H5Tget_class="+class_name, class_name.compareTo("H5T_REFERENCE")==0);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("testH5Rget_region_attribute: " + err);
- }
- finally {
- try {H5.H5Tclose(f_type);} catch (Exception ex) {}
- }
- try {
- ndims = (int)H5.H5Sget_simple_extent_npoints(H5dsid);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("testH5Rget_region_attribute: H5Sget_simple_extent_ndims: " + err);
- }
- refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE];
- // Read the reference from the dataset.
- try {
- H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF,
- HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
- HDF5Constants.H5P_DEFAULT, refbuf);
- }
- catch (Exception err) {
- err.printStackTrace();
- fail("testH5Rget_region_attribute: H5Dread: " + err);
- }
+ try {
+ openH5file(H5_DREG_FILE, objName);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_dataset: openH5file: " + err);
+ }
+ try {
+ f_type = H5.H5Dget_type(H5did);
+ int result = H5.H5Tget_class(f_type);
+ assertTrue("testH5Rget_region_dataset: H5Tget_class", result > 0);
+ String class_name = H5.H5Tget_class_name(result);
+ assertTrue("testH5Rget_region_dataset: H5Tget_class=" + class_name,
+ class_name.compareTo("H5T_REFERENCE") == 0);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_dataset: " + err);
+ }
+ finally {
+ try {
+ H5.H5Tclose(f_type);
+ }
+ catch (Exception ex) {
+ }
+ }
+ try {
+ ndims = (int)H5.H5Sget_simple_extent_npoints(H5dsid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_dataset: H5Sget_simple_extent_ndims: " + err);
+ }
+ refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE];
+ // Read the reference from the dataset.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, refbuf);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Rget_obj_type3: H5Dread: " + err);
+ }
+ for (int i = 0; i < ndims; i++) {
+ try {
+ try {
+ ret_val = H5.H5Rget_type(refbuf[i]);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_dataset: H5Rget_type[" + i + "]: " + err);
+ }
+ assertTrue("testH5Rget_region_dataset: H5Rget_type[" + i + "]=" + ret_val,
+ ret_val == ref_type);
+ try {
+ loc_id =
+ H5.H5Ropen_object(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ assertTrue(loc_id >= 0);
+ try {
+ loc_sid = H5.H5Ropen_region(refbuf[i], HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
+ assertTrue(loc_sid >= 0);
+ int region_type = -1;
+ try {
+ int reg_ndims = H5.H5Sget_simple_extent_ndims(loc_sid);
+ region_type = H5.H5Sget_select_type(loc_sid);
+ if (i == 1)
+ assertTrue(region_type == HDF5Constants.H5S_SEL_POINTS);
+ else
+ assertTrue(region_type == HDF5Constants.H5S_SEL_HYPERSLABS);
+ if (region_type == HDF5Constants.H5S_SEL_POINTS) {
+ long reg_npoints = H5.H5Sget_select_elem_npoints(loc_sid);
+ // Coordinates for get point selection
+ long getcoord[] = new long[reg_ndims * (int)reg_npoints];
+ // Known coordinates for point selection
+ long coord[][] = {{6, 9}, {2, 2}, {8, 4}, {1, 6}, {2, 8},
+ {3, 2}, {0, 4}, {9, 0}, {7, 1}, {3, 3}};
+ try {
+ H5.H5Sget_select_elem_pointlist(loc_sid, 0, reg_npoints, getcoord);
+ assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][0] == getcoord[0]);
+ assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][1] == getcoord[1]);
+ assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][0] == getcoord[2]);
+ assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][1] == getcoord[3]);
+ assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][0] == getcoord[4]);
+ assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][1] == getcoord[5]);
+ }
+ catch (Throwable err3) {
+ err3.printStackTrace();
+ fail("H5.H5Sget_select_elem_pointlist: " + err3);
+ }
+ }
+ else if (region_type == HDF5Constants.H5S_SEL_HYPERSLABS) {
+ long reg_nblocks = H5.H5Sget_select_hyper_nblocks(loc_sid);
+ assertTrue("H5Sget_select_hyper_nblocks", reg_nblocks == 1);
+ // Coordinates for get block selection
+ long getblocks[] = new long[reg_ndims * (int)reg_nblocks * 2];
+ long start[] = {2, 2};
+ long block[] = {8, 8};
+ try {
+ H5.H5Sget_select_hyper_blocklist(loc_sid, 0, reg_nblocks, getblocks);
+ assertTrue("H5.H5Sget_select_hyper_blocklist", start[0] == getblocks[0]);
+ assertTrue("H5.H5Sget_select_hyper_blocklist", start[1] == getblocks[1]);
+ assertTrue("H5.H5Sget_select_hyper_blocklist",
+ (block[0] - 1) == getblocks[2]);
+ assertTrue("H5.H5Sget_select_hyper_blocklist",
+ (block[1] - 1) == getblocks[3]);
+ }
+ catch (Throwable err3) {
+ err3.printStackTrace();
+ fail("H5.H5Sget_select_hyper_blocklist: " + err3);
+ }
+ }
+ }
+ catch (Throwable err2) {
+ err2.printStackTrace();
+ assertTrue("testH5Rget_region_dataset: H5Sget_select_type: " + err2, i > 1);
+ }
+ }
+ catch (Throwable err1) {
+ err1.printStackTrace();
+ fail("testH5Rget_region_dataset: " + err1);
+ }
+ finally {
+ try {
+ H5.H5Sclose(loc_sid);
+ }
+ catch (Exception ex) {
+ }
+ }
+ }
+ catch (Throwable err0) {
+ err0.printStackTrace();
+ fail("testH5Rget_region_dataset: " + err0);
+ }
+ finally {
+ try {
+ H5.H5Dclose(loc_id);
+ }
+ catch (Exception ex) {
+ }
+ }
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_dataset: H5Rget_type: " + err);
+ }
+ finally {
+ H5.H5Rdestroy(refbuf[i]);
+ }
+ } // for (int i = 0; i < ndims; i++)
+ }
- for (int i = 0; i < ndims; i++) {
- try {
- ret_val = H5.H5Rget_type(refbuf[i]);
- assertTrue("testH5Rget_region_attribute: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type);
- try {
- loc_id = H5.H5Ropen_attr(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- assertTrue(loc_id >= 0);
- if (!byteArrayCheck(refbuf[i])) {
- try {
- loc_sid = H5.H5Aget_space(loc_id);
- assertTrue(loc_sid >= 0);
- }
- catch (Throwable err1) {
- err1.printStackTrace();
- fail("testH5Rget_region_attribute: " + err1);
- }
- finally {
- try {H5.H5Sclose(loc_sid);} catch (Exception ex) {}
- }
- }
- }
- catch (Throwable err0) {
- err0.printStackTrace();
- // second attribute is null
- assertTrue("testH5Rget_region_attribute: " + err0, i == 1);
- }
- finally {
- try {H5.H5Aclose(loc_id);} catch (Exception ex) {}
- }
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("testH5Rget_region_attribute: H5Rget_type: " + err);
- }
- finally {
- H5.H5Rdestroy(refbuf[i]);
- }
- }
- }
+ @Test
+ public void testH5Rget_region_attribute()
+ {
+ long f_type = HDF5Constants.H5I_INVALID_HID;
+ long loc_id = HDF5Constants.H5I_INVALID_HID;
+ long loc_sid = HDF5Constants.H5I_INVALID_HID;
+ int ref_type = HDF5Constants.H5R_ATTR;
+ int obj_type = -1;
+ int ndims = 1;
+ long ret_val = -1;
+ byte[][] refbuf = null;
+ String objName = "/Dataset3";
+ try {
+ openH5file(H5_AREG_FILE, objName);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_attribute: openH5file: " + err);
+ }
+ try {
+ f_type = H5.H5Dget_type(H5did);
+ int result = H5.H5Tget_class(f_type);
+ assertTrue("testH5Rget_region_attribute: H5Tget_class", result > 0);
+ String class_name = H5.H5Tget_class_name(result);
+ assertTrue("testH5Rget_region_attribute: H5Tget_class=" + class_name,
+ class_name.compareTo("H5T_REFERENCE") == 0);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_attribute: " + err);
+ }
+ finally {
+ try {
+ H5.H5Tclose(f_type);
+ }
+ catch (Exception ex) {
+ }
+ }
+ try {
+ ndims = (int)H5.H5Sget_simple_extent_npoints(H5dsid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_attribute: H5Sget_simple_extent_ndims: " + err);
+ }
+ refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE];
+ // Read the reference from the dataset.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, refbuf);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_attribute: H5Dread: " + err);
+ }
-// These tests need to be updated with new APIs
-// @Test//
-// public void testH5Rget_group() {
-// long loc_id = H5fid;
-// int ref_type = HDF5Constants.H5R_OBJECT2;
-// long ret_val = -1;
-// byte[] ref = null;
-// String name = "";
-// String objName = "/dset";
-//
-// try {
-// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("testH5Rget_object: H5Rcreate_object " + err);
-// }
-// try {
-// dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1);
-//
-// //Create reference on group
-// ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1);
-// group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2);
-// assertNotNull(ref1);
-// assertNotNull(ref2);
-// assertTrue(dataset_id >= 0);
-// assertTrue(group_id >= 0);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("TestH5Rdereference " + err);
-// }
-// finally {
-// try {H5.H5Dclose(dataset_id);} catch (Exception ex) {}
-// try {H5.H5Gclose(group_id);} catch (Exception ex) {}
-// }
-// }
+ for (int i = 0; i < ndims; i++) {
+ try {
+ ret_val = H5.H5Rget_type(refbuf[i]);
+ assertTrue("testH5Rget_region_attribute: H5Rget_type[" + i + "]=" + ret_val,
+ ret_val == ref_type);
+ try {
+ loc_id = H5.H5Ropen_attr(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ assertTrue(loc_id >= 0);
+ if (!byteArrayCheck(refbuf[i])) {
+ try {
+ loc_sid = H5.H5Aget_space(loc_id);
+ assertTrue(loc_sid >= 0);
+ }
+ catch (Throwable err1) {
+ err1.printStackTrace();
+ fail("testH5Rget_region_attribute: " + err1);
+ }
+ finally {
+ try {
+ H5.H5Sclose(loc_sid);
+ }
+ catch (Exception ex) {
+ }
+ }
+ }
+ }
+ catch (Throwable err0) {
+ err0.printStackTrace();
+ // second attribute is null
+ assertTrue("testH5Rget_region_attribute: " + err0, i == 1);
+ }
+ finally {
+ try {
+ H5.H5Aclose(loc_id);
+ }
+ catch (Exception ex) {
+ }
+ }
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_attribute: H5Rget_type: " + err);
+ }
+ finally {
+ H5.H5Rdestroy(refbuf[i]);
+ }
+ }
+ }
-// @Test//
-// public void testH5Rget_attr() {
-// long loc_id = H5fid;
-// int ref_type = HDF5Constants.H5R_OBJECT2;
-// long ret_val = -1;
-// byte[] ref = null;
-// String name = "";
-// String objName = "/dset";
-//
-// try {
-// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("testH5Rget_object: H5Rcreate_object " + err);
-// }
-// try {
-// dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref);
-// assertNotNull(ref);
-// assertTrue(dsid >= 0);
-// }
-// catch (Throwable err) {
-// err.printStackTrace();
-// fail("TestH5Rget_region: " + err);
-// }
-// finally {
-// try {H5.H5Sclose(dsid);} catch (Exception ex) {}
-// }
-// }
+ // These tests need to be updated with new APIs
+ // @Test//
+ // public void testH5Rget_group() {
+ // long loc_id = H5fid;
+ // int ref_type = HDF5Constants.H5R_OBJECT2;
+ // long ret_val = -1;
+ // byte[] ref = null;
+ // String name = "";
+ // String objName = "/dset";
+ //
+ // try {
+ // ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("testH5Rget_object: H5Rcreate_object " + err);
+ // }
+ // try {
+ // dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT,
+ // HDF5Constants.H5R_DATASET_REGION, ref1);
+ //
+ // //Create reference on group
+ // ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1);
+ // group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT,
+ // ref2); assertNotNull(ref1); assertNotNull(ref2); assertTrue(dataset_id >= 0);
+ // assertTrue(group_id >= 0);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("TestH5Rdereference " + err);
+ // }
+ // finally {
+ // try {H5.H5Dclose(dataset_id);} catch (Exception ex) {}
+ // try {H5.H5Gclose(group_id);} catch (Exception ex) {}
+ // }
+ // }
+ // @Test//
+ // public void testH5Rget_attr() {
+ // long loc_id = H5fid;
+ // int ref_type = HDF5Constants.H5R_OBJECT2;
+ // long ret_val = -1;
+ // byte[] ref = null;
+ // String name = "";
+ // String objName = "/dset";
+ //
+ // try {
+ // ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("testH5Rget_object: H5Rcreate_object " + err);
+ // }
+ // try {
+ // dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref);
+ // assertNotNull(ref);
+ // assertTrue(dsid >= 0);
+ // }
+ // catch (Throwable err) {
+ // err.printStackTrace();
+ // fail("TestH5Rget_region: " + err);
+ // }
+ // finally {
+ // try {H5.H5Sclose(dsid);} catch (Exception ex) {}
+ // }
+ // }
}
diff --git a/java/test/TestH5S.java b/java/test/TestH5S.java
index 7eeed7a..6e081a6 100644
--- a/java/test/TestH5S.java
+++ b/java/test/TestH5S.java
@@ -12,10 +12,10 @@
package test;
-
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5Exception;
@@ -28,16 +28,17 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5S {
- @Rule public TestName testname = new TestName();
- long H5sid = HDF5Constants.H5I_INVALID_HID;
- int H5rank = 2;
- long H5dims[] = {5, 5};
- long H5maxdims[] = {10, 10};
+ @Rule
+ public TestName testname = new TestName();
+ long H5sid = HDF5Constants.H5I_INVALID_HID;
+ int H5rank = 2;
+ long H5dims[] = {5, 5};
+ long H5maxdims[] = {10, 10};
@Before
- public void createH5file()
- throws NullPointerException, HDF5Exception {
- assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0);
+ public void createH5file() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
H5sid = H5.H5Screate_simple(H5rank, H5dims, H5maxdims);
@@ -45,15 +46,21 @@ public class TestH5S {
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5sid > 0) {
- try {H5.H5Sclose(H5sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(H5sid);
+ }
+ catch (Exception ex) {
+ }
}
System.out.println();
}
@Test
- public void testH5Sget_simple_extent_ndims() {
+ public void testH5Sget_simple_extent_ndims()
+ {
int read_rank = -1;
try {
read_rank = H5.H5Sget_simple_extent_ndims(H5sid);
@@ -66,7 +73,8 @@ public class TestH5S {
}
@Test
- public void testH5Sget_simple_extent_dims_null() {
+ public void testH5Sget_simple_extent_dims_null()
+ {
int read_rank = -1;
try {
@@ -80,9 +88,10 @@ public class TestH5S {
}
@Test
- public void testH5Sget_simple_extent_dims() {
- int read_rank = -1;
- long dims[] = {5, 5};
+ public void testH5Sget_simple_extent_dims()
+ {
+ int read_rank = -1;
+ long dims[] = {5, 5};
long maxdims[] = {10, 10};
try {
@@ -98,11 +107,12 @@ public class TestH5S {
}
@Test
- public void testH5Sget_simple_extent_npoints() {
+ public void testH5Sget_simple_extent_npoints()
+ {
long num_elements = -1;
try {
num_elements = H5.H5Sget_simple_extent_npoints(H5sid);
- assertTrue("H5.H5Sget_simple_extent_npoints", (H5dims[0]*H5dims[1]) == num_elements);
+ assertTrue("H5.H5Sget_simple_extent_npoints", (H5dims[0] * H5dims[1]) == num_elements);
}
catch (Throwable err) {
err.printStackTrace();
@@ -111,7 +121,8 @@ public class TestH5S {
}
@Test
- public void testH5Sget_simple_extent_type() {
+ public void testH5Sget_simple_extent_type()
+ {
int read_type = -1;
try {
read_type = H5.H5Sget_simple_extent_type(H5sid);
@@ -124,7 +135,8 @@ public class TestH5S {
}
@Test
- public void testH5Sis_simple() {
+ public void testH5Sis_simple()
+ {
boolean result = false;
try {
@@ -138,12 +150,13 @@ public class TestH5S {
}
@Test
- public void testH5Sset_extent_simple() {
+ public void testH5Sset_extent_simple()
+ {
long num_elements = -1;
try {
H5.H5Sset_extent_simple(H5sid, H5rank, H5maxdims, H5maxdims);
num_elements = H5.H5Sget_simple_extent_npoints(H5sid);
- assertTrue("H5.H5Sget_simple_extent_npoints", (H5maxdims[0]*H5maxdims[1]) == num_elements);
+ assertTrue("H5.H5Sget_simple_extent_npoints", (H5maxdims[0] * H5maxdims[1]) == num_elements);
}
catch (Throwable err) {
err.printStackTrace();
@@ -152,7 +165,8 @@ public class TestH5S {
}
@Test
- public void testH5Sget_select_type() {
+ public void testH5Sget_select_type()
+ {
int read_type = -1;
try {
read_type = H5.H5Sget_select_type(H5sid);
@@ -165,12 +179,13 @@ public class TestH5S {
}
@Test
- public void testH5Sset_extent_none() {
+ public void testH5Sset_extent_none()
+ {
int read_type = -1;
try {
H5.H5Sset_extent_none(H5sid);
read_type = H5.H5Sget_simple_extent_type(H5sid);
- assertTrue("H5.H5Sget_simple_extent_type: "+read_type, HDF5Constants.H5S_NULL == read_type);
+ assertTrue("H5.H5Sget_simple_extent_type: " + read_type, HDF5Constants.H5S_NULL == read_type);
}
catch (Throwable err) {
err.printStackTrace();
@@ -179,8 +194,9 @@ public class TestH5S {
}
@Test
- public void testH5Scopy() {
- long sid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Scopy()
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
int read_rank = -1;
try {
@@ -194,13 +210,18 @@ public class TestH5S {
fail("H5.H5Scopy: " + err);
}
finally {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Sextent_copy() {
- long sid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Sextent_copy()
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
try {
@@ -215,18 +236,23 @@ public class TestH5S {
fail("H5.H5Sextent_copy: " + err);
}
finally {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Sextent_equal() {
- long sid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Sextent_equal()
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
boolean result = false;
try {
sid = H5.H5Screate(HDF5Constants.H5S_NULL);
- assertTrue("H5.H5Screate_null",sid > 0);
+ assertTrue("H5.H5Screate_null", sid > 0);
}
catch (Throwable err) {
err.printStackTrace();
@@ -235,7 +261,7 @@ public class TestH5S {
try {
result = H5.H5Sextent_equal(sid, H5sid);
- assertFalse("H5.testH5Sextent_equal",result);
+ assertFalse("H5.testH5Sextent_equal", result);
H5.H5Sextent_copy(sid, H5sid);
result = H5.H5Sextent_equal(sid, H5sid);
assertTrue("H5.testH5Sextent_equal", result);
@@ -245,16 +271,21 @@ public class TestH5S {
fail("H5.H5Sextent_copy " + err);
}
finally {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Sencode_decode_null_dataspace() {
- long sid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Sencode_decode_null_dataspace()
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
long decoded_sid = HDF5Constants.H5I_INVALID_HID;
byte[] null_sbuf = null;
- boolean result = false;
+ boolean result = false;
try {
sid = H5.H5Screate(HDF5Constants.H5S_NULL);
@@ -267,21 +298,25 @@ public class TestH5S {
try {
null_sbuf = H5.H5Sencode(sid);
- assertFalse("H5.testH5Sencode", null_sbuf==null);
+ assertFalse("H5.testH5Sencode", null_sbuf == null);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Sencode " + err);
}
finally {
- if(null_sbuf == null) {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ if (null_sbuf == null) {
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
try {
decoded_sid = H5.H5Sdecode(null_sbuf);
- assertTrue("H5.testH5Sdecode", decoded_sid>0);
+ assertTrue("H5.testH5Sdecode", decoded_sid > 0);
result = H5.H5Sextent_equal(sid, decoded_sid);
assertTrue("H5.testH5Sextent_equal", result);
@@ -291,19 +326,28 @@ public class TestH5S {
fail("H5.H5Sdecode " + err);
}
finally {
- try {H5.H5Sclose(decoded_sid);} catch (Exception ex) {}
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(decoded_sid);
+ }
+ catch (Exception ex) {
+ }
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Sencode_decode_scalar_dataspace() {
- long sid = HDF5Constants.H5I_INVALID_HID;
- long decoded_sid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Sencode_decode_scalar_dataspace()
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
+ long decoded_sid = HDF5Constants.H5I_INVALID_HID;
byte[] scalar_sbuf = null;
- boolean result = false;
- int iresult = -1;
- long lresult = -1;
+ boolean result = false;
+ int iresult = -1;
+ long lresult = -1;
try {
sid = H5.H5Screate(HDF5Constants.H5S_SCALAR);
@@ -316,52 +360,65 @@ public class TestH5S {
try {
scalar_sbuf = H5.H5Sencode(sid);
- assertFalse("H5.testH5Sencode", scalar_sbuf==null);
+ assertFalse("H5.testH5Sencode", scalar_sbuf == null);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Sencode " + err);
}
finally {
- if(scalar_sbuf == null) {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ if (scalar_sbuf == null) {
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
try {
decoded_sid = H5.H5Sdecode(scalar_sbuf);
- assertTrue("H5.testH5Sdecode", decoded_sid>0);
+ assertTrue("H5.testH5Sdecode", decoded_sid > 0);
result = H5.H5Sextent_equal(sid, decoded_sid);
assertTrue("H5.testH5Sextent_equal", result);
/* Verify decoded dataspace */
lresult = H5.H5Sget_simple_extent_npoints(decoded_sid);
- assertTrue("H5.testH5Sget_simple_extent_npoints", lresult==1);
+ assertTrue("H5.testH5Sget_simple_extent_npoints", lresult == 1);
iresult = H5.H5Sget_simple_extent_ndims(decoded_sid);
- assertTrue("H5.testH5Sget_simple_extent_ndims", iresult==0);
+ assertTrue("H5.testH5Sget_simple_extent_ndims", iresult == 0);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Sdecode " + err);
}
finally {
- try {H5.H5Sclose(decoded_sid);} catch (Exception ex) {}
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(decoded_sid);
+ }
+ catch (Exception ex) {
+ }
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Sselect_none() {
+ public void testH5Sselect_none()
+ {
int read_type = -1;
try {
H5.H5Sselect_none(H5sid);
read_type = H5.H5Sget_select_type(H5sid);
- assertTrue("H5.H5Sget_select_type: "+read_type, HDF5Constants.H5S_SEL_NONE == read_type);
+ assertTrue("H5.H5Sget_select_type: " + read_type, HDF5Constants.H5S_SEL_NONE == read_type);
H5.H5Sselect_all(H5sid);
read_type = H5.H5Sget_select_type(H5sid);
- assertTrue("H5.H5Sget_select_type: "+read_type, HDF5Constants.H5S_SEL_ALL == read_type);
+ assertTrue("H5.H5Sget_select_type: " + read_type, HDF5Constants.H5S_SEL_ALL == read_type);
}
catch (Throwable err) {
err.printStackTrace();
@@ -370,13 +427,14 @@ public class TestH5S {
}
@Test
- public void testH5Sget_select_npoints() {
- long coord[][] = {{0,1},{2,4},{5,6}}; /* Coordinates for point selection */
+ public void testH5Sget_select_npoints()
+ {
+ long coord[][] = {{0, 1}, {2, 4}, {5, 6}}; /* Coordinates for point selection */
long num_elements = -1;
try {
H5.H5Sselect_elements(H5sid, HDF5Constants.H5S_SELECT_SET, 3, coord);
num_elements = H5.H5Sget_select_npoints(H5sid);
- assertTrue("H5.H5Sget_select_npoints: "+num_elements, 3 == num_elements);
+ assertTrue("H5.H5Sget_select_npoints: " + num_elements, 3 == num_elements);
}
catch (Throwable err) {
err.printStackTrace();
@@ -385,9 +443,10 @@ public class TestH5S {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Sget_select_elem_pointlist_invalid() throws Throwable {
- long coord[][] = {{0,1},{2,4},{5,6}}; /* Coordinates for point selection */
- long getcoord[] = {-1,-1}; /* Coordinates for get point selection */
+ public void testH5Sget_select_elem_pointlist_invalid() throws Throwable
+ {
+ long coord[][] = {{0, 1}, {2, 4}, {5, 6}}; /* Coordinates for point selection */
+ long getcoord[] = {-1, -1}; /* Coordinates for get point selection */
try {
H5.H5Sselect_elements(H5sid, HDF5Constants.H5S_SELECT_SET, 3, coord);
}
@@ -399,9 +458,10 @@ public class TestH5S {
}
@Test
- public void testH5Sget_select_elem_pointlist() {
- long coord[][] = {{0,1},{2,3},{4,5}}; /* Coordinates for point selection */
- long getcoord[] = {-1,-1,-1,-1,-1,-1}; /* Coordinates for get point selection */
+ public void testH5Sget_select_elem_pointlist()
+ {
+ long coord[][] = {{0, 1}, {2, 3}, {4, 5}}; /* Coordinates for point selection */
+ long getcoord[] = {-1, -1, -1, -1, -1, -1}; /* Coordinates for get point selection */
try {
H5.H5Sselect_elements(H5sid, HDF5Constants.H5S_SELECT_SET, 3, coord);
H5.H5Sget_select_elem_pointlist(H5sid, 0, 3, getcoord);
@@ -419,15 +479,16 @@ public class TestH5S {
}
@Test
- public void testH5Sget_select_bounds() {
- long lowbounds[] = {-1,-1};
- long hibounds[] = {-1,-1};
+ public void testH5Sget_select_bounds()
+ {
+ long lowbounds[] = {-1, -1};
+ long hibounds[] = {-1, -1};
try {
H5.H5Sget_select_bounds(H5sid, lowbounds, hibounds);
assertTrue("H5.H5Sget_select_bounds", 0 == lowbounds[0]);
assertTrue("H5.H5Sget_select_bounds", 0 == lowbounds[1]);
- assertTrue("H5.H5Sget_select_bounds", (H5dims[0]-1) == hibounds[0]);
- assertTrue("H5.H5Sget_select_bounds", (H5dims[1]-1) == hibounds[1]);
+ assertTrue("H5.H5Sget_select_bounds", (H5dims[0] - 1) == hibounds[0]);
+ assertTrue("H5.H5Sget_select_bounds", (H5dims[1] - 1) == hibounds[1]);
}
catch (Throwable err) {
err.printStackTrace();
@@ -436,30 +497,31 @@ public class TestH5S {
}
@Test
- public void testH5Soffset_simple() {
- long coord[][] = {{2,2},{2,4},{4,2},{4,4}}; /* Coordinates for point selection */
- long lowbounds[] = {-1,-1};
- long hibounds[] = {-1,-1};
+ public void testH5Soffset_simple()
+ {
+ long coord[][] = {{2, 2}, {2, 4}, {4, 2}, {4, 4}}; /* Coordinates for point selection */
+ long lowbounds[] = {-1, -1};
+ long hibounds[] = {-1, -1};
try {
H5.H5Sselect_elements(H5sid, HDF5Constants.H5S_SELECT_SET, 4, coord);
H5.H5Sget_select_bounds(H5sid, lowbounds, hibounds);
assertTrue("H5.H5Sget_select_bounds", 2 == lowbounds[0]);
assertTrue("H5.H5Sget_select_bounds", 2 == lowbounds[1]);
- assertTrue("H5.H5Sget_select_bounds", (H5dims[0]-1) == hibounds[0]);
- assertTrue("H5.H5Sget_select_bounds", (H5dims[1]-1) == hibounds[1]);
+ assertTrue("H5.H5Sget_select_bounds", (H5dims[0] - 1) == hibounds[0]);
+ assertTrue("H5.H5Sget_select_bounds", (H5dims[1] - 1) == hibounds[1]);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Sget_select_bounds: " + err);
}
try {
- long offset[] = {-1,-1};
+ long offset[] = {-1, -1};
H5.H5Soffset_simple(H5sid, offset);
H5.H5Sget_select_bounds(H5sid, lowbounds, hibounds);
assertTrue("H5.H5Sget_select_bounds", 1 == lowbounds[0]);
assertTrue("H5.H5Sget_select_bounds", 1 == lowbounds[1]);
- assertTrue("H5.H5Sget_select_bounds", (H5dims[0]-2) == hibounds[0]);
- assertTrue("H5.H5Sget_select_bounds", (H5dims[1]-2) == hibounds[1]);
+ assertTrue("H5.H5Sget_select_bounds", (H5dims[0] - 2) == hibounds[0]);
+ assertTrue("H5.H5Sget_select_bounds", (H5dims[1] - 2) == hibounds[1]);
}
catch (Throwable err) {
err.printStackTrace();
@@ -468,14 +530,15 @@ public class TestH5S {
}
@Test
- public void testH5Sget_select_hyper() {
- long space1 = HDF5Constants.H5I_INVALID_HID;
- long start[] = {0,0};
- long stride[] = {1,1};
- long count[] = {1,1};
- long block[] = {4,4};
- long nblocks; // Number of hyperslab blocks
- long blocks[] = {-1, -1, -1, -1, -1, -1, -1, -1}; // List of blocks
+ public void testH5Sget_select_hyper()
+ {
+ long space1 = HDF5Constants.H5I_INVALID_HID;
+ long start[] = {0, 0};
+ long stride[] = {1, 1};
+ long count[] = {1, 1};
+ long block[] = {4, 4};
+ long nblocks; // Number of hyperslab blocks
+ long blocks[] = {-1, -1, -1, -1, -1, -1, -1, -1}; // List of blocks
try {
// Copy "all" selection & space
space1 = H5.H5Scopy(H5sid);
@@ -493,26 +556,31 @@ public class TestH5S {
// Verify that the correct block is defined
assertTrue("H5.H5Sget_select_hyper_blocklist", start[0] == blocks[0]);
assertTrue("H5.H5Sget_select_hyper_blocklist", start[1] == blocks[1]);
- assertTrue("H5.H5Sget_select_hyper_blocklist", (block[0]-1) == blocks[2]);
- assertTrue("H5.H5Sget_select_hyper_blocklist", (block[1]-1) == blocks[3]);
+ assertTrue("H5.H5Sget_select_hyper_blocklist", (block[0] - 1) == blocks[2]);
+ assertTrue("H5.H5Sget_select_hyper_blocklist", (block[1] - 1) == blocks[3]);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Sget_select_bounds: " + err);
}
finally {
- try {H5.H5Sclose(space1);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(space1);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Sget_select_valid() {
- long space1 = HDF5Constants.H5I_INVALID_HID;
- long start[] = {1,0};
- long stride[] = {1,1};
- long count[] = {2,3};
- long block[] = {1,1};
- long offset[] = {0,0}; // Offset of selection
+ public void testH5Sget_select_valid()
+ {
+ long space1 = HDF5Constants.H5I_INVALID_HID;
+ long start[] = {1, 0};
+ long stride[] = {1, 1};
+ long count[] = {2, 3};
+ long block[] = {1, 1};
+ long offset[] = {0, 0}; // Offset of selection
try {
// Copy "all" selection & space
@@ -522,20 +590,20 @@ public class TestH5S {
H5.H5Sselect_hyperslab(space1, HDF5Constants.H5S_SELECT_SET, start, stride, count, block);
// Check a valid offset
- offset[0]=-1;
- offset[1]=0;
+ offset[0] = -1;
+ offset[1] = 0;
H5.H5Soffset_simple(space1, offset);
assertTrue("H5Sselect_valid", H5.H5Sselect_valid(space1));
// Check an invalid offset
- offset[0]=10;
- offset[1]=0;
+ offset[0] = 10;
+ offset[1] = 0;
H5.H5Soffset_simple(space1, offset);
assertFalse("H5Sselect_valid", H5.H5Sselect_valid(space1));
/* Reset offset */
- offset[0]=0;
- offset[1]=0;
+ offset[0] = 0;
+ offset[1] = 0;
H5.H5Soffset_simple(space1, offset);
assertTrue("H5Sselect_valid", H5.H5Sselect_valid(space1));
}
@@ -544,20 +612,25 @@ public class TestH5S {
fail("testH5Sget_select_valid: " + err);
}
finally {
- try {H5.H5Sclose(space1);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(space1);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Shyper_regular() {
- long start[] = {1,0};
- long stride[] = {1,1};
- long count[] = {2,3};
- long block[] = {1,1};
- long q_start[] = new long[2];
- long q_stride[] = new long[2];
- long q_count[] = new long[2];
- long q_block[] = new long[2];
+ public void testH5Shyper_regular()
+ {
+ long start[] = {1, 0};
+ long stride[] = {1, 1};
+ long count[] = {2, 3};
+ long block[] = {1, 1};
+ long q_start[] = new long[2];
+ long q_stride[] = new long[2];
+ long q_count[] = new long[2];
+ long q_block[] = new long[2];
boolean is_regular = false;
try {
@@ -572,7 +645,7 @@ public class TestH5S {
H5.H5Sget_regular_hyperslab(H5sid, q_start, q_stride, q_count, q_block);
/* Verify the hyperslab parameters */
- for(int u = 0; u < H5rank; u++) {
+ for (int u = 0; u < H5rank; u++) {
assertTrue("H5Sget_regular_hyperslab, start", start[u] == q_start[u]);
assertTrue("H5Sget_regular_hyperslab, stride", stride[u] == q_stride[u]);
assertTrue("H5Sget_regular_hyperslab, count", count[u] == q_count[u]);
diff --git a/java/test/TestH5Sbasic.java b/java/test/TestH5Sbasic.java
index 548ac95..3b92c92 100644
--- a/java/test/TestH5Sbasic.java
+++ b/java/test/TestH5Sbasic.java
@@ -14,6 +14,7 @@ package test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
@@ -25,56 +26,68 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Sbasic {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
@Before
- public void checkOpenIDs() {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void checkOpenIDs()
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
}
@After
- public void nextTestName() {
+ public void nextTestName()
+ {
System.out.println();
}
- @Test//(expected = HDF5LibraryException.class)
- public void testH5Sclose_invalid() throws Throwable {
+ @Test //(expected = HDF5LibraryException.class)
+ public void testH5Sclose_invalid() throws Throwable
+ {
long sid = H5.H5Sclose(-1);
assertTrue(sid == 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Screate_invalid() throws Throwable {
+ public void testH5Screate_invalid() throws Throwable
+ {
H5.H5Screate(-1);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Sget_simple_extent_type_invalid() throws Throwable {
+ public void testH5Sget_simple_extent_type_invalid() throws Throwable
+ {
H5.H5Sget_simple_extent_type(-1);
}
@Test
- public void testH5Screate_scalar() {
- long sid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Screate_scalar()
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
try {
sid = H5.H5Screate(HDF5Constants.H5S_SCALAR);
- assertTrue("H5.H5Screate_scalar",sid > 0);
+ assertTrue("H5.H5Screate_scalar", sid > 0);
class_type = H5.H5Sget_simple_extent_type(sid);
- assertTrue("H5.H5Screate_scalar: type",class_type == HDF5Constants.H5S_SCALAR);
+ assertTrue("H5.H5Screate_scalar: type", class_type == HDF5Constants.H5S_SCALAR);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Screate: " + err);
}
finally {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Screate_null() {
- long sid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Screate_null()
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
try {
sid = H5.H5Screate(HDF5Constants.H5S_NULL);
@@ -87,47 +100,56 @@ public class TestH5Sbasic {
fail("H5.H5Screate: " + err);
}
finally {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test(expected = NullPointerException.class)
- public void testH5Screate_simple_dims_null() throws Throwable {
+ public void testH5Screate_simple_dims_null() throws Throwable
+ {
H5.H5Screate_simple(2, (long[])null, null);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Screate_simple_rank_invalid() throws Throwable {
+ public void testH5Screate_simple_rank_invalid() throws Throwable
+ {
long dims[] = {5, 5};
H5.H5Screate_simple(-1, dims, null);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Screate_simple_dims_invalid() throws Throwable {
+ public void testH5Screate_simple_dims_invalid() throws Throwable
+ {
long dims[] = {2, 2};
H5.H5Screate_simple(5, dims, null);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Screate_simple_dims_exceed() throws Throwable {
- long dims[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
- 21,22,23,24,25,26,27,28,29,30,31,32,33,35};
+ public void testH5Screate_simple_dims_exceed() throws Throwable
+ {
+ long dims[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35};
H5.H5Screate_simple(35, dims, null);
}
-//H5Screate_simple was changed to allow a dim of 0
-// @Ignore(expected = HDF5LibraryException.class)
-// public void testH5Screate_simple_dims_zero() {
-// long dims[] = {0, 0};
-// H5.H5Screate_simple(2, dims, null);
-// }
+ // H5Screate_simple was changed to allow a dim of 0
+ // @Ignore(expected = HDF5LibraryException.class)
+ // public void testH5Screate_simple_dims_zero() {
+ // long dims[] = {0, 0};
+ // H5.H5Screate_simple(2, dims, null);
+ // }
@Test
- public void testH5Screate_simple() {
- long sid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Screate_simple()
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
- int rank = 2;
- long dims[] = {5, 5};
+ int rank = 2;
+ long dims[] = {5, 5};
long maxdims[] = {10, 10};
try {
@@ -141,16 +163,21 @@ public class TestH5Sbasic {
fail("H5.H5Screate_simple: " + err);
}
finally {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Screate_simple_unlimted() {
- long sid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Screate_simple_unlimted()
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
- int rank = 2;
- long dims[] = {5, 5};
+ int rank = 2;
+ long dims[] = {5, 5};
long maxdims[] = {HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED};
try {
@@ -164,16 +191,21 @@ public class TestH5Sbasic {
fail("H5.H5Screate_simple: " + err);
}
finally {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Screate_simple_unlimted_1d() {
- long sid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Screate_simple_unlimted_1d()
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
- int rank = 1;
- long dims[] = {5};
+ int rank = 1;
+ long dims[] = {5};
long maxdims[] = {HDF5Constants.H5S_UNLIMITED};
try {
@@ -187,14 +219,19 @@ public class TestH5Sbasic {
fail("H5.H5Screate_simple: " + err);
}
finally {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Screate_simple_max_default() {
- long sid = HDF5Constants.H5I_INVALID_HID;
- int rank = 2;
+ public void testH5Screate_simple_max_default()
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
+ int rank = 2;
long dims[] = {5, 5};
try {
@@ -206,20 +243,25 @@ public class TestH5Sbasic {
fail("H5.H5Screate_simple: " + err);
}
finally {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Screate_simple_extent() {
- long sid = HDF5Constants.H5I_INVALID_HID;
- int rank = 2;
- long dims[] = {5, 5};
+ public void testH5Screate_simple_extent()
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
+ int rank = 2;
+ long dims[] = {5, 5};
long maxdims[] = {10, 10};
try {
sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE);
- assertTrue("H5.H5Screate_simple_extent",sid > 0);
+ assertTrue("H5.H5Screate_simple_extent", sid > 0);
H5.H5Sset_extent_simple(sid, rank, dims, maxdims);
}
catch (Throwable err) {
@@ -227,156 +269,195 @@ public class TestH5Sbasic {
fail("H5.H5Screate: " + err);
}
finally {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Sencode_invalid() throws Throwable {
+ public void testH5Sencode_invalid() throws Throwable
+ {
H5.H5Sencode(-1);
}
@Test(expected = NullPointerException.class)
- public void testH5Sdecode_null() throws Throwable {
+ public void testH5Sdecode_null() throws Throwable
+ {
H5.H5Sdecode(null);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Sget_regular_hyperslab_invalid() throws Throwable {
- long q_start[] = new long[2];
+ public void testH5Sget_regular_hyperslab_invalid() throws Throwable
+ {
+ long q_start[] = new long[2];
long q_stride[] = new long[2];
- long q_count[] = new long[2];
- long q_block[] = new long[2];
+ long q_count[] = new long[2];
+ long q_block[] = new long[2];
H5.H5Sget_regular_hyperslab(-1, q_start, q_stride, q_count, q_block);
}
@Test(expected = hdf.hdf5lib.exceptions.HDF5FunctionArgumentException.class)
- public void testH5Sselect_copy_invalid() throws Throwable {
+ public void testH5Sselect_copy_invalid() throws Throwable
+ {
H5.H5Sselect_copy(-1, -1);
}
@Test(expected = hdf.hdf5lib.exceptions.HDF5DataspaceInterfaceException.class)
- public void testH5Sselect_shape_same_invalid() throws Throwable {
+ public void testH5Sselect_shape_same_invalid() throws Throwable
+ {
H5.H5Sselect_shape_same(-1, -1);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Sselect_adjust_invalid() throws Throwable {
- long offset[][] = {{0,1},{2,4},{5,6}};
+ public void testH5Sselect_adjust_invalid() throws Throwable
+ {
+ long offset[][] = {{0, 1}, {2, 4}, {5, 6}};
H5.H5Sselect_adjust(-1, offset);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Sselect_adjust_rank_offset() throws Throwable {
- long sid = HDF5Constants.H5I_INVALID_HID;
- long offset[][] = {{0,1},{2,4},{5,6}};
+ public void testH5Sselect_adjust_rank_offset() throws Throwable
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
+ long offset[][] = {{0, 1}, {2, 4}, {5, 6}};
try {
sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE);
- assertTrue("H5.H5Screate_simple_extent",sid > 0);
+ assertTrue("H5.H5Screate_simple_extent", sid > 0);
H5.H5Sselect_adjust(sid, offset);
}
finally {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Sselect_intersect_block_invalid() throws Throwable {
+ public void testH5Sselect_intersect_block_invalid() throws Throwable
+ {
long start[] = new long[2];
- long end[] = new long[2];
+ long end[] = new long[2];
H5.H5Sselect_intersect_block(-1, start, end);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Sselect_intersect_block_rank_start() throws Throwable {
- long sid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Sselect_intersect_block_rank_start() throws Throwable
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
long start[] = new long[2];
- long end[] = null;
+ long end[] = null;
try {
sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE);
- assertTrue("H5.H5Screate_simple_extent",sid > 0);
+ assertTrue("H5.H5Screate_simple_extent", sid > 0);
H5.H5Sselect_intersect_block(sid, start, end);
}
finally {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Sselect_intersect_block_rank_end() throws Throwable {
- long sid = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Sselect_intersect_block_rank_end() throws Throwable
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
long start[] = null;
- long end[] = new long[2];
+ long end[] = new long[2];
try {
sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE);
- assertTrue("H5.H5Screate_simple_extent",sid > 0);
+ assertTrue("H5.H5Screate_simple_extent", sid > 0);
H5.H5Sselect_intersect_block(sid, start, end);
}
finally {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test(expected = hdf.hdf5lib.exceptions.HDF5DataspaceInterfaceException.class)
- public void testH5Sselect_project_intersection_invalid() throws Throwable {
+ public void testH5Sselect_project_intersection_invalid() throws Throwable
+ {
H5.H5Sselect_project_intersection(-1, -1, -1);
}
@Test(expected = hdf.hdf5lib.exceptions.HDF5FunctionArgumentException.class)
- public void testH5Scombine_hyperslab_invalid() throws Throwable {
+ public void testH5Scombine_hyperslab_invalid() throws Throwable
+ {
long start[] = new long[2];
long count[] = new long[2];
H5.H5Scombine_hyperslab(-1, 0, start, null, count, null);
}
@Test(expected = NullPointerException.class)
- public void testH5Scombine_hyperslab_null_start() throws Throwable {
- long sid = HDF5Constants.H5I_INVALID_HID;
- long start[] = null;
+ public void testH5Scombine_hyperslab_null_start() throws Throwable
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
+ long start[] = null;
long stride[] = null;
- long count[] = new long[2];
- long block[] = null;
+ long count[] = new long[2];
+ long block[] = null;
try {
sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE);
- assertTrue("H5.H5Screate_simple_extent",sid > 0);
+ assertTrue("H5.H5Screate_simple_extent", sid > 0);
H5.H5Scombine_hyperslab(sid, 0, start, stride, count, block);
}
finally {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test(expected = NullPointerException.class)
- public void testH5Scombine_hyperslab_null_count() throws Throwable {
- long sid = HDF5Constants.H5I_INVALID_HID;
- long start[] = new long[2];
+ public void testH5Scombine_hyperslab_null_count() throws Throwable
+ {
+ long sid = HDF5Constants.H5I_INVALID_HID;
+ long start[] = new long[2];
long stride[] = null;
- long count[] = null;
- long block[] = null;
+ long count[] = null;
+ long block[] = null;
try {
sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE);
- assertTrue("H5.H5Screate_simple_extent",sid > 0);
+ assertTrue("H5.H5Screate_simple_extent", sid > 0);
H5.H5Scombine_hyperslab(sid, 0, start, stride, count, block);
}
finally {
- try {H5.H5Sclose(sid);} catch (Exception ex) {}
+ try {
+ H5.H5Sclose(sid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test(expected = hdf.hdf5lib.exceptions.HDF5FunctionArgumentException.class)
- public void testH5Smodify_select_invalid() throws Throwable {
+ public void testH5Smodify_select_invalid() throws Throwable
+ {
H5.H5Smodify_select(-1, 0, -1);
}
@Test(expected = hdf.hdf5lib.exceptions.HDF5FunctionArgumentException.class)
- public void testH5Scombine_select_invalid() throws Throwable {
+ public void testH5Scombine_select_invalid() throws Throwable
+ {
H5.H5Scombine_select(-1, 0, -1);
}
-
}
diff --git a/java/test/TestH5T.java b/java/test/TestH5T.java
index ed4e2a9..0121cc2 100644
--- a/java/test/TestH5T.java
+++ b/java/test/TestH5T.java
@@ -30,30 +30,38 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5T {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_FILE = "testT.h5";
- long H5fid = HDF5Constants.H5I_INVALID_HID;
- long H5strdid = HDF5Constants.H5I_INVALID_HID;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5strdid = HDF5Constants.H5I_INVALID_HID;
- private final void _deleteFile(String filename) {
+ private final void _deleteFile(String filename)
+ {
File file = null;
try {
file = new File(filename);
}
- catch (Throwable err) {}
+ catch (Throwable err) {
+ }
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
@Before
- public void createH5file() throws NullPointerException, HDF5Exception {
- assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0);
+ public void createH5file() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
- H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
assertTrue("H5.H5Fcreate", H5fid > 0);
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
assertTrue("H5.H5Tcopy", H5strdid > 0);
@@ -62,28 +70,39 @@ public class TestH5T {
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5strdid >= 0)
- try {H5.H5Tclose(H5strdid);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(H5strdid);
+ }
+ catch (Exception ex) {
+ }
if (H5fid > 0)
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
_deleteFile(H5_FILE);
System.out.println();
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tequal_type_error() throws Throwable {
+ public void testH5Tequal_type_error() throws Throwable
+ {
H5.H5Tequal(HDF5Constants.H5T_INTEGER, H5strdid);
}
@Test
- public void testH5Tget_class() {
+ public void testH5Tget_class()
+ {
try {
int result = H5.H5Tget_class(H5strdid);
assertTrue("H5.H5Tget_class", result > 0);
String class_name = H5.H5Tget_class_name(result);
- assertTrue("H5.H5Tget_class", class_name.compareTo("H5T_STRING")==0);
+ assertTrue("H5.H5Tget_class", class_name.compareTo("H5T_STRING") == 0);
}
catch (Throwable err) {
err.printStackTrace();
@@ -92,7 +111,8 @@ public class TestH5T {
}
@Test
- public void testH5Tget_size() {
+ public void testH5Tget_size()
+ {
long dt_size = -1;
try {
@@ -106,7 +126,8 @@ public class TestH5T {
}
@Test
- public void testH5Tset_size() {
+ public void testH5Tset_size()
+ {
long dt_size = 5;
try {
@@ -127,89 +148,105 @@ public class TestH5T {
}
@Test
- public void testH5Tarray_create() {
- long filetype_id = HDF5Constants.H5I_INVALID_HID;
- long[] adims = { 3, 5 };
-
- try {
- filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims);
- assertTrue("testH5Tarray_create", filetype_id >= 0);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("testH5Tarray_create.H5Tarray_create " + err);
- }
- finally {
- if (filetype_id >= 0)
- try {H5.H5Tclose(filetype_id);} catch (Exception ex) {}
- }
+ public void testH5Tarray_create()
+ {
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ long[] adims = {3, 5};
+
+ try {
+ filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims);
+ assertTrue("testH5Tarray_create", filetype_id >= 0);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Tarray_create.H5Tarray_create " + err);
+ }
+ finally {
+ if (filetype_id >= 0)
+ try {
+ H5.H5Tclose(filetype_id);
+ }
+ catch (Exception ex) {
+ }
+ }
}
@Test
- public void testH5Tget_array_ndims() {
- long filetype_id = HDF5Constants.H5I_INVALID_HID;
- int ndims = 0;
- long[] adims = { 3, 5 };
-
- try {
- filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("testH5Tarray_create.H5Tarray_create " + err);
- }
- assertTrue("testH5Tget_array_ndims:H5Tarray_create", filetype_id >= 0);
- try {
- ndims = H5.H5Tget_array_ndims(filetype_id);
- assertTrue("testH5Tget_array_ndims", ndims == 2);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("testH5Tget_array_ndims.H5Tget_array_ndims " + err);
- }
- finally {
- if (filetype_id >= 0)
- try {H5.H5Tclose(filetype_id);} catch (Exception ex) {}
- }
+ public void testH5Tget_array_ndims()
+ {
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ int ndims = 0;
+ long[] adims = {3, 5};
+
+ try {
+ filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Tarray_create.H5Tarray_create " + err);
+ }
+ assertTrue("testH5Tget_array_ndims:H5Tarray_create", filetype_id >= 0);
+ try {
+ ndims = H5.H5Tget_array_ndims(filetype_id);
+ assertTrue("testH5Tget_array_ndims", ndims == 2);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Tget_array_ndims.H5Tget_array_ndims " + err);
+ }
+ finally {
+ if (filetype_id >= 0)
+ try {
+ H5.H5Tclose(filetype_id);
+ }
+ catch (Exception ex) {
+ }
+ }
}
@Test
- public void testH5Tget_array_dims() {
- long filetype_id = HDF5Constants.H5I_INVALID_HID;
- int ndims = 0;
- long[] adims = { 3, 5 };
- long[] rdims = new long[2];
-
- try {
- filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("testH5Tarray_create.H5Tarray_create " + err);
- }
- assertTrue("testH5Tget_array_dims:H5Tarray_create", filetype_id >= 0);
- try {
- ndims = H5.H5Tget_array_dims(filetype_id, rdims);
- assertTrue("testH5Tget_array_dims", ndims == 2);
- assertTrue("testH5Tget_array_dims", adims[0] == rdims[0]);
- assertTrue("testH5Tget_array_dims", adims[1] == rdims[1]);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("testH5Tget_array_dims.H5Tget_array_dims " + err);
- }
- finally {
- if (filetype_id >= 0)
- try {H5.H5Tclose(filetype_id);} catch (Exception ex) {}
- }
+ public void testH5Tget_array_dims()
+ {
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ int ndims = 0;
+ long[] adims = {3, 5};
+ long[] rdims = new long[2];
+
+ try {
+ filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Tarray_create.H5Tarray_create " + err);
+ }
+ assertTrue("testH5Tget_array_dims:H5Tarray_create", filetype_id >= 0);
+ try {
+ ndims = H5.H5Tget_array_dims(filetype_id, rdims);
+ assertTrue("testH5Tget_array_dims", ndims == 2);
+ assertTrue("testH5Tget_array_dims", adims[0] == rdims[0]);
+ assertTrue("testH5Tget_array_dims", adims[1] == rdims[1]);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Tget_array_dims.H5Tget_array_dims " + err);
+ }
+ finally {
+ if (filetype_id >= 0)
+ try {
+ H5.H5Tclose(filetype_id);
+ }
+ catch (Exception ex) {
+ }
+ }
}
@Test
- public void testH5Tenum_functions() {
- long filetype_id = HDF5Constants.H5I_INVALID_HID;
- String enum_type ="Enum_type";
- byte[] enum_val = new byte[1];
- String enum_name = null;
+ public void testH5Tenum_functions()
+ {
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ String enum_type = "Enum_type";
+ byte[] enum_val = new byte[1];
+ String enum_name = null;
// Create a enumerate datatype
try {
@@ -221,15 +258,15 @@ public class TestH5T {
}
assertTrue("testH5Tenum_functions:H5Tcreate", filetype_id >= 0);
try {
- enum_val[0]=10;
+ enum_val[0] = 10;
H5.H5Tenum_insert(filetype_id, "RED", enum_val);
- enum_val[0]=11;
+ enum_val[0] = 11;
H5.H5Tenum_insert(filetype_id, "GREEN", enum_val);
- enum_val[0]=12;
+ enum_val[0] = 12;
H5.H5Tenum_insert(filetype_id, "BLUE", enum_val);
- enum_val[0]=13;
+ enum_val[0] = 13;
H5.H5Tenum_insert(filetype_id, "ORANGE", enum_val);
- enum_val[0]=14;
+ enum_val[0] = 14;
H5.H5Tenum_insert(filetype_id, "YELLOW", enum_val);
// Query member number and member index by member name, for enumeration type.
@@ -237,7 +274,8 @@ public class TestH5T {
assertTrue("Can't get correct index number", H5.H5Tget_member_index(filetype_id, "ORANGE") == 3);
// Commit enumeration datatype and close it */
- H5.H5Tcommit(H5fid, enum_type, filetype_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5.H5Tcommit(H5fid, enum_type, filetype_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5.H5Tclose(filetype_id);
@@ -250,17 +288,17 @@ public class TestH5T {
assertTrue("Can't get correct index number", H5.H5Tget_member_index(filetype_id, "ORANGE") == 3);
// Query member value by member name, for enumeration type
- H5.H5Tenum_valueof (filetype_id, "ORANGE", enum_val);
- assertTrue("Incorrect value for enum member", enum_val[0]==13);
+ H5.H5Tenum_valueof(filetype_id, "ORANGE", enum_val);
+ assertTrue("Incorrect value for enum member", enum_val[0] == 13);
// Query member value by member index, for enumeration type
- H5.H5Tget_member_value (filetype_id, 2, enum_val);
- assertTrue("Incorrect value for enum member", enum_val[0]==12);
+ H5.H5Tget_member_value(filetype_id, 2, enum_val);
+ assertTrue("Incorrect value for enum member", enum_val[0] == 12);
// Query member name by member value, for enumeration type
enum_val[0] = 14;
- enum_name = H5.H5Tenum_nameof(filetype_id, enum_val, 16);
- assertTrue("Incorrect name for enum member", enum_name.compareTo("YELLOW")==0);
+ enum_name = H5.H5Tenum_nameof(filetype_id, enum_val, 16);
+ assertTrue("Incorrect name for enum member", enum_name.compareTo("YELLOW") == 0);
}
catch (Throwable err) {
err.printStackTrace();
@@ -268,14 +306,19 @@ public class TestH5T {
}
finally {
if (filetype_id >= 0)
- try {H5.H5Tclose(filetype_id);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(filetype_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Tenum_create_functions() {
- long filetype_id = HDF5Constants.H5I_INVALID_HID;
- byte[] enum_val = new byte[1];
+ public void testH5Tenum_create_functions()
+ {
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ byte[] enum_val = new byte[1];
// Create a enumerate datatype
try {
@@ -287,15 +330,15 @@ public class TestH5T {
}
assertTrue("testH5Tenum_create_functions:H5Tcreate", filetype_id >= 0);
try {
- enum_val[0]=10;
+ enum_val[0] = 10;
H5.H5Tenum_insert(filetype_id, "RED", enum_val);
- enum_val[0]=11;
+ enum_val[0] = 11;
H5.H5Tenum_insert(filetype_id, "GREEN", enum_val);
- enum_val[0]=12;
+ enum_val[0] = 12;
H5.H5Tenum_insert(filetype_id, "BLUE", enum_val);
- enum_val[0]=13;
+ enum_val[0] = 13;
H5.H5Tenum_insert(filetype_id, "ORANGE", enum_val);
- enum_val[0]=14;
+ enum_val[0] = 14;
H5.H5Tenum_insert(filetype_id, "YELLOW", enum_val);
// Query member number and member index by member name, for enumeration type.
@@ -308,14 +351,19 @@ public class TestH5T {
}
finally {
if (filetype_id >= 0)
- try {H5.H5Tclose(filetype_id);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(filetype_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Topaque_functions() {
- long filetype_id = HDF5Constants.H5I_INVALID_HID;
- String opaque_name = null;
+ public void testH5Topaque_functions()
+ {
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ String opaque_name = null;
// Create a opaque datatype
try {
@@ -330,7 +378,7 @@ public class TestH5T {
try {
H5.H5Tset_tag(filetype_id, "opaque type");
opaque_name = H5.H5Tget_tag(filetype_id);
- assertTrue("Incorrect tag for opaque type", opaque_name.compareTo("opaque type")==0);
+ assertTrue("Incorrect tag for opaque type", opaque_name.compareTo("opaque type") == 0);
}
catch (Throwable err) {
err.printStackTrace();
@@ -338,67 +386,83 @@ public class TestH5T {
}
finally {
if (filetype_id >= 0)
- try {H5.H5Tclose(filetype_id);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(filetype_id);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Tvlen_create() {
+ public void testH5Tvlen_create()
+ {
long filetype_id = HDF5Constants.H5I_INVALID_HID;
- try {
- filetype_id = H5.H5Tvlen_create(HDF5Constants.H5T_C_S1);
- assertTrue("testH5Tvlen_create", filetype_id >= 0);
-
- // Check if datatype is VL type
- int vlclass = H5.H5Tget_class(filetype_id);
- assertTrue("testH5Tvlen_create:H5Tget_class", vlclass == HDF5Constants.H5T_VLEN);
- assertFalse("testH5Tis_variable_str:H5Tget_class", vlclass == HDF5Constants.H5T_STRING);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("testH5Tvlen_create.H5Tvlen_create " + err);
- }
- finally {
- if (filetype_id >= 0)
- try {H5.H5Tclose(filetype_id);} catch (Exception ex) {}
- }
+ try {
+ filetype_id = H5.H5Tvlen_create(HDF5Constants.H5T_C_S1);
+ assertTrue("testH5Tvlen_create", filetype_id >= 0);
+
+ // Check if datatype is VL type
+ int vlclass = H5.H5Tget_class(filetype_id);
+ assertTrue("testH5Tvlen_create:H5Tget_class", vlclass == HDF5Constants.H5T_VLEN);
+ assertFalse("testH5Tis_variable_str:H5Tget_class", vlclass == HDF5Constants.H5T_STRING);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Tvlen_create.H5Tvlen_create " + err);
+ }
+ finally {
+ if (filetype_id >= 0)
+ try {
+ H5.H5Tclose(filetype_id);
+ }
+ catch (Exception ex) {
+ }
+ }
}
@Test
- public void testH5Tis_variable_str() {
- long filetype_id = HDF5Constants.H5I_INVALID_HID;
-
- try {
- filetype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
- assertTrue("testH5Tis_variable_str.H5Tcopy: ", filetype_id >= 0);
-
- // Convert to variable-length string
- H5.H5Tset_size(filetype_id, HDF5Constants.H5T_VARIABLE);
-
- // Check if datatype is VL string
- int vlclass = H5.H5Tget_class(filetype_id);
- assertTrue("testH5Tis_variable_str:H5Tget_class", vlclass == HDF5Constants.H5T_STRING);
- assertFalse("testH5Tvlen_create:H5Tget_class", vlclass == HDF5Constants.H5T_VLEN);
-
- assertTrue("testH5Tis_variable_str:H5Tis_variable_str", H5.H5Tis_variable_str(filetype_id));
-
- // Verify that the class detects as a string
- assertTrue("testH5Tis_variable_str:H5Tdetect_class", H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_STRING));
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("testH5Tis_variable_str " + err);
- }
- finally {
- if (filetype_id >= 0)
- try {H5.H5Tclose(filetype_id);} catch (Exception ex) {}
- }
+ public void testH5Tis_variable_str()
+ {
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+
+ try {
+ filetype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
+ assertTrue("testH5Tis_variable_str.H5Tcopy: ", filetype_id >= 0);
+
+ // Convert to variable-length string
+ H5.H5Tset_size(filetype_id, HDF5Constants.H5T_VARIABLE);
+
+ // Check if datatype is VL string
+ int vlclass = H5.H5Tget_class(filetype_id);
+ assertTrue("testH5Tis_variable_str:H5Tget_class", vlclass == HDF5Constants.H5T_STRING);
+ assertFalse("testH5Tvlen_create:H5Tget_class", vlclass == HDF5Constants.H5T_VLEN);
+
+ assertTrue("testH5Tis_variable_str:H5Tis_variable_str", H5.H5Tis_variable_str(filetype_id));
+
+ // Verify that the class detects as a string
+ assertTrue("testH5Tis_variable_str:H5Tdetect_class",
+ H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_STRING));
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Tis_variable_str " + err);
+ }
+ finally {
+ if (filetype_id >= 0)
+ try {
+ H5.H5Tclose(filetype_id);
+ }
+ catch (Exception ex) {
+ }
+ }
}
@Test
- public void testH5Tcompound_functions() {
- long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ public void testH5Tcompound_functions()
+ {
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
// Create a compound datatype
try {
@@ -420,28 +484,34 @@ public class TestH5T {
// We started to support this function for compound type in 1.8.6 release.
int order = H5.H5Tget_order(filetype_id);
assertFalse("Can't get order for compound type.", order == HDF5Constants.H5T_ORDER_ERROR);
- assertTrue("Wrong order for this type.", (order == HDF5Constants.H5T_ORDER_LE) || (order == HDF5Constants.H5T_ORDER_BE));
+ assertTrue("Wrong order for this type.",
+ (order == HDF5Constants.H5T_ORDER_LE) || (order == HDF5Constants.H5T_ORDER_BE));
// Make certain that the correct classes can be detected
- assertTrue("Can't get correct class", H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_COMPOUND));
+ assertTrue("Can't get correct class",
+ H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_COMPOUND));
assertTrue("Can't get correct class", H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_FLOAT));
// Make certain that an incorrect class is not detected
assertFalse("Can get incorrect class", H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_TIME));
// Query member name by member index
- String index_name = H5.H5Tget_member_name (filetype_id, 0);
- assertTrue("Incorrect name for member index", index_name.compareTo("Lon")==0);
+ String index_name = H5.H5Tget_member_name(filetype_id, 0);
+ assertTrue("Incorrect name for member index", index_name.compareTo("Lon") == 0);
// Query member offset by member no
- long index_offset = H5.H5Tget_member_offset (filetype_id, 1);
+ long index_offset = H5.H5Tget_member_offset(filetype_id, 1);
assertTrue("Incorrect offset for member no", index_offset == 8);
// Query member type by member index
- long index_type = H5.H5Tget_member_type (filetype_id, 0);
- assertTrue("Incorrect type for member index", H5.H5Tequal(HDF5Constants.H5T_NATIVE_DOUBLE, index_type));
+ long index_type = H5.H5Tget_member_type(filetype_id, 0);
+ assertTrue("Incorrect type for member index",
+ H5.H5Tequal(HDF5Constants.H5T_NATIVE_DOUBLE, index_type));
if (index_type >= 0)
- try {H5.H5Tclose(index_type);} catch (Exception ex) {}
-
+ try {
+ H5.H5Tclose(index_type);
+ }
+ catch (Exception ex) {
+ }
}
catch (Throwable err) {
err.printStackTrace();
@@ -449,8 +519,11 @@ public class TestH5T {
}
finally {
if (filetype_id >= 0)
- try {H5.H5Tclose(filetype_id);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(filetype_id);
+ }
+ catch (Exception ex) {
+ }
}
}
-
}
diff --git a/java/test/TestH5Tbasic.java b/java/test/TestH5Tbasic.java
index 7aac2ab..8fb1e58 100644
--- a/java/test/TestH5Tbasic.java
+++ b/java/test/TestH5Tbasic.java
@@ -15,6 +15,7 @@ package test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
@@ -25,24 +26,28 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Tbasic {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
@Before
- public void checkOpenIDs() {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void checkOpenIDs()
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
}
@After
- public void nextTestName() {
+ public void nextTestName()
+ {
System.out.println();
}
@Test
- public void testH5Tcopy() {
+ public void testH5Tcopy()
+ {
long H5strdid = HDF5Constants.H5I_INVALID_HID;
try {
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
- assertTrue("H5.H5Tcopy",H5strdid > 0);
+ assertTrue("H5.H5Tcopy", H5strdid > 0);
}
catch (Throwable err) {
err.printStackTrace();
@@ -50,18 +55,23 @@ public class TestH5Tbasic {
}
finally {
if (H5strdid >= 0)
- try {H5.H5Tclose(H5strdid);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(H5strdid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Tequal() {
+ public void testH5Tequal()
+ {
long H5strdid = HDF5Constants.H5I_INVALID_HID;
try {
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
- assertTrue("H5.H5Tcopy",H5strdid > 0);
+ assertTrue("H5.H5Tcopy", H5strdid > 0);
boolean teq = H5.H5Tequal(HDF5Constants.H5T_C_S1, H5strdid);
- assertTrue("H5.H5Tequal",teq);
+ assertTrue("H5.H5Tequal", teq);
}
catch (Throwable err) {
err.printStackTrace();
@@ -69,18 +79,23 @@ public class TestH5Tbasic {
}
finally {
if (H5strdid >= 0)
- try {H5.H5Tclose(H5strdid);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(H5strdid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Tequal_not() {
+ public void testH5Tequal_not()
+ {
long H5strdid = HDF5Constants.H5I_INVALID_HID;
try {
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_STD_U64LE);
- assertTrue("H5.H5Tcopy",H5strdid > 0);
+ assertTrue("H5.H5Tcopy", H5strdid > 0);
boolean teq = H5.H5Tequal(HDF5Constants.H5T_IEEE_F32BE, H5strdid);
- assertFalse("H5.H5Tequal",teq);
+ assertFalse("H5.H5Tequal", teq);
}
catch (Throwable err) {
err.printStackTrace();
@@ -88,22 +103,27 @@ public class TestH5Tbasic {
}
finally {
if (H5strdid >= 0)
- try {H5.H5Tclose(H5strdid);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(H5strdid);
+ }
+ catch (Exception ex) {
+ }
}
}
@Test
- public void testH5Tconvert() {
- String[] strs = {"a1234","b1234"};
- int srcLen = 5;
- int dstLen = 10;
- long srcId = HDF5Constants.H5I_INVALID_HID;
- long dstId = HDF5Constants.H5I_INVALID_HID;
- int dimSize = strs.length;
- byte[] buf = new byte[dimSize*dstLen];
-
- for (int i=0; i<dimSize; i++)
- System.arraycopy(strs[i].getBytes(), 0, buf, i*srcLen, 5);
+ public void testH5Tconvert()
+ {
+ String[] strs = {"a1234", "b1234"};
+ int srcLen = 5;
+ int dstLen = 10;
+ long srcId = HDF5Constants.H5I_INVALID_HID;
+ long dstId = HDF5Constants.H5I_INVALID_HID;
+ int dimSize = strs.length;
+ byte[] buf = new byte[dimSize * dstLen];
+
+ for (int i = 0; i < dimSize; i++)
+ System.arraycopy(strs[i].getBytes(), 0, buf, i * srcLen, 5);
try {
srcId = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
@@ -119,22 +139,31 @@ public class TestH5Tbasic {
fail("testH5Tconvert: " + err);
}
finally {
- try {H5.H5Tclose(srcId);} catch (Exception ex) {}
- try {H5.H5Tclose(dstId);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(srcId);
+ }
+ catch (Exception ex) {
+ }
+ try {
+ H5.H5Tclose(dstId);
+ }
+ catch (Exception ex) {
+ }
}
- for (int i=0; i<strs.length; i++) {
- assertTrue((new String(buf, i*dstLen, dstLen)).startsWith(strs[i]));
+ for (int i = 0; i < strs.length; i++) {
+ assertTrue((new String(buf, i * dstLen, dstLen)).startsWith(strs[i]));
}
}
@Test
- public void testH5Torder_size() {
+ public void testH5Torder_size()
+ {
long H5strdid = HDF5Constants.H5I_INVALID_HID;
try {
// Fixed length string
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
- assertTrue("H5.H5Tcopy",H5strdid > 0);
+ assertTrue("H5.H5Tcopy", H5strdid > 0);
H5.H5Tset_size(H5strdid, (long)5);
assertTrue(HDF5Constants.H5T_ORDER_NONE == H5.H5Tget_order(H5strdid));
H5.H5Tset_order(H5strdid, HDF5Constants.H5T_ORDER_NONE);
@@ -152,7 +181,11 @@ public class TestH5Tbasic {
}
finally {
if (H5strdid >= 0)
- try {H5.H5Tclose(H5strdid);} catch (Exception ex) {}
+ try {
+ H5.H5Tclose(H5strdid);
+ }
+ catch (Exception ex) {
+ }
}
}
}
diff --git a/java/test/TestH5Tparams.java b/java/test/TestH5Tparams.java
index 92a034c..a1710af 100644
--- a/java/test/TestH5Tparams.java
+++ b/java/test/TestH5Tparams.java
@@ -13,6 +13,7 @@
package test;
import static org.junit.Assert.assertTrue;
+
import hdf.hdf5lib.H5;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
@@ -23,385 +24,459 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Tparams {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
@Before
- public void checkOpenIDs() {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void checkOpenIDs()
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
}
@After
- public void nextTestName() {
+ public void nextTestName()
+ {
System.out.println();
}
- @Test//(expected = HDF5LibraryException.class)
- public void testH5Tclose_invalid() throws Throwable {
+ @Test //(expected = HDF5LibraryException.class)
+ public void testH5Tclose_invalid() throws Throwable
+ {
long tid = H5.H5Tclose(-1);
assertTrue(tid == 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tcopy_invalid() throws Throwable {
+ public void testH5Tcopy_invalid() throws Throwable
+ {
H5.H5Tcopy(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tequal_invalid() throws Throwable {
+ public void testH5Tequal_invalid() throws Throwable
+ {
H5.H5Tequal(-1, -1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tlock_invalid() throws Throwable {
+ public void testH5Tlock_invalid() throws Throwable
+ {
H5.H5Tlock(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_class_invalid() throws Throwable {
+ public void testH5Tget_class_invalid() throws Throwable
+ {
H5.H5Tget_class(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_size_invalid() throws Throwable {
+ public void testH5Tget_size_invalid() throws Throwable
+ {
H5.H5Tget_size(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tset_size_invalid() throws Throwable {
+ public void testH5Tset_size_invalid() throws Throwable
+ {
H5.H5Tset_size(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_order_invalid() throws Throwable {
+ public void testH5Tget_order_invalid() throws Throwable
+ {
H5.H5Tget_order(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tset_order_invalid() throws Throwable {
+ public void testH5Tset_order_invalid() throws Throwable
+ {
H5.H5Tset_order(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_precision_invalid() throws Throwable {
+ public void testH5Tget_precision_invalid() throws Throwable
+ {
H5.H5Tget_precision(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_precision_long_invalid() throws Throwable {
+ public void testH5Tget_precision_long_invalid() throws Throwable
+ {
H5.H5Tget_precision_long(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tset_precision_invalid() throws Throwable {
+ public void testH5Tset_precision_invalid() throws Throwable
+ {
H5.H5Tset_precision(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_offset_invalid() throws Throwable {
+ public void testH5Tget_offset_invalid() throws Throwable
+ {
H5.H5Tget_offset(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tset_offset_invalid() throws Throwable {
+ public void testH5Tset_offset_invalid() throws Throwable
+ {
H5.H5Tset_offset(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tcreate_invalid() throws Throwable {
+ public void testH5Tcreate_invalid() throws Throwable
+ {
H5.H5Tcreate(-1, (long)0);
}
@Test(expected = NullPointerException.class)
- public void testH5Topen_null() throws Throwable {
+ public void testH5Topen_null() throws Throwable
+ {
H5.H5Topen(-1, null, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Topen_invalid() throws Throwable {
+ public void testH5Topen_invalid() throws Throwable
+ {
H5.H5Topen(-1, "Bogus", 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Tcommit_null() throws Throwable {
+ public void testH5Tcommit_null() throws Throwable
+ {
H5.H5Tcommit(-1, null, 0, -1, -1, -1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tcommit_invalid() throws Throwable {
+ public void testH5Tcommit_invalid() throws Throwable
+ {
H5.H5Tcommit(-1, "Bogus", -1, -1, -1, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Tget_pad_null() throws Throwable {
+ public void testH5Tget_pad_null() throws Throwable
+ {
H5.H5Tget_pad(-1, null);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_pad_invalid() throws Throwable {
+ public void testH5Tget_pad_invalid() throws Throwable
+ {
int[] pad = new int[2];
H5.H5Tget_pad(-1, pad);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tset_pad_invalid() throws Throwable {
+ public void testH5Tset_pad_invalid() throws Throwable
+ {
H5.H5Tset_pad(-1, -1, -1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_sign_invalid() throws Throwable {
+ public void testH5Tget_sign_invalid() throws Throwable
+ {
H5.H5Tget_sign(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tset_sign_invalid() throws Throwable {
+ public void testH5Tset_sign_invalid() throws Throwable
+ {
H5.H5Tset_sign(-1, 0);
}
@Test(expected = NullPointerException.class)
- public void testH5Tget_fields_null() throws Throwable {
+ public void testH5Tget_fields_null() throws Throwable
+ {
H5.H5Tget_fields(-1, (long[])null);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Tget_fields_length_invalid() throws Throwable {
+ public void testH5Tget_fields_length_invalid() throws Throwable
+ {
long[] fields = new long[2];
H5.H5Tget_fields(-1, fields);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_fields_invalid() throws Throwable {
+ public void testH5Tget_fields_invalid() throws Throwable
+ {
long[] fields = new long[5];
H5.H5Tget_fields(-1, fields);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tset_fields_invalid() throws Throwable {
+ public void testH5Tset_fields_invalid() throws Throwable
+ {
H5.H5Tset_fields(-1, -1, -1, -1, -1, -1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_ebias_invalid() throws Throwable {
+ public void testH5Tget_ebias_invalid() throws Throwable
+ {
H5.H5Tget_ebias(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_ebias_long_invalid() throws Throwable {
+ public void testH5Tget_ebias_long_invalid() throws Throwable
+ {
H5.H5Tget_ebias_long(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tset_ebias_invalid() throws Throwable {
+ public void testH5Tset_ebias_invalid() throws Throwable
+ {
H5.H5Tset_ebias(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_norm_invalid() throws Throwable {
+ public void testH5Tget_norm_invalid() throws Throwable
+ {
H5.H5Tget_norm(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tset_norm_invalid() throws Throwable {
+ public void testH5Tset_norm_invalid() throws Throwable
+ {
H5.H5Tset_norm(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_inpad_invalid() throws Throwable {
+ public void testH5Tget_inpad_invalid() throws Throwable
+ {
H5.H5Tget_inpad(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tset_inpad_invalid() throws Throwable {
+ public void testH5Tset_inpad_invalid() throws Throwable
+ {
H5.H5Tset_inpad(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_cset_invalid() throws Throwable {
+ public void testH5Tget_cset_invalid() throws Throwable
+ {
H5.H5Tget_cset(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tset_cset_invalid() throws Throwable {
+ public void testH5Tset_cset_invalid() throws Throwable
+ {
H5.H5Tset_cset(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_strpad_invalid() throws Throwable {
+ public void testH5Tget_strpad_invalid() throws Throwable
+ {
H5.H5Tget_strpad(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tset_strpad_invalid() throws Throwable {
+ public void testH5Tset_strpad_invalid() throws Throwable
+ {
H5.H5Tset_strpad(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_nmembers_invalid() throws Throwable {
+ public void testH5Tget_nmembers_invalid() throws Throwable
+ {
H5.H5Tget_nmembers(-1);
}
@Test(expected = NullPointerException.class)
- public void testH5Tget_member_index_null() throws Throwable {
+ public void testH5Tget_member_index_null() throws Throwable
+ {
H5.H5Tget_member_index(-1, null);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_member_index_invalid() throws Throwable {
+ public void testH5Tget_member_index_invalid() throws Throwable
+ {
H5.H5Tget_member_index(-1, "Bogus");
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_member_type_invalid() throws Throwable {
+ public void testH5Tget_member_type_invalid() throws Throwable
+ {
H5.H5Tget_member_type(-1, -1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_member_class_invalid() throws Throwable {
+ public void testH5Tget_member_class_invalid() throws Throwable
+ {
H5.H5Tget_member_class(-1, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Tinsert_null() throws Throwable {
+ public void testH5Tinsert_null() throws Throwable
+ {
H5.H5Tinsert(-1, null, 0, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tinsert_invalid() throws Throwable {
+ public void testH5Tinsert_invalid() throws Throwable
+ {
H5.H5Tinsert(-1, "Bogus", 0, 0);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tpack_invalid() throws Throwable {
+ public void testH5Tpack_invalid() throws Throwable
+ {
H5.H5Tpack(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Treclaim_invalid() throws Throwable {
+ public void testH5Treclaim_invalid() throws Throwable
+ {
byte[] buf = new byte[2];
H5.H5Treclaim(-1, -1, -1, buf);
}
@Test(expected = NullPointerException.class)
- public void testH5Treclaim_null() throws Throwable {
+ public void testH5Treclaim_null() throws Throwable
+ {
H5.H5Treclaim(-1, -1, -1, null);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tvlen_create_invalid() throws Throwable {
+ public void testH5Tvlen_create_invalid() throws Throwable
+ {
H5.H5Tvlen_create(-1);
}
@Test(expected = NullPointerException.class)
- public void testH5Tset_tag_null() throws Throwable {
+ public void testH5Tset_tag_null() throws Throwable
+ {
H5.H5Tset_tag(-1, null);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tset_tag_invalid() throws Throwable {
+ public void testH5Tset_tag_invalid() throws Throwable
+ {
H5.H5Tset_tag(-1, "Bogus");
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_super_invalid() throws Throwable {
+ public void testH5Tget_super_invalid() throws Throwable
+ {
H5.H5Tget_super(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tenum_create_invalid() throws Throwable {
+ public void testH5Tenum_create_invalid() throws Throwable
+ {
H5.H5Tenum_create(-1);
}
@Test(expected = NullPointerException.class)
- public void testH5Tenum_insert_name_null() throws Throwable {
+ public void testH5Tenum_insert_name_null() throws Throwable
+ {
H5.H5Tenum_insert(-1, null, (byte[])null);
}
@Test(expected = NullPointerException.class)
- public void testH5Tenum_insert_null() throws Throwable {
+ public void testH5Tenum_insert_null() throws Throwable
+ {
H5.H5Tenum_insert(-1, "bogus", (byte[])null);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tenum_insert_invalid() throws Throwable {
+ public void testH5Tenum_insert_invalid() throws Throwable
+ {
byte[] enumtype = new byte[2];
H5.H5Tenum_insert(-1, "bogus", enumtype);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Tenum_nameof_invalid_size() throws Throwable {
+ public void testH5Tenum_nameof_invalid_size() throws Throwable
+ {
H5.H5Tenum_nameof(-1, null, -1);
}
@Test(expected = NullPointerException.class)
- public void testH5Tenum_nameof_value_null() throws Throwable {
+ public void testH5Tenum_nameof_value_null() throws Throwable
+ {
H5.H5Tenum_nameof(-1, null, 1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tenum_nameof_invalid() throws Throwable {
+ public void testH5Tenum_nameof_invalid() throws Throwable
+ {
byte[] btype = new byte[2];
H5.H5Tenum_nameof(-1, btype, 1);
}
@Test(expected = NullPointerException.class)
- public void testH5Tenum_valueof_name_null() throws Throwable {
+ public void testH5Tenum_valueof_name_null() throws Throwable
+ {
H5.H5Tenum_valueof(-1, null, (byte[])null);
}
@Test(expected = NullPointerException.class)
- public void testH5Tenum_valueof_null() throws Throwable {
+ public void testH5Tenum_valueof_null() throws Throwable
+ {
H5.H5Tenum_valueof(-1, "bogus", (byte[])null);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tenum_valueof_invalid() throws Throwable {
+ public void testH5Tenum_valueof_invalid() throws Throwable
+ {
byte[] btype = new byte[2];
H5.H5Tenum_valueof(-1, "bogus", btype);
}
@Test(expected = NullPointerException.class)
- public void testH5Tget_member_value_null() throws Throwable {
+ public void testH5Tget_member_value_null() throws Throwable
+ {
H5.H5Tget_member_value(-1, -1, (byte[])null);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_member_value_invalid() throws Throwable {
+ public void testH5Tget_member_value_invalid() throws Throwable
+ {
byte[] btype = new byte[2];
H5.H5Tget_member_value(-1, -1, btype);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Tarray_create_invalid() throws Throwable {
+ public void testH5Tarray_create_invalid() throws Throwable
+ {
H5.H5Tarray_create(-1, -1, null);
}
@Test(expected = NullPointerException.class)
- public void testH5Tarray_create_value_null() throws Throwable {
+ public void testH5Tarray_create_value_null() throws Throwable
+ {
H5.H5Tarray_create(-1, 1, null);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_array_ndims_invalid() throws Throwable {
+ public void testH5Tget_array_ndims_invalid() throws Throwable
+ {
H5.H5Tget_array_ndims(-1);
}
@Test(expected = NullPointerException.class)
- public void testH5Tget_array_dims_null() throws Throwable {
+ public void testH5Tget_array_dims_null() throws Throwable
+ {
H5.H5Tget_array_dims(-1, null);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tget_native_type_invalid() throws Throwable {
+ public void testH5Tget_native_type_invalid() throws Throwable
+ {
H5.H5Tget_native_type(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Tflush_invalid() throws Throwable {
+ public void testH5Tflush_invalid() throws Throwable
+ {
H5.H5Tflush(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Trefresh_invalid() throws Throwable {
+ public void testH5Trefresh_invalid() throws Throwable
+ {
H5.H5Trefresh(-1);
}
-
}
diff --git a/java/test/TestH5VL.java b/java/test/TestH5VL.java
index 4253d20..99505ae 100644
--- a/java/test/TestH5VL.java
+++ b/java/test/TestH5VL.java
@@ -16,12 +16,13 @@ import static org.junit.Assert.assertEquals;
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.exceptions.HDF5LibraryException;
-import java.io.File;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -29,28 +30,37 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5VL {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
- private final void _deleteFile(String filename) {
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
@Before
- public void checkOpenIDs() {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void checkOpenIDs()
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
}
@After
- public void nextTestName() {
+ public void nextTestName()
+ {
System.out.println();
}
@Test
- public void testH5VLnative_init() {
+ public void testH5VLnative_init()
+ {
try {
boolean is_registered;
@@ -70,11 +80,12 @@ public class TestH5VL {
}
@Test
- public void testH5VLget_connector_id() {
+ public void testH5VLget_connector_id()
+ {
String H5_FILE = "testFvl.h5";
- long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
try {
long native_id = H5.H5VLget_connector_id(H5fid);
@@ -95,14 +106,19 @@ public class TestH5VL {
}
finally {
if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
}
_deleteFile(H5_FILE);
}
}
@Test
- public void testH5VLget_connector_id_by_name() {
+ public void testH5VLget_connector_id_by_name()
+ {
try {
long native_id = H5.H5VLget_connector_id_by_name(HDF5Constants.H5VL_NATIVE_NAME);
assertTrue("H5.H5VLget_connector_id_by_name H5VL_NATIVE_NAME", native_id >= 0);
@@ -115,7 +131,8 @@ public class TestH5VL {
}
@Test
- public void testH5VLget_connector_id_by_value() {
+ public void testH5VLget_connector_id_by_value()
+ {
try {
long native_id = H5.H5VLget_connector_id_by_value(HDF5Constants.H5VL_NATIVE_VALUE);
assertTrue("H5.H5VLget_connector_id_by_value H5VL_NATIVE_VALUE", native_id >= 0);
@@ -128,11 +145,12 @@ public class TestH5VL {
}
@Test
- public void testH5VLget_connector_name() {
+ public void testH5VLget_connector_name()
+ {
String H5_FILE = "testFvl.h5";
- long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
try {
@@ -145,7 +163,8 @@ public class TestH5VL {
*/
String connector = System.getenv("HDF5_VOL_CONNECTOR");
if (connector == null)
- assertTrue("H5.H5VLget_connector_name H5VL_NATIVE", native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME)==0);
+ assertTrue("H5.H5VLget_connector_name H5VL_NATIVE",
+ native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME) == 0);
}
catch (Throwable err) {
err.printStackTrace();
@@ -153,20 +172,25 @@ public class TestH5VL {
}
finally {
if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
}
_deleteFile(H5_FILE);
}
}
@Test(expected = HDF5LibraryException.class)
- public void testH5VLclose_NegativeID() throws Throwable {
+ public void testH5VLclose_NegativeID() throws Throwable
+ {
H5.H5VLclose(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5VLunregister_connector_NegativeID() throws Throwable {
+ public void testH5VLunregister_connector_NegativeID() throws Throwable
+ {
H5.H5VLunregister_connector(-1);
}
}
-
diff --git a/java/test/TestH5Z.java b/java/test/TestH5Z.java
index fde8f1a..bc6bfc0 100644
--- a/java/test/TestH5Z.java
+++ b/java/test/TestH5Z.java
@@ -14,6 +14,7 @@ package test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
@@ -25,20 +26,24 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Z {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
@Before
- public void checkOpenIDs() {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void checkOpenIDs()
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
}
@After
- public void nextTestName() {
+ public void nextTestName()
+ {
System.out.println();
}
@Test
- public void testH5Zfilter_avail() {
+ public void testH5Zfilter_avail()
+ {
try {
int filter_found;
@@ -64,34 +69,46 @@ public class TestH5Z {
}
@Test
- public void testH5Zget_filter_info() {
+ public void testH5Zget_filter_info()
+ {
try {
int filter_flag;
filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_FLETCHER32);
- assertTrue("H5.H5Zget_filter_info_FLETCHER32_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
- assertTrue("H5.H5Zget_filter_info_FLETCHER32_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0);
+ assertTrue("H5.H5Zget_filter_info_FLETCHER32_DECODE_ENABLED",
+ (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
+ assertTrue("H5.H5Zget_filter_info_FLETCHER32_ENCODE_ENABLED",
+ (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0);
filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_NBIT);
- assertTrue("H5.H5Zget_filter_info_NBIT_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
- assertTrue("H5.H5Zget_filter_info_NBIT_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0);
+ assertTrue("H5.H5Zget_filter_info_NBIT_DECODE_ENABLED",
+ (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
+ assertTrue("H5.H5Zget_filter_info_NBIT_ENCODE_ENABLED",
+ (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0);
filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SCALEOFFSET);
- assertTrue("H5.H5Zget_filter_info_SCALEOFFSET_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
- assertTrue("H5.H5Zget_filter_info_SCALEOFFSET_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0);
+ assertTrue("H5.H5Zget_filter_info_SCALEOFFSET_DECODE_ENABLED",
+ (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
+ assertTrue("H5.H5Zget_filter_info_SCALEOFFSET_ENCODE_ENABLED",
+ (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0);
filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SHUFFLE);
- assertTrue("H5.H5Zget_filter_info_DECODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
- assertTrue("H5.H5Zget_filter_info_ENCODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0);
+ assertTrue("H5.H5Zget_filter_info_DECODE_SHUFFLE_ENABLED",
+ (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
+ assertTrue("H5.H5Zget_filter_info_ENCODE_SHUFFLE_ENABLED",
+ (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0);
- if(1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE)) {
+ if (1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE)) {
filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE);
- assertTrue("H5.H5Zget_filter_info_DEFLATE_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
- assertTrue("H5.H5Zget_filter_info_DEFLATE_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0);
+ assertTrue("H5.H5Zget_filter_info_DEFLATE_DECODE_ENABLED",
+ (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
+ assertTrue("H5.H5Zget_filter_info_DEFLATE_ENCODE_ENABLED",
+ (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0);
}
- if(1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP)) {
+ if (1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP)) {
filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP);
// Decode should always be available, but we have no way of determining
// if encode is so don't assert on that.
- assertTrue("H5.H5Zget_filter_info_DECODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
+ assertTrue("H5.H5Zget_filter_info_DECODE_SZIP_ENABLED",
+ (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
}
}
catch (Throwable err) {
@@ -101,7 +118,8 @@ public class TestH5Z {
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Zunregister_predefined() throws Throwable {
+ public void testH5Zunregister_predefined() throws Throwable
+ {
int filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SHUFFLE);
assertTrue("H5.H5Zfilter_avail", filter_found > 0);