Brings java wrapper updates from develop
The wrappers compile but fail tests due to some missing develop functionality
This commit is contained in:
@@ -23,16 +23,19 @@ set (HDF5_JAVA_TEST_SOURCES
|
||||
TestH5Dparams
|
||||
TestH5D
|
||||
TestH5Dplist
|
||||
TestH5Drw
|
||||
TestH5Lparams
|
||||
TestH5Lbasic
|
||||
TestH5Lcreate
|
||||
TestH5R
|
||||
TestH5Rref
|
||||
TestH5P
|
||||
TestH5PData
|
||||
TestH5Pfapl
|
||||
TestH5Pvirtual
|
||||
TestH5Plist
|
||||
TestH5A
|
||||
TestH5Arw
|
||||
TestH5Oparams
|
||||
TestH5Obasic
|
||||
TestH5Ocreate
|
||||
@@ -93,6 +96,12 @@ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_
|
||||
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateL2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
|
||||
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateO1.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
|
||||
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateO2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
|
||||
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5" "${PROJECT_BINARY_DIR}/trefer_reg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
|
||||
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5" "${PROJECT_BINARY_DIR}/trefer_attr.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
|
||||
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tdatareg.h5" "${PROJECT_BINARY_DIR}/tdatareg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
|
||||
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tattrreg.h5" "${PROJECT_BINARY_DIR}/tattrreg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
|
||||
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tintsattrs.h5" "${PROJECT_BINARY_DIR}/tintsattrs.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
|
||||
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.h5" "${PROJECT_BINARY_DIR}/tfloatsattrs.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
|
||||
|
||||
add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_files_list})
|
||||
|
||||
@@ -208,6 +217,12 @@ if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL)
|
||||
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateL2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
|
||||
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateO1.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
|
||||
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateO2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
|
||||
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5" "${PROJECT_BINARY_DIR}/${voltest}/trefer_reg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
|
||||
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5" "${PROJECT_BINARY_DIR}/${voltest}/trefer_attr.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
|
||||
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tdatareg.h5" "${PROJECT_BINARY_DIR}/${voltest}/tdatareg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
|
||||
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tattrreg.h5" "${PROJECT_BINARY_DIR}/${voltest}/tattrreg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
|
||||
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tintsattrs.h5" "${PROJECT_BINARY_DIR}/${voltest}/tintsattrs.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
|
||||
HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tfloatsattrs.h5" "${PROJECT_BINARY_DIR}/${voltest}/tfloatsattrs.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
|
||||
|
||||
add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files_list})
|
||||
|
||||
|
||||
@@ -52,11 +52,13 @@ noinst_JAVA = \
|
||||
TestH5T.java \
|
||||
TestH5Dparams.java \
|
||||
TestH5D.java \
|
||||
TestH5Drw.java \
|
||||
TestH5Dplist.java \
|
||||
TestH5Lparams.java \
|
||||
TestH5Lbasic.java \
|
||||
TestH5Lcreate.java \
|
||||
TestH5R.java \
|
||||
TestH5Rref.java \
|
||||
TestH5P.java \
|
||||
TestH5PData.java \
|
||||
TestH5Pfapl.java \
|
||||
@@ -65,6 +67,7 @@ noinst_JAVA = \
|
||||
TestH5Pvirtual.java \
|
||||
TestH5Plist.java \
|
||||
TestH5A.java \
|
||||
TestH5Arw.java \
|
||||
TestH5Oparams.java \
|
||||
TestH5Obasic.java \
|
||||
TestH5Ocreate.java \
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -23,12 +22,12 @@ import org.junit.runners.Suite;
|
||||
TestH5Gbasic.class, TestH5G.class, TestH5Giterate.class,
|
||||
TestH5Sbasic.class, TestH5S.class,
|
||||
TestH5Tparams.class, TestH5Tbasic.class, TestH5T.class,
|
||||
TestH5Dparams.class, TestH5D.class, TestH5Dplist.class,
|
||||
TestH5Dparams.class, TestH5D.class, TestH5Dplist.class, TestH5Drw.class,
|
||||
TestH5Lparams.class, TestH5Lbasic.class, TestH5Lcreate.class,
|
||||
TestH5R.class,
|
||||
TestH5R.class, TestH5Rref.class,
|
||||
TestH5P.class, TestH5PData.class, TestH5Pfapl.class, TestH5Pvirtual.class, TestH5Plist.class,
|
||||
TestH5Pfapls3.class, TestH5Pfaplhdfs.class,
|
||||
TestH5A.class,
|
||||
TestH5A.class, TestH5Arw.class,
|
||||
TestH5Oparams.class, TestH5Obasic.class, TestH5Ocopy.class, TestH5Ocreate.class,
|
||||
TestH5PL.class, TestH5Z.class
|
||||
})
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -32,6 +31,7 @@ import java.io.StreamTokenizer;
|
||||
|
||||
import hdf.hdf5lib.H5;
|
||||
import hdf.hdf5lib.HDF5Constants;
|
||||
import hdf.hdf5lib.exceptions.HDF5Exception;
|
||||
import hdf.hdf5lib.exceptions.HDF5LibraryException;
|
||||
|
||||
import org.junit.After;
|
||||
@@ -47,22 +47,25 @@ import org.junit.rules.TestName;
|
||||
*/
|
||||
public class TestH5 {
|
||||
@Rule public TestName testname = new TestName();
|
||||
@Before
|
||||
public void showTestName() {
|
||||
System.out.print(testname.getMethodName());
|
||||
}
|
||||
@After
|
||||
public void nextTestName() {
|
||||
System.out.println();
|
||||
}
|
||||
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 = -1;
|
||||
long H5dsid = -1;
|
||||
long H5did = -1;
|
||||
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) {
|
||||
@@ -78,7 +81,7 @@ public class TestH5 {
|
||||
}
|
||||
|
||||
private final long _createDataset(long fid, long dsid, String name, long dapl) {
|
||||
long did = -1;
|
||||
long did = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32LE, dsid,
|
||||
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
|
||||
@@ -115,22 +118,65 @@ public class TestH5 {
|
||||
}
|
||||
}
|
||||
|
||||
public final void _closeH5File() throws HDF5LibraryException {
|
||||
private final void _closeH5File() {
|
||||
if (H5did >= 0)
|
||||
try {H5.H5Dclose(H5did);} catch (Exception ex) {}
|
||||
if (H5dsid > 0)
|
||||
try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
|
||||
if (H5fid > 0)
|
||||
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
|
||||
H5fid = -1;
|
||||
H5dsid = -1;
|
||||
H5did = -1;
|
||||
H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5dsid = 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 final void _deleteH5file() {
|
||||
_closeH5File();
|
||||
_deleteFile(H5_FILE);
|
||||
}
|
||||
|
||||
@After
|
||||
public void closeH5File() throws HDF5LibraryException {
|
||||
_closeH5File();
|
||||
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);
|
||||
System.out.print(testname.getMethodName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link hdf.hdf5lib.H5#J2C(int)}.
|
||||
* NOTE:
|
||||
@@ -374,8 +420,10 @@ public class TestH5 {
|
||||
|
||||
_closeH5File();
|
||||
|
||||
_openH5File(H5_FILE, "/dset");
|
||||
|
||||
try {
|
||||
H5.H5export_dataset(EXPORT_FILE, H5_FILE, "/dset", 99);
|
||||
H5.H5export_dataset(EXPORT_FILE, H5fid, "/dset", 99);
|
||||
}
|
||||
catch (HDF5LibraryException err) {
|
||||
err.printStackTrace();
|
||||
@@ -411,4 +459,168 @@ public class TestH5 {
|
||||
}
|
||||
_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";
|
||||
|
||||
_openH5File(H5_REGION_FILE, objName);
|
||||
|
||||
try {
|
||||
H5.H5export_dataset(EXPORT_REGION_FILE, H5fid, objName, 99);
|
||||
}
|
||||
catch (HDF5LibraryException err) {
|
||||
err.printStackTrace();
|
||||
fail("H5export_dataset failed: " + err);
|
||||
}
|
||||
|
||||
File file = new File(EXPORT_REGION_FILE);
|
||||
|
||||
try {
|
||||
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) {
|
||||
dset_indata[indx] = (int)streamTokenizer.nval;
|
||||
indx++;
|
||||
}
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
catch (IOException err) {
|
||||
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]);
|
||||
}
|
||||
|
||||
@Test
|
||||
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";
|
||||
|
||||
_openH5File(H5_ATTR_FILE, objName);
|
||||
|
||||
try {
|
||||
H5.H5export_dataset(EXPORT_ATTR_FILE, H5did, objName, 99);
|
||||
}
|
||||
catch (HDF5LibraryException err) {
|
||||
err.printStackTrace();
|
||||
fail("H5export_dataset failed: " + err);
|
||||
}
|
||||
|
||||
File file = new File(EXPORT_ATTR_FILE);
|
||||
|
||||
try {
|
||||
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) {
|
||||
dset_indata[indx] = (int)streamTokenizer.nval;
|
||||
indx++;
|
||||
}
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
catch (IOException err) {
|
||||
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]);
|
||||
}
|
||||
|
||||
@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";
|
||||
|
||||
_openH5File(H5_DREG_FILE, objName);
|
||||
|
||||
try {
|
||||
H5.H5export_dataset(EXPORT_DREG_FILE, H5fid, objName, 99);
|
||||
}
|
||||
catch (HDF5LibraryException err) {
|
||||
err.printStackTrace();
|
||||
fail("H5export_dataset failed: " + err);
|
||||
}
|
||||
|
||||
File file = new File(EXPORT_DREG_FILE);
|
||||
|
||||
try {
|
||||
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) {
|
||||
dset_indata[indx] = (int)streamTokenizer.nval;
|
||||
indx++;
|
||||
}
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
catch (IOException err) {
|
||||
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]);
|
||||
}
|
||||
|
||||
@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";
|
||||
|
||||
_openH5File(H5_AREG_FILE, dsetName);
|
||||
|
||||
try {
|
||||
H5.H5export_attribute(EXPORT_AREG_FILE, H5did, objName, 99);
|
||||
}
|
||||
catch (HDF5LibraryException err) {
|
||||
err.printStackTrace();
|
||||
fail("H5export_attribute failed: " + err);
|
||||
}
|
||||
|
||||
File file = new File(EXPORT_AREG_FILE);
|
||||
|
||||
try {
|
||||
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) {
|
||||
dset_indata[indx] = (int)streamTokenizer.nval;
|
||||
indx++;
|
||||
}
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
catch (IOException err) {
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -43,14 +42,14 @@ public class TestH5A {
|
||||
private static final String H5_FILE = "testA.h5";
|
||||
private static final int DIM_X = 4;
|
||||
private static final int DIM_Y = 6;
|
||||
long H5fid = -1;
|
||||
long H5dsid = -1;
|
||||
long H5did = -1;
|
||||
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 = -1;
|
||||
long space_id = -1;
|
||||
long lapl_id = -1;
|
||||
long aapl_id = -1;
|
||||
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);
|
||||
@@ -61,7 +60,7 @@ public class TestH5A {
|
||||
}
|
||||
|
||||
private final long _createDataset(long fid, long dsid, String name, long dapl) {
|
||||
long did = -1;
|
||||
long did = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid,
|
||||
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
|
||||
@@ -132,7 +131,7 @@ public class TestH5A {
|
||||
|
||||
@Test
|
||||
public void testH5Acreate2() {
|
||||
long attr_id = -1;
|
||||
long attr_id = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
|
||||
assertTrue("testH5Acreate2", attr_id >= 0);
|
||||
@@ -160,8 +159,8 @@ public class TestH5A {
|
||||
@Test
|
||||
public void testH5Aopen() {
|
||||
String attr_name = "dset";
|
||||
long attribute_id = -1;
|
||||
long attr_id = -1;
|
||||
long attribute_id = HDF5Constants.H5I_INVALID_HID;
|
||||
long attr_id = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
attr_id = H5.H5Acreate(H5did, attr_name, type_id, space_id,
|
||||
@@ -197,8 +196,8 @@ public class TestH5A {
|
||||
int idx_type = HDF5Constants.H5_INDEX_CRT_ORDER;
|
||||
int order = HDF5Constants.H5_ITER_INC;
|
||||
long n = 0;
|
||||
long attr_id = -1;
|
||||
long attribute_id = -1;
|
||||
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,
|
||||
@@ -256,7 +255,7 @@ public class TestH5A {
|
||||
public void testH5Acreate_by_name() {
|
||||
String obj_name = ".";
|
||||
String attr_name = "DATASET";
|
||||
long attribute_id = -1;
|
||||
long attribute_id = HDF5Constants.H5I_INVALID_HID;
|
||||
boolean bool_val = false;
|
||||
|
||||
try {
|
||||
@@ -288,7 +287,7 @@ public class TestH5A {
|
||||
long loc_id = H5fid;
|
||||
String old_attr_name = "old";
|
||||
String new_attr_name = "new";
|
||||
long attr_id = -1;
|
||||
long attr_id = HDF5Constants.H5I_INVALID_HID;
|
||||
int ret_val = -1;
|
||||
boolean bool_val = false;
|
||||
|
||||
@@ -326,7 +325,7 @@ public class TestH5A {
|
||||
String obj_name = ".";
|
||||
String old_attr_name = "old";
|
||||
String new_attr_name = "new";
|
||||
long attr_id = -1;
|
||||
long attr_id = HDF5Constants.H5I_INVALID_HID;
|
||||
int ret_val = -1;
|
||||
boolean bool_val = false;
|
||||
|
||||
@@ -368,7 +367,7 @@ public class TestH5A {
|
||||
String obj_name = ".";
|
||||
String attr_name = "DATASET1";
|
||||
String ret_name = null;
|
||||
long attribute_id = -1;
|
||||
long attribute_id = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name,
|
||||
@@ -398,8 +397,8 @@ public class TestH5A {
|
||||
int idx_type = HDF5Constants.H5_INDEX_NAME;
|
||||
int order = HDF5Constants.H5_ITER_INC;
|
||||
int n = 0;
|
||||
long attr1_id = -1;
|
||||
long attr2_id = -1;
|
||||
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,
|
||||
@@ -435,8 +434,8 @@ public class TestH5A {
|
||||
|
||||
@Test
|
||||
public void testH5Aget_storage_size() {
|
||||
long attr_id = -1;
|
||||
long attr_size = -1;
|
||||
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,
|
||||
@@ -458,8 +457,8 @@ public class TestH5A {
|
||||
@Test
|
||||
public void testH5Aget_info() {
|
||||
H5A_info_t attr_info = null;
|
||||
long attribute_id = -1;
|
||||
long attr_id = -1;
|
||||
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,
|
||||
@@ -490,8 +489,8 @@ public class TestH5A {
|
||||
@Test
|
||||
public void testH5Aget_info1() {
|
||||
H5A_info_t attr_info = null;
|
||||
long attribute_id = -1;
|
||||
long attr_id = -1;
|
||||
long attribute_id = HDF5Constants.H5I_INVALID_HID;
|
||||
long attr_id = HDF5Constants.H5I_INVALID_HID;
|
||||
int order = HDF5Constants.H5_ITER_INC;
|
||||
|
||||
try {
|
||||
@@ -526,8 +525,8 @@ public class TestH5A {
|
||||
|
||||
@Test
|
||||
public void testH5Aget_info_by_idx() {
|
||||
long attr_id = -1;
|
||||
long attr2_id = -1;;
|
||||
long attr_id = HDF5Constants.H5I_INVALID_HID;
|
||||
long attr2_id = HDF5Constants.H5I_INVALID_HID;;
|
||||
H5A_info_t attr_info = null;
|
||||
|
||||
try {
|
||||
@@ -582,7 +581,7 @@ public class TestH5A {
|
||||
|
||||
@Test
|
||||
public void testH5Aget_info_by_name() {
|
||||
long attr_id = -1;
|
||||
long attr_id = HDF5Constants.H5I_INVALID_HID;
|
||||
H5A_info_t attr_info = null;
|
||||
String obj_name = ".";
|
||||
String attr_name = "DATASET";
|
||||
@@ -607,7 +606,7 @@ public class TestH5A {
|
||||
|
||||
@Test
|
||||
public void testH5Adelete_by_name() {
|
||||
long attr_id = -1;
|
||||
long attr_id = HDF5Constants.H5I_INVALID_HID;
|
||||
int ret_val = -1;
|
||||
boolean bool_val = false;
|
||||
boolean exists = false;
|
||||
@@ -650,8 +649,8 @@ public class TestH5A {
|
||||
@Test
|
||||
public void testH5Aexists() {
|
||||
boolean exists = false;
|
||||
long attr_id = -1;
|
||||
long attribute_id = -1;
|
||||
long attr_id = HDF5Constants.H5I_INVALID_HID;
|
||||
long attribute_id = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
exists = H5.H5Aexists(H5fid, "None");
|
||||
@@ -689,10 +688,10 @@ public class TestH5A {
|
||||
@Test
|
||||
public void testH5Adelete_by_idx_order() {
|
||||
boolean exists = false;
|
||||
long attr1_id = -1;
|
||||
long attr2_id = -1;
|
||||
long attr3_id = -1;
|
||||
long attr4_id = -1;
|
||||
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",
|
||||
@@ -731,9 +730,9 @@ public class TestH5A {
|
||||
@Test
|
||||
public void testH5Adelete_by_idx_name1() {
|
||||
boolean exists = false;
|
||||
long attr1_id = -1;
|
||||
long attr2_id = -1;
|
||||
long attr3_id = -1;
|
||||
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",
|
||||
@@ -766,10 +765,10 @@ public class TestH5A {
|
||||
@Test
|
||||
public void testH5Adelete_by_idx_name2() {
|
||||
boolean exists = false;
|
||||
long attr1_id = -1;
|
||||
long attr2_id = -1;
|
||||
long attr3_id = -1;
|
||||
long attr4_id = -1;
|
||||
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",
|
||||
@@ -821,8 +820,8 @@ public class TestH5A {
|
||||
public void testH5Aopen_by_name() {
|
||||
String obj_name = ".";
|
||||
String attr_name = "DATASET";
|
||||
long attribute_id = -1;
|
||||
long aid = -1;
|
||||
long attribute_id = HDF5Constants.H5I_INVALID_HID;
|
||||
long aid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name,
|
||||
@@ -856,9 +855,9 @@ public class TestH5A {
|
||||
@Test
|
||||
public void testH5Awrite_readVL() {
|
||||
String attr_name = "VLdata";
|
||||
long attr_id = -1;
|
||||
long atype_id = -1;
|
||||
long aspace_id = -1;
|
||||
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;
|
||||
@@ -923,8 +922,8 @@ public class TestH5A {
|
||||
public void testH5Aget_create_plist() {
|
||||
String attr_name = "DATASET1";
|
||||
int char_encoding = 0;
|
||||
long plist_id = -1;
|
||||
long attribute_id = -1;
|
||||
long plist_id = HDF5Constants.H5I_INVALID_HID;
|
||||
long attribute_id = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
plist_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_CREATE);
|
||||
@@ -984,10 +983,10 @@ public class TestH5A {
|
||||
|
||||
@Test
|
||||
public void testH5Aiterate() {
|
||||
long attr1_id = -1;
|
||||
long attr2_id = -1;
|
||||
long attr3_id = -1;
|
||||
long attr4_id = -1;
|
||||
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;
|
||||
|
||||
class idata {
|
||||
public String attr_name = null;
|
||||
@@ -1052,10 +1051,10 @@ public class TestH5A {
|
||||
|
||||
@Test
|
||||
public void testH5Aiterate_by_name() {
|
||||
long attr1_id = -1;
|
||||
long attr2_id = -1;
|
||||
long attr3_id = -1;
|
||||
long attr4_id = -1;
|
||||
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;
|
||||
|
||||
class idata {
|
||||
public String attr_name = null;
|
||||
|
||||
449
java/test/TestH5Arw.java
Normal file
449
java/test/TestH5Arw.java
Normal file
@@ -0,0 +1,449 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the COPYING file, which can be found at the root of the source code *
|
||||
* distribution tree, or in https://www.hdfgroup.org/licenses. *
|
||||
* If you do not have access to either file, you may request a copy from *
|
||||
* help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
package test;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import hdf.hdf5lib.H5;
|
||||
import hdf.hdf5lib.HDF5Constants;
|
||||
import hdf.hdf5lib.HDFNativeData;
|
||||
import hdf.hdf5lib.callbacks.H5A_iterate_cb;
|
||||
import hdf.hdf5lib.callbacks.H5A_iterate_t;
|
||||
import hdf.hdf5lib.exceptions.HDF5Exception;
|
||||
import hdf.hdf5lib.exceptions.HDF5LibraryException;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestName;
|
||||
|
||||
public class TestH5Arw {
|
||||
@Rule public TestName testname = new TestName();
|
||||
private static final String H5_INTS_FILE = "tintsattrs.h5";
|
||||
private static final String H5_FLTS_FILE = "tfloatsattrs.h5";
|
||||
private static final int DIM_X = 8;
|
||||
private static final int DIM8_Y = 8;
|
||||
private static final int DIM16_Y = 16;
|
||||
private static final int DIM32_Y = 32;
|
||||
private static final int DIM64_Y = 64;
|
||||
private static final int DIM128_Y = 128;
|
||||
private static final String DATASETU08 = "DU08BITS";
|
||||
private static final String DATASETS08 = "DS08BITS";
|
||||
private static final String DATASETU16 = "DU16BITS";
|
||||
private static final String DATASETS16 = "DS16BITS";
|
||||
private static final String DATASETU32 = "DU32BITS";
|
||||
private static final String DATASETS32 = "DS32BITS";
|
||||
private static final String DATASETU64 = "DU64BITS";
|
||||
private static final String DATASETS64 = "DS64BITS";
|
||||
private static final String DATASETF32 = "DS32BITS";
|
||||
private static final String DATASETF64 = "DS64BITS";
|
||||
private static final String DATASETF128 = "DS128BITS";
|
||||
private static final int RANK = 2;
|
||||
long H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
long H5aid = HDF5Constants.H5I_INVALID_HID;
|
||||
long H5did = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
private final void _closeH5file() throws HDF5LibraryException {
|
||||
if (H5aid >= 0)
|
||||
try {H5.H5Aclose(H5aid);} catch (Exception ex) {}
|
||||
if (H5did >= 0)
|
||||
try {H5.H5Dclose(H5did);} catch (Exception ex) {}
|
||||
if (H5fid > 0)
|
||||
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
|
||||
}
|
||||
|
||||
public void openH5file(String filename, String dsetname) {
|
||||
try {
|
||||
H5fid = H5.H5Fopen(filename,
|
||||
HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("TestH5Arw._openH5file: " + err);
|
||||
}
|
||||
assertTrue("TestH5Arw._openH5file: H5.H5Fopen: ", H5fid >= 0);
|
||||
try {
|
||||
H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("TestH5Arw._openH5file: " + err);
|
||||
}
|
||||
assertTrue("TestH5Arw._openH5file: H5.H5Dopen: ", H5did >= 0);
|
||||
try {
|
||||
H5aid = H5.H5Aopen(H5did, dsetname, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("TestH5Arw._openH5file: " + err);
|
||||
}
|
||||
assertTrue("TestH5Arw._openH5file: H5.H5Aopen: ", H5aid >= 0);
|
||||
}
|
||||
|
||||
@After
|
||||
public void closeH5file() throws HDF5LibraryException {
|
||||
if (H5aid >= 0)
|
||||
try {H5.H5Aclose(H5aid);} catch (Exception ex) {}
|
||||
if (H5did >= 0)
|
||||
try {H5.H5Aclose(H5did);} catch (Exception ex) {}
|
||||
if (H5fid > 0)
|
||||
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
|
||||
H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5did = HDF5Constants.H5I_INVALID_HID;
|
||||
H5aid = HDF5Constants.H5I_INVALID_HID;
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void verifyCount()
|
||||
throws NullPointerException, HDF5Exception {
|
||||
assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0);
|
||||
System.out.print(testname.getMethodName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Aread_8bit_ints() {
|
||||
byte[][] attr_data = new byte[DIM_X][DIM8_Y];
|
||||
|
||||
try {
|
||||
openH5file(H5_INTS_FILE, DATASETU08);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_8bit_ints: openH5file: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_UINT8, attr_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_8bit_ints: H5Aread: " + err);
|
||||
}
|
||||
|
||||
// End access to the attribute and release resources used by it.
|
||||
try {
|
||||
H5.H5Aclose(H5aid);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
||||
// End access to the dataset and release resources used by it.
|
||||
try {
|
||||
H5.H5Dclose(H5did);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
||||
// Open an existing dataset.
|
||||
try {
|
||||
H5did = H5.H5Dopen(H5fid, DATASETS08, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_8bit_ints: H5Dopen: " + err);
|
||||
}
|
||||
|
||||
// Open an existing attribute.
|
||||
try {
|
||||
H5aid = H5.H5Aopen(H5did, DATASETS08, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_8bit_ints: H5Aopen: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_INT8, attr_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_8bit_ints: H5Aread: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Aread_16bit_ints() {
|
||||
short[][] attr_data = new short[DIM_X][DIM16_Y];
|
||||
|
||||
try {
|
||||
openH5file(H5_INTS_FILE, DATASETU16);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_16bit_ints: openH5file: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_UINT16, attr_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_16bit_ints: H5Aread: " + err);
|
||||
}
|
||||
|
||||
// End access to the attribute and release resources used by it.
|
||||
try {
|
||||
H5.H5Aclose(H5aid);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
||||
// End access to the dataset and release resources used by it.
|
||||
try {
|
||||
H5.H5Dclose(H5did);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
||||
// Open an existing dataset.
|
||||
try {
|
||||
H5did = H5.H5Dopen(H5fid, DATASETS16, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_16bit_ints: H5Dopen: " + err);
|
||||
}
|
||||
|
||||
// Open an existing attribute.
|
||||
try {
|
||||
H5aid = H5.H5Aopen(H5did, DATASETS16, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_16bit_ints: H5Aopen: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_INT16, attr_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_16bit_ints: H5Aread: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Aread_32bit_ints() {
|
||||
int[][] attr_data = new int[DIM_X][DIM16_Y];
|
||||
|
||||
try {
|
||||
openH5file(H5_INTS_FILE, DATASETU32);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_32bit_ints: openH5file: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_UINT32, attr_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_32bit_ints: H5Aread: " + err);
|
||||
}
|
||||
|
||||
// End access to the attribute and release resources used by it.
|
||||
try {
|
||||
H5.H5Aclose(H5aid);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
||||
// End access to the dataset and release resources used by it.
|
||||
try {
|
||||
H5.H5Dclose(H5did);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
||||
// Open an existing dataset.
|
||||
try {
|
||||
H5did = H5.H5Dopen(H5fid, DATASETS32, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_32bit_ints: H5Dopen: " + err);
|
||||
}
|
||||
|
||||
// Open an existing attribute.
|
||||
try {
|
||||
H5aid = H5.H5Aopen(H5did, DATASETS32, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_32bit_ints: H5Aopen: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_INT32, attr_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_32bit_ints: H5Aread: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Aread_64bit_ints() {
|
||||
long[][] attr_data = new long[DIM_X][DIM64_Y];
|
||||
|
||||
try {
|
||||
openH5file(H5_INTS_FILE, DATASETU64);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_64bit_ints: openH5file: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_UINT64, attr_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_64bit_ints: H5Aread: " + err);
|
||||
}
|
||||
|
||||
// End access to the attribute and release resources used by it.
|
||||
try {
|
||||
H5.H5Aclose(H5aid);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
||||
// End access to the dataset and release resources used by it.
|
||||
try {
|
||||
H5.H5Dclose(H5did);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
||||
// Open an existing dataset.
|
||||
try {
|
||||
H5did = H5.H5Dopen(H5fid, DATASETS64, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_64bit_ints: H5Dopen: " + err);
|
||||
}
|
||||
|
||||
// Open an existing attribute.
|
||||
try {
|
||||
H5aid = H5.H5Aopen(H5did, DATASETS64, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_64bit_ints: H5Aopen: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_INT64, attr_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_64bit_ints: H5Aread: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Aread_32bit_floats() {
|
||||
float[][] attr_data = new float[DIM_X][DIM32_Y];
|
||||
|
||||
try {
|
||||
openH5file(H5_FLTS_FILE, DATASETF32);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_32bit_floats: openH5file: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_FLOAT, attr_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_32bit_floats: H5Aread: " + err);
|
||||
}
|
||||
for (int i = 0; i < DIM_X; i++)
|
||||
assertTrue("testH5Aread_32bit_floats - H5.H5Aread: ", attr_data[i][0] == (32 - i));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Aread_64bit_floats() {
|
||||
double[][] attr_data = new double[DIM_X][DIM64_Y];
|
||||
|
||||
try {
|
||||
openH5file(H5_FLTS_FILE, DATASETF64);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_64bit_floats: openH5file: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_DOUBLE, attr_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_64bit_floats: H5Aread: " + err);
|
||||
}
|
||||
for (int i = 0; i < DIM_X; i++)
|
||||
assertTrue("testH5Aread_64bit_floats - H5.H5Aread: ", attr_data[i][0] == (64 - i));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Aread_128bit_floats() {
|
||||
byte[][][] attr_data = new byte[DIM_X][DIM128_Y][8];
|
||||
|
||||
try {
|
||||
openH5file(H5_FLTS_FILE, DATASETF128);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_128bit_floats: openH5file: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Aread(H5aid, HDF5Constants.H5T_NATIVE_LDOUBLE, attr_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Aread_128bit_floats: H5Aread: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -39,13 +38,13 @@ public class TestH5D {
|
||||
private static final int DIM_X = 4;
|
||||
private static final int DIM_Y = 6;
|
||||
private static final int RANK = 2;
|
||||
long H5fid = -1;
|
||||
long H5faplid = -1;
|
||||
long H5dsid = -1;
|
||||
long H5dtid = -1;
|
||||
long H5did = -1;
|
||||
long H5did0 = -1;
|
||||
long H5dcpl_id = -1;
|
||||
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
|
||||
@@ -195,10 +194,10 @@ public class TestH5D {
|
||||
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
|
||||
}
|
||||
|
||||
private final void _openH5file(String name, long dapl) {
|
||||
private final void _openH5file(String filename, String dsetname, long dapl) {
|
||||
try {
|
||||
H5fid = H5.H5Fopen(H5_FILE,
|
||||
HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
|
||||
H5fid = H5.H5Fopen(filename,
|
||||
HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
@@ -206,7 +205,7 @@ public class TestH5D {
|
||||
}
|
||||
assertTrue("TestH5D._openH5file: H5.H5Fopen: ",H5fid >= 0);
|
||||
try {
|
||||
H5did = H5.H5Dopen(H5fid, name, dapl);
|
||||
H5did = H5.H5Dopen(H5fid, dsetname, dapl);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
@@ -268,7 +267,7 @@ public class TestH5D {
|
||||
|
||||
@Test
|
||||
public void testH5Dcreate() {
|
||||
long dataset_id = -1;
|
||||
long dataset_id = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
dataset_id = H5.H5Dcreate(H5fid, "dset",
|
||||
HDF5Constants.H5T_STD_I32BE, H5dsid,
|
||||
@@ -292,7 +291,7 @@ public class TestH5D {
|
||||
|
||||
@Test
|
||||
public void testH5Dcreate_anon() {
|
||||
long dataset_id = -1;
|
||||
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);
|
||||
@@ -315,12 +314,12 @@ public class TestH5D {
|
||||
|
||||
@Test
|
||||
public void testH5Dopen() {
|
||||
long dataset_id = -1;
|
||||
long dataset_id = HDF5Constants.H5I_INVALID_HID;
|
||||
_createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
|
||||
|
||||
try {
|
||||
H5.H5Dclose(H5did);
|
||||
H5did = -1;
|
||||
H5did = HDF5Constants.H5I_INVALID_HID;
|
||||
dataset_id = H5.H5Dopen(H5fid, "dset", HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Exception err) {
|
||||
@@ -388,8 +387,8 @@ public class TestH5D {
|
||||
|
||||
@Test
|
||||
public void testH5Dget_access_plist() {
|
||||
long dapl_id = -1;
|
||||
long test_dapl_id = -1;
|
||||
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};
|
||||
@@ -500,7 +499,7 @@ public class TestH5D {
|
||||
|
||||
@Test(expected = HDF5LibraryException.class)
|
||||
public void testH5Dget_space_closed() throws Throwable {
|
||||
long dataset_id = -1;
|
||||
long dataset_id = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
dataset_id = H5.H5Dcreate(H5fid, "dset",
|
||||
HDF5Constants.H5T_STD_I32BE, H5dsid,
|
||||
@@ -518,7 +517,7 @@ public class TestH5D {
|
||||
|
||||
@Test
|
||||
public void testH5Dget_space() {
|
||||
long dataspace_id = -1;
|
||||
long dataspace_id = HDF5Constants.H5I_INVALID_HID;
|
||||
_createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
|
||||
|
||||
try {
|
||||
@@ -542,7 +541,7 @@ public class TestH5D {
|
||||
|
||||
@Test(expected = HDF5LibraryException.class)
|
||||
public void testH5Dget_type_closed() throws Throwable {
|
||||
long dataset_id = -1;
|
||||
long dataset_id = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
dataset_id = H5.H5Dcreate(H5fid, "dset",
|
||||
HDF5Constants.H5T_STD_I32BE, H5dsid,
|
||||
@@ -560,7 +559,7 @@ public class TestH5D {
|
||||
|
||||
@Test
|
||||
public void testH5Dget_type() {
|
||||
long datatype_id = -1;
|
||||
long datatype_id = HDF5Constants.H5I_INVALID_HID;
|
||||
_createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -42,10 +41,10 @@ public class TestH5Dplist {
|
||||
private static final int NDIMS = 2;
|
||||
private static final int FILLVAL = 99;
|
||||
private static final int RANK = 2;
|
||||
long H5fid = -1;
|
||||
long H5dsid = -1;
|
||||
long H5did = -1;
|
||||
long H5dcpl_id = -1;
|
||||
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 };
|
||||
|
||||
378
java/test/TestH5Drw.java
Normal file
378
java/test/TestH5Drw.java
Normal file
@@ -0,0 +1,378 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the COPYING file, which can be found at the root of the source code *
|
||||
* distribution tree, or in https://www.hdfgroup.org/licenses. *
|
||||
* If you do not have access to either file, you may request a copy from *
|
||||
* help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
package test;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import hdf.hdf5lib.H5;
|
||||
import hdf.hdf5lib.HDF5Constants;
|
||||
import hdf.hdf5lib.HDFNativeData;
|
||||
import hdf.hdf5lib.callbacks.H5D_iterate_cb;
|
||||
import hdf.hdf5lib.callbacks.H5D_iterate_t;
|
||||
import hdf.hdf5lib.exceptions.HDF5Exception;
|
||||
import hdf.hdf5lib.exceptions.HDF5LibraryException;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestName;
|
||||
|
||||
public class TestH5Drw {
|
||||
@Rule public TestName testname = new TestName();
|
||||
private static final String H5_INTS_FILE = "tintsattrs.h5";
|
||||
private static final String H5_FLTS_FILE = "tfloatsattrs.h5";
|
||||
private static final int DIM_X = 8;
|
||||
private static final int DIM8_Y = 8;
|
||||
private static final int DIM16_Y = 16;
|
||||
private static final int DIM32_Y = 32;
|
||||
private static final int DIM64_Y = 64;
|
||||
private static final int DIM128_Y = 128;
|
||||
private static final String DATASETU08 = "DU08BITS";
|
||||
private static final String DATASETS08 = "DS08BITS";
|
||||
private static final String DATASETU16 = "DU16BITS";
|
||||
private static final String DATASETS16 = "DS16BITS";
|
||||
private static final String DATASETU32 = "DU32BITS";
|
||||
private static final String DATASETS32 = "DS32BITS";
|
||||
private static final String DATASETU64 = "DU64BITS";
|
||||
private static final String DATASETS64 = "DS64BITS";
|
||||
private static final String DATASETF32 = "DS32BITS";
|
||||
private static final String DATASETF64 = "DS64BITS";
|
||||
private static final String DATASETF128 = "DS128BITS";
|
||||
private static final int RANK = 2;
|
||||
long H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
long H5did = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
private final void _closeH5file() throws HDF5LibraryException {
|
||||
if (H5did >= 0)
|
||||
try {H5.H5Dclose(H5did);} catch (Exception ex) {}
|
||||
if (H5fid > 0)
|
||||
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
|
||||
}
|
||||
|
||||
public void openH5file(String filename, String dsetname) {
|
||||
try {
|
||||
H5fid = H5.H5Fopen(filename,
|
||||
HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("TestH5Drw._openH5file: " + err);
|
||||
}
|
||||
assertTrue("TestH5Drw._openH5file: H5.H5Fopen: ", H5fid >= 0);
|
||||
try {
|
||||
H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("TestH5Drw._openH5file: " + err);
|
||||
}
|
||||
assertTrue("TestH5Drw._openH5file: H5.H5Dopen: ", H5did >= 0);
|
||||
}
|
||||
|
||||
@After
|
||||
public void closeH5file() throws HDF5LibraryException {
|
||||
if (H5did >= 0)
|
||||
try {H5.H5Dclose(H5did);} catch (Exception ex) {}
|
||||
if (H5fid > 0)
|
||||
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
|
||||
H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5did = HDF5Constants.H5I_INVALID_HID;
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void verifyCount()
|
||||
throws NullPointerException, HDF5Exception {
|
||||
assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0);
|
||||
System.out.print(testname.getMethodName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Dread_8bit_ints() {
|
||||
byte[][] dset_data = new byte[DIM_X][DIM8_Y];
|
||||
|
||||
try {
|
||||
openH5file(H5_INTS_FILE, DATASETU08);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_8bit_ints: openH5file: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
|
||||
HDF5Constants.H5P_DEFAULT, dset_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_8bit_ints: H5Dread: " + err);
|
||||
}
|
||||
|
||||
// End access to the dataset and release resources used by it.
|
||||
try {
|
||||
H5.H5Dclose(H5did);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
||||
// Open an existing dataset.
|
||||
try {
|
||||
H5did = H5.H5Dopen(H5fid, DATASETS08, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_8bit_ints: H5Dopen: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
|
||||
HDF5Constants.H5P_DEFAULT, dset_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_8bit_ints: H5Dread: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Dread_16bit_ints() {
|
||||
short[][] dset_data = new short[DIM_X][DIM16_Y];
|
||||
|
||||
try {
|
||||
openH5file(H5_INTS_FILE, DATASETU16);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_16bit_ints: openH5file: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT16, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
|
||||
HDF5Constants.H5P_DEFAULT, dset_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_16bit_ints: H5Dread: " + err);
|
||||
}
|
||||
|
||||
// End access to the dataset and release resources used by it.
|
||||
try {
|
||||
H5.H5Dclose(H5did);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
||||
// Open an existing dataset.
|
||||
try {
|
||||
H5did = H5.H5Dopen(H5fid, DATASETS16, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_16bit_ints: H5Dopen: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT16, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
|
||||
HDF5Constants.H5P_DEFAULT, dset_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_16bit_ints: H5Dread: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Dread_32bit_ints() {
|
||||
int[][] dset_data = new int[DIM_X][DIM16_Y];
|
||||
|
||||
try {
|
||||
openH5file(H5_INTS_FILE, DATASETU32);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_32bit_ints: openH5file: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT32, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
|
||||
HDF5Constants.H5P_DEFAULT, dset_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_32bit_ints: H5Dread: " + err);
|
||||
}
|
||||
|
||||
// End access to the dataset and release resources used by it.
|
||||
try {
|
||||
H5.H5Dclose(H5did);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
||||
// Open an existing dataset.
|
||||
try {
|
||||
H5did = H5.H5Dopen(H5fid, DATASETS32, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_32bit_ints: H5Dopen: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT32, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
|
||||
HDF5Constants.H5P_DEFAULT, dset_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_32bit_ints: H5Dread: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Dread_64bit_ints() {
|
||||
long[][] dset_data = new long[DIM_X][DIM64_Y];
|
||||
|
||||
try {
|
||||
openH5file(H5_INTS_FILE, DATASETU64);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_64bit_ints: openH5file: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT64, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
|
||||
HDF5Constants.H5P_DEFAULT, dset_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_64bit_ints: H5Dread: " + err);
|
||||
}
|
||||
|
||||
// End access to the dataset and release resources used by it.
|
||||
try {
|
||||
H5.H5Dclose(H5did);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
||||
// Open an existing dataset.
|
||||
try {
|
||||
H5did = H5.H5Dopen(H5fid, DATASETS64, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_64bit_ints: H5Dopen: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT64, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
|
||||
HDF5Constants.H5P_DEFAULT, dset_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_64bit_ints: H5Dread: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Dread_32bit_floats() {
|
||||
float[][] dset_data = new float[DIM_X][DIM32_Y];
|
||||
|
||||
try {
|
||||
openH5file(H5_FLTS_FILE, DATASETF32);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_32bit_floats: openH5file: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_FLOAT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
|
||||
HDF5Constants.H5P_DEFAULT, dset_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_32bit_floats: H5Dread: " + err);
|
||||
}
|
||||
for (int i = 0; i < DIM_X; i++)
|
||||
assertTrue("testH5Dread_32bit_floats - H5.H5Dread: ", dset_data[i][0] == (32 - i));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Dread_64bit_floats() {
|
||||
double[][] dset_data = new double[DIM_X][DIM64_Y];
|
||||
|
||||
try {
|
||||
openH5file(H5_FLTS_FILE, DATASETF64);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_64bit_floats: openH5file: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
|
||||
HDF5Constants.H5P_DEFAULT, dset_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_64bit_floats: H5Dread: " + err);
|
||||
}
|
||||
for (int i = 0; i < DIM_X; i++)
|
||||
assertTrue("testH5Dread_64bit_floats - H5.H5Dread: ", dset_data[i][0] == (64 - i));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Dread_128bit_floats() {
|
||||
byte[][][] dset_data = new byte[DIM_X][DIM128_Y][8];
|
||||
|
||||
try {
|
||||
openH5file(H5_FLTS_FILE, DATASETF128);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_128bit_floats: openH5file: " + err);
|
||||
}
|
||||
|
||||
// Read data.
|
||||
try {
|
||||
H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_LDOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
|
||||
HDF5Constants.H5P_DEFAULT, dset_data);
|
||||
}
|
||||
catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Dread_128bit_floats: H5Dread: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -58,27 +57,27 @@ public class TestH5Edefault {
|
||||
|
||||
@Ignore
|
||||
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.
|
||||
*/
|
||||
String connector = System.getenv("HDF5_VOL_CONNECTOR");
|
||||
if (connector == null) {
|
||||
try {
|
||||
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
}
|
||||
try {
|
||||
H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("H5.H5Eprint: " + err);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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 {
|
||||
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
}
|
||||
try {
|
||||
H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("H5.H5Eprint: " + err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -439,27 +438,27 @@ public class TestH5Edefault {
|
||||
|
||||
@Ignore
|
||||
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.
|
||||
*/
|
||||
String connector = System.getenv("HDF5_VOL_CONNECTOR");
|
||||
if (connector == null) {
|
||||
try {
|
||||
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
}
|
||||
try {
|
||||
H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("H5.H5EprintInt: " + err);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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 {
|
||||
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
}
|
||||
try {
|
||||
H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("H5.H5EprintInt: " + err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -49,7 +48,7 @@ public class TestH5F {
|
||||
HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP,
|
||||
HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR,
|
||||
HDF5Constants.H5F_OBJ_ALL };
|
||||
long H5fid = -1;
|
||||
long H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
private final void _deleteFile(String filename) {
|
||||
File file = new File(filename);
|
||||
@@ -74,7 +73,7 @@ public class TestH5F {
|
||||
public void deleteH5file() throws HDF5LibraryException {
|
||||
if (H5fid > 0) {
|
||||
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
|
||||
H5fid = -1;
|
||||
H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
}
|
||||
_deleteFile(H5_FILE);
|
||||
System.out.println();
|
||||
@@ -82,7 +81,7 @@ public class TestH5F {
|
||||
|
||||
@Test
|
||||
public void testH5Fget_create_plist() {
|
||||
long plist = -1;
|
||||
long plist = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
plist = H5.H5Fget_create_plist(H5fid);
|
||||
@@ -106,7 +105,7 @@ public class TestH5F {
|
||||
|
||||
@Test
|
||||
public void testH5Fget_access_plist() {
|
||||
long plist = -1;
|
||||
long plist = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
plist = H5.H5Fget_access_plist(H5fid);
|
||||
@@ -134,7 +133,7 @@ public class TestH5F {
|
||||
|
||||
if (H5fid > 0) {
|
||||
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
|
||||
H5fid = -1;
|
||||
H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -159,7 +158,7 @@ public class TestH5F {
|
||||
|
||||
if (H5fid > 0) {
|
||||
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
|
||||
H5fid = -1;
|
||||
H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -182,8 +181,8 @@ public class TestH5F {
|
||||
public void testH5Fget_fileno_same() {
|
||||
long fileno1 = 0;
|
||||
long fileno2 = 0;
|
||||
long fid1 = -1;
|
||||
long fid2 = -1;
|
||||
long fid1 = HDF5Constants.H5I_INVALID_HID;
|
||||
long fid2 = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
fid1 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC,
|
||||
@@ -213,7 +212,7 @@ public class TestH5F {
|
||||
public void testH5Fget_fileno_diff() {
|
||||
long fileno1 = 0;
|
||||
long fileno2 = 0;
|
||||
long fid2 = -1;
|
||||
long fid2 = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
fid2 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -35,7 +34,7 @@ public class TestH5Fbasic {
|
||||
@Rule public TestName testname = new TestName();
|
||||
private static final String H5_FILE = "testFb.h5";
|
||||
private static final String TXT_FILE = "testFb.txt";
|
||||
long H5fid = -1;
|
||||
long H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
private final void _deleteFile(String filename) {
|
||||
File file = new File(filename);
|
||||
@@ -90,7 +89,7 @@ public class TestH5Fbasic {
|
||||
|
||||
@Test(expected = HDF5LibraryException.class)
|
||||
public void testH5Fopen_read_only() throws Throwable {
|
||||
long fid = -1;
|
||||
long fid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
|
||||
@@ -125,8 +124,8 @@ public class TestH5Fbasic {
|
||||
|
||||
@Test(expected = HDF5LibraryException.class)
|
||||
public void testH5Freopen_closed() throws Throwable {
|
||||
long fid = -1;
|
||||
long fid2 = -1;
|
||||
long fid = HDF5Constants.H5I_INVALID_HID;
|
||||
long fid2 = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
|
||||
@@ -148,8 +147,8 @@ public class TestH5Fbasic {
|
||||
|
||||
@Test
|
||||
public void testH5Freopen() {
|
||||
long fid = -1;
|
||||
long fid2 = -1;
|
||||
long fid = HDF5Constants.H5I_INVALID_HID;
|
||||
long fid2 = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
|
||||
@@ -182,7 +181,7 @@ public class TestH5Fbasic {
|
||||
|
||||
@Test
|
||||
public void testH5Fclose() {
|
||||
long fid = -1;
|
||||
long fid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
|
||||
@@ -202,7 +201,7 @@ public class TestH5Fbasic {
|
||||
|
||||
@Test(expected = HDF5LibraryException.class)
|
||||
public void testH5Fclose_twice() throws Throwable {
|
||||
long fid = -1;
|
||||
long fid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -105,7 +104,7 @@ public class TestH5Fparams {
|
||||
|
||||
@Test
|
||||
public void testH5Fcreate() {
|
||||
long fid = -1;
|
||||
long fid = HDF5Constants.H5I_INVALID_HID;
|
||||
File file = null;
|
||||
|
||||
try {
|
||||
@@ -132,7 +131,7 @@ public class TestH5Fparams {
|
||||
|
||||
@Test
|
||||
public void testH5Fflush_global() {
|
||||
long fid = -1;
|
||||
long fid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
|
||||
@@ -158,7 +157,7 @@ public class TestH5Fparams {
|
||||
|
||||
@Test
|
||||
public void testH5Fflush_local() {
|
||||
long fid = -1;
|
||||
long fid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
|
||||
@@ -184,7 +183,7 @@ public class TestH5Fparams {
|
||||
|
||||
@Test
|
||||
public void testH5Fget_info() {
|
||||
long fid = -1;
|
||||
long fid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
try {
|
||||
@@ -215,7 +214,7 @@ public class TestH5Fparams {
|
||||
|
||||
@Ignore//(expected = HDF5FunctionArgumentException.class)
|
||||
public void testH5Fset_libver_bounds_invalidlow() throws Throwable {
|
||||
long fid = -1;
|
||||
long fid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
try {
|
||||
@@ -234,7 +233,7 @@ public class TestH5Fparams {
|
||||
|
||||
@Ignore//(expected = HDF5FunctionArgumentException.class)
|
||||
public void testH5Fset_libver_bounds_invalidhigh() throws Throwable {
|
||||
long fid = -1;
|
||||
long fid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -33,9 +32,9 @@ public class TestH5Fswmr {
|
||||
@Rule public TestName testname = new TestName();
|
||||
private static final String H5_FILE = "testswmr.h5";
|
||||
|
||||
long H5fid = -1;
|
||||
long H5fapl = -1;
|
||||
long H5fcpl = -1;
|
||||
long H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
long H5fapl = HDF5Constants.H5I_INVALID_HID;
|
||||
long H5fcpl = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
private final void _deleteFile(String filename) {
|
||||
File file = new File(filename);
|
||||
@@ -63,15 +62,15 @@ public class TestH5Fswmr {
|
||||
public void deleteH5file() throws HDF5LibraryException {
|
||||
if (H5fapl > 0) {
|
||||
try {H5.H5Pclose(H5fapl);} catch (Exception ex) {}
|
||||
H5fapl = -1;
|
||||
H5fapl = HDF5Constants.H5I_INVALID_HID;
|
||||
}
|
||||
if (H5fcpl > 0) {
|
||||
try {H5.H5Pclose(H5fcpl);} catch (Exception ex) {}
|
||||
H5fcpl = -1;
|
||||
H5fcpl = HDF5Constants.H5I_INVALID_HID;
|
||||
}
|
||||
if (H5fid > 0) {
|
||||
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
|
||||
H5fid = -1;
|
||||
H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
}
|
||||
_deleteFile(H5_FILE);
|
||||
System.out.println();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -39,11 +38,11 @@ public class TestH5G {
|
||||
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 = -1;
|
||||
long H5fid2 = -1;
|
||||
long H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
long H5fid2 = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
private final long _createGroup(long fid, String name) {
|
||||
long gid = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
|
||||
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
|
||||
@@ -58,8 +57,8 @@ public class TestH5G {
|
||||
}
|
||||
|
||||
private final long _createGroup2(long fid, String name) {
|
||||
long gid = -1;
|
||||
long gcpl = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
long gcpl = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
gcpl = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); //create gcpl
|
||||
}
|
||||
@@ -92,12 +91,12 @@ public class TestH5G {
|
||||
}
|
||||
|
||||
private final long _openGroup(long fid, String name) {
|
||||
long gid = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
gid = -1;
|
||||
gid = HDF5Constants.H5I_INVALID_HID;
|
||||
err.printStackTrace();
|
||||
fail("H5.H5Gopen: " + err);
|
||||
}
|
||||
@@ -134,7 +133,7 @@ public class TestH5G {
|
||||
assertTrue("TestH5G.createH5file: H5.H5Fcreate: ", H5fid > 0);
|
||||
assertTrue("TestH5G.createH5file: H5.H5Fcreate: ", H5fid2 > 0);
|
||||
|
||||
long gid = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
for (int i = 0; i < GROUPS.length; i++) {
|
||||
gid = _createGroup(H5fid, GROUPS[i]);
|
||||
@@ -165,7 +164,7 @@ public class TestH5G {
|
||||
|
||||
@Test
|
||||
public void testH5Gopen() {
|
||||
long gid = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
for (int i = 0; i < GROUPS.length; i++) {
|
||||
try {
|
||||
gid = H5.H5Gopen(H5fid, GROUPS[i], HDF5Constants.H5P_DEFAULT);
|
||||
@@ -185,8 +184,8 @@ public class TestH5G {
|
||||
|
||||
@Test
|
||||
public void testH5Gget_create_plist() {
|
||||
long gid = -1;
|
||||
long pid = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
long pid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
for (int i = 0; i < GROUPS.length; i++) {
|
||||
try {
|
||||
@@ -325,7 +324,7 @@ public class TestH5G {
|
||||
int names_found = 0;
|
||||
try {
|
||||
names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes,
|
||||
objTokens, HDF5Constants.H5_INDEX_NAME);
|
||||
objTokens, HDF5Constants.H5_INDEX_NAME);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
@@ -366,7 +365,7 @@ public class TestH5G {
|
||||
int names_found = 0;
|
||||
try {
|
||||
names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes,
|
||||
objTokens, HDF5Constants.H5_INDEX_NAME);
|
||||
objTokens, HDF5Constants.H5_INDEX_NAME);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
@@ -401,7 +400,7 @@ public class TestH5G {
|
||||
int names_found = 0;
|
||||
try {
|
||||
names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes,
|
||||
objTokens, groups_max_size);
|
||||
objTokens, groups_max_size);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
@@ -432,7 +431,7 @@ public class TestH5G {
|
||||
int names_found = 0;
|
||||
try {
|
||||
names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes,
|
||||
objTokens, groups_max_size);
|
||||
objTokens, groups_max_size);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -33,10 +32,10 @@ import org.junit.rules.TestName;
|
||||
public class TestH5Gbasic {
|
||||
@Rule public TestName testname = new TestName();
|
||||
private static final String H5_FILE = "testGb.h5";
|
||||
long H5fid = -1;
|
||||
long H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
private final long _createGroup(long fid, String name) {
|
||||
long gid = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
|
||||
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
|
||||
@@ -85,7 +84,7 @@ public class TestH5Gbasic {
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testH5Gcreate_null() throws Throwable {
|
||||
long gid = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
// it should fail because the group name is null
|
||||
gid = H5.H5Gcreate(H5fid, null, HDF5Constants.H5P_DEFAULT,
|
||||
@@ -102,7 +101,7 @@ public class TestH5Gbasic {
|
||||
|
||||
@Test
|
||||
public void testH5Gcreate() {
|
||||
long gid = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
gid = H5.H5Gcreate(H5fid, "/testH5Gcreate",
|
||||
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT,
|
||||
@@ -145,7 +144,7 @@ public class TestH5Gbasic {
|
||||
|
||||
@Test
|
||||
public void testH5Gcreate_anon() {
|
||||
long gid = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
gid = H5.H5Gcreate_anon(H5fid, HDF5Constants.H5P_DEFAULT,
|
||||
HDF5Constants.H5P_DEFAULT);
|
||||
@@ -161,7 +160,7 @@ public class TestH5Gbasic {
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testH5Gopen_null() throws Throwable {
|
||||
long gid = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
gid = H5.H5Gopen(H5fid, null, HDF5Constants.H5P_DEFAULT);
|
||||
|
||||
@@ -175,7 +174,7 @@ public class TestH5Gbasic {
|
||||
|
||||
@Test(expected = HDF5LibraryException.class)
|
||||
public void testH5Gopen_not_exists() throws Throwable {
|
||||
long gid = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
gid = H5.H5Gopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT);
|
||||
|
||||
@@ -209,7 +208,7 @@ public class TestH5Gbasic {
|
||||
|
||||
@Test
|
||||
public void testH5Gget_create_plist() {
|
||||
long pid = -1;
|
||||
long pid = HDF5Constants.H5I_INVALID_HID;
|
||||
long gid = _createGroup(H5fid, "/testH5Gcreate");
|
||||
assertTrue(gid > 0);
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -31,15 +30,15 @@ import org.junit.rules.TestName;
|
||||
public class TestH5Giterate {
|
||||
@Rule public TestName testname = new TestName();
|
||||
private static final String H5_FILE = "h5ex_g_iterate.hdf";
|
||||
long H5fid = -1;
|
||||
long H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
private final long _openGroup(long fid, String name) {
|
||||
long gid = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
gid = -1;
|
||||
gid = HDF5Constants.H5I_INVALID_HID;
|
||||
err.printStackTrace();
|
||||
fail("H5.H5Gcreate: " + err);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -35,7 +34,7 @@ import org.junit.rules.TestName;
|
||||
public class TestH5Lbasic {
|
||||
@Rule public TestName testname = new TestName();
|
||||
private static final String H5_FILE = "h5ex_g_iterateL1.hdf";
|
||||
long H5fid = -1;
|
||||
long H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
@Before
|
||||
public void openH5file()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -41,13 +40,13 @@ public class TestH5Lcreate {
|
||||
private static final String H5_FILE = "testL.h5";
|
||||
private static final int DIM_X = 4;
|
||||
private static final int DIM_Y = 6;
|
||||
long H5fcpl = -1;
|
||||
long H5fid = -1;
|
||||
long H5dsid = -1;
|
||||
long H5did1 = -1;
|
||||
long H5did2 = -1;
|
||||
long H5gcpl = -1;
|
||||
long H5gid = -1;
|
||||
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) {
|
||||
@@ -64,7 +63,7 @@ public class TestH5Lcreate {
|
||||
}
|
||||
|
||||
private final long _createDataset(long fid, long dsid, String name, long dapl) {
|
||||
long did = -1;
|
||||
long did = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
did = H5.H5Dcreate(fid, name,
|
||||
HDF5Constants.H5T_STD_I32BE, dsid,
|
||||
@@ -80,7 +79,7 @@ public class TestH5Lcreate {
|
||||
}
|
||||
|
||||
private final long _createGroup(long fid, String name) {
|
||||
long gid = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
H5gcpl = HDF5Constants.H5P_DEFAULT;
|
||||
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -41,7 +40,7 @@ public class TestH5Obasic {
|
||||
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 = -1;
|
||||
long H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
@Before
|
||||
public void openH5file()
|
||||
@@ -69,7 +68,7 @@ public class TestH5Obasic {
|
||||
|
||||
@Test(expected = HDF5LibraryException.class)
|
||||
public void testH5Oopen_not_exists() throws Throwable {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
oid = H5.H5Oopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT);
|
||||
|
||||
@@ -78,7 +77,7 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oget_info_dataset() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_info_t obj_info = null;
|
||||
|
||||
try {
|
||||
@@ -96,7 +95,7 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oget_info_hardlink() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_info_t obj_info = null;
|
||||
try {
|
||||
oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
|
||||
@@ -113,7 +112,7 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oget_info_group() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_info_t obj_info = null;
|
||||
try {
|
||||
oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
|
||||
@@ -130,7 +129,7 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oget_info_datatype() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_info_t obj_info = null;
|
||||
try {
|
||||
oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT);
|
||||
@@ -234,7 +233,7 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oget_info_by_idx_n0() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_info_t obj_info = null;
|
||||
try {
|
||||
oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
|
||||
@@ -260,7 +259,7 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oget_info_by_idx_n3() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_info_t obj_info = null;
|
||||
try {
|
||||
oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
|
||||
@@ -286,7 +285,7 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oget_native_info_dataset() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_native_info_t native_info = null;
|
||||
|
||||
try {
|
||||
@@ -306,7 +305,7 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oget_native_info_hardlink() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_native_info_t native_info = null;
|
||||
|
||||
try {
|
||||
@@ -326,7 +325,7 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oget_native_info_group() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_native_info_t native_info = null;
|
||||
|
||||
try {
|
||||
@@ -346,7 +345,7 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oget_native_info_datatype() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_native_info_t native_info = null;
|
||||
|
||||
try {
|
||||
@@ -376,10 +375,10 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oget_native_info_by_name_dataset() {
|
||||
H5O_native_info_t native_info = null;
|
||||
H5O_native_info_t native_info = null;
|
||||
|
||||
try {
|
||||
native_info = H5.H5Oget_native_info_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
|
||||
native_info = H5.H5Oget_native_info_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
@@ -393,10 +392,10 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oget_native_info_by_name_hardlink() {
|
||||
H5O_native_info_t native_info = null;
|
||||
H5O_native_info_t native_info = null;
|
||||
|
||||
try {
|
||||
native_info = H5.H5Oget_native_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
|
||||
native_info = H5.H5Oget_native_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
@@ -410,10 +409,10 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oget_native_info_by_name_group() {
|
||||
H5O_native_info_t native_info = null;
|
||||
H5O_native_info_t native_info = null;
|
||||
|
||||
try {
|
||||
native_info = H5.H5Oget_native_info_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
|
||||
native_info = H5.H5Oget_native_info_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
@@ -427,10 +426,10 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oget_native_info_by_name_datatype() {
|
||||
H5O_native_info_t native_info = null;
|
||||
H5O_native_info_t native_info = null;
|
||||
|
||||
try {
|
||||
native_info = H5.H5Oget_native_info_by_name(H5fid, "DT1", HDF5Constants.H5P_DEFAULT);
|
||||
native_info = H5.H5Oget_native_info_by_name(H5fid, "DT1", HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
@@ -464,7 +463,7 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oget_native_info_by_idx_n0() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_native_info_t native_info = null;
|
||||
H5O_hdr_info_t ohdr;
|
||||
H5_ih_info_t oinfo;
|
||||
@@ -486,7 +485,7 @@ public class TestH5Obasic {
|
||||
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();
|
||||
@@ -503,7 +502,7 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oget_native_info_by_idx_n3() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_native_info_t native_info = null;
|
||||
H5O_hdr_info_t ohdr;
|
||||
H5_ih_info_t oinfo;
|
||||
@@ -525,7 +524,7 @@ public class TestH5Obasic {
|
||||
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();
|
||||
@@ -630,7 +629,7 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oopen_by_token() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_info_t obj_info = null;
|
||||
try {
|
||||
try {
|
||||
@@ -668,7 +667,7 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oopen_by_idx_n0() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_info_t obj_info = null;
|
||||
try {
|
||||
try {
|
||||
@@ -706,7 +705,7 @@ public class TestH5Obasic {
|
||||
|
||||
@Test
|
||||
public void testH5Oopen_by_idx_n3() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_info_t obj_info = null;
|
||||
try {
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -36,13 +35,13 @@ public class TestH5Ocopy {
|
||||
private static final String FILENAME = "testRefsattribute.h5";
|
||||
private static final int DIM_X = 4;
|
||||
private static final int DIM_Y = 6;
|
||||
long H5fid = -1;
|
||||
long H5dsid = -1;
|
||||
long H5did1 = -1;
|
||||
long H5did2 = -1;
|
||||
long H5gcpl = -1;
|
||||
long H5gid = -1;
|
||||
long H5dsid2 = -1;
|
||||
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) {
|
||||
@@ -59,7 +58,7 @@ public class TestH5Ocopy {
|
||||
}
|
||||
|
||||
private final long _createDataset(long fid, long dsid, String name, long dapl) {
|
||||
long did = -1;
|
||||
long did = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
did = H5.H5Dcreate(fid, name,
|
||||
HDF5Constants.H5T_STD_I32BE, dsid,
|
||||
@@ -75,7 +74,7 @@ public class TestH5Ocopy {
|
||||
}
|
||||
|
||||
private final long _createGroup(long fid, String name) {
|
||||
long gid = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
H5gcpl = HDF5Constants.H5P_DEFAULT;
|
||||
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
|
||||
@@ -136,10 +135,10 @@ public class TestH5Ocopy {
|
||||
|
||||
@Test
|
||||
public void testH5OcopyRefsAttr() {
|
||||
long ocp_plist_id = -1;
|
||||
long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
|
||||
byte rbuf0[]=null , rbuf1[] = null;
|
||||
byte[] dset_data = new byte[16];
|
||||
long attribute_id = -1;
|
||||
long attribute_id = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
|
||||
try {
|
||||
@@ -184,9 +183,9 @@ public class TestH5Ocopy {
|
||||
public void testH5OcopyRefsDatasettodiffFile() {
|
||||
byte rbuf1[] = null;
|
||||
byte[] dset_data = new byte[16];
|
||||
long ocp_plist_id = -1;
|
||||
long dataset_id = -1;
|
||||
long H5fid2 = -1;
|
||||
long ocp_plist_id = 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);
|
||||
@@ -244,9 +243,9 @@ public class TestH5Ocopy {
|
||||
public void testH5OcopyRefsDatasettosameFile() {
|
||||
byte rbuf0[]=null , rbuf1[] = null;
|
||||
byte[] dset_data = new byte[16];
|
||||
long ocp_plist_id = -1;
|
||||
long dataset_id = -1;
|
||||
long did = -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;
|
||||
byte[] read_data = new byte[16];
|
||||
|
||||
@@ -328,9 +327,9 @@ public class TestH5Ocopy {
|
||||
// @Test(expected = HDF5LibraryException.class)
|
||||
// public void testH5OcopyInvalidRef() throws Throwable {
|
||||
// final long _pid_ = HDF5Constants.H5P_DEFAULT;
|
||||
// long sid = -1;
|
||||
// long did = -1;
|
||||
// long aid = -1;
|
||||
// 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);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -41,13 +40,13 @@ public class TestH5Ocreate {
|
||||
private static final String H5_FILE = "testO.h5";
|
||||
private static final int DIM_X = 4;
|
||||
private static final int DIM_Y = 6;
|
||||
long H5fcpl = -1;
|
||||
long H5fid = -1;
|
||||
long H5dsid = -1;
|
||||
long H5did1 = -1;
|
||||
long H5did2 = -1;
|
||||
long H5gcpl = -1;
|
||||
long H5gid = -1;
|
||||
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) {
|
||||
@@ -64,7 +63,7 @@ public class TestH5Ocreate {
|
||||
}
|
||||
|
||||
private final long _createDataset(long fid, long dsid, String name, long dapl) {
|
||||
long did = -1;
|
||||
long did = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
did = H5.H5Dcreate(fid, name,
|
||||
HDF5Constants.H5T_STD_I32BE, dsid,
|
||||
@@ -80,7 +79,7 @@ public class TestH5Ocreate {
|
||||
}
|
||||
|
||||
private final long _createGroup(long fid, String name) {
|
||||
long gid = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
H5gcpl = HDF5Constants.H5P_DEFAULT;
|
||||
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
|
||||
@@ -293,7 +292,7 @@ public class TestH5Ocreate {
|
||||
|
||||
@Test
|
||||
public void testH5Olink() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_info_t obj_info = null;
|
||||
H5O_info_t dst_obj_info = null;
|
||||
try {
|
||||
@@ -380,7 +379,7 @@ public class TestH5Ocreate {
|
||||
|
||||
@Test
|
||||
public void testH5Ocomment() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
String obj_comment = null;
|
||||
try {
|
||||
oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
|
||||
@@ -405,7 +404,7 @@ public class TestH5Ocreate {
|
||||
|
||||
@Test
|
||||
public void testH5Ocomment_clear() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
String obj_comment = null;
|
||||
try {
|
||||
oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
|
||||
@@ -506,7 +505,7 @@ public class TestH5Ocreate {
|
||||
|
||||
@Test
|
||||
public void testH5Oinc_dec_count() {
|
||||
long oid = -1;
|
||||
long oid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5O_info_t obj_info = null;
|
||||
try {
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -41,20 +40,20 @@ public class TestH5P {
|
||||
private static final int DIM_X = 4;
|
||||
private static final int DIM_Y = 6;
|
||||
long[] H5dims = { DIM_X, DIM_Y };
|
||||
long H5fid = -1;
|
||||
long H5dsid = -1;
|
||||
long H5did = -1;
|
||||
long lapl_id = -1;
|
||||
long fapl_id = -1;
|
||||
long fcpl_id = -1;
|
||||
long ocpl_id = -1;
|
||||
long ocp_plist_id = -1;
|
||||
long lcpl_id = -1;
|
||||
long plapl_id = -1;
|
||||
long plist_id = -1;
|
||||
long gapl_id = -1;
|
||||
long gcpl_id = -1;
|
||||
long acpl_id = -1;
|
||||
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);
|
||||
@@ -65,7 +64,7 @@ public class TestH5P {
|
||||
}
|
||||
|
||||
private final long _createDataset(long fid, long dsid, String name, long dapl) {
|
||||
long did = -1;
|
||||
long did = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid,
|
||||
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -37,10 +36,10 @@ public class TestH5PData {
|
||||
private static final String H5_FILE = "testPD.h5";
|
||||
private static final int DIM_X = 12;
|
||||
private static final int DIM_Y = 18;
|
||||
long H5fid = -1;
|
||||
long H5dsid = -1;
|
||||
long H5did = -1;
|
||||
long plist_id = -1;
|
||||
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},
|
||||
@@ -66,7 +65,7 @@ public class TestH5PData {
|
||||
}
|
||||
|
||||
private final long _createFloatDataset(long fid, long dsid, String name, long dapl) {
|
||||
long did = -1;
|
||||
long did = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_NATIVE_FLOAT, dsid,
|
||||
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -147,11 +146,11 @@ public class TestH5PL {
|
||||
|
||||
@Ignore
|
||||
public void TestH5PLdlopen() {
|
||||
long file_id = -1;
|
||||
long filespace_id = -1;
|
||||
long dataset_id = -1;
|
||||
long fapl_id = -1;
|
||||
long dcpl_id = -1;
|
||||
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;
|
||||
try {
|
||||
int[] cd_values = {9, 0, 0, 0};
|
||||
int[] libversion = {0, 0, 0};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -47,17 +46,17 @@ public class TestH5Pfapl {
|
||||
private static final int DIM_Y = 6;
|
||||
private static final int DIMF_X = 12;
|
||||
private static final int DIMF_Y = 18;
|
||||
long H5fid = -1;
|
||||
long H5dsid = -1;
|
||||
long H5did = -1;
|
||||
long H5Fdsid = -1;
|
||||
long H5Fdid = -1;
|
||||
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 = -1;
|
||||
long plapl_id = -1;
|
||||
long dapl_id = -1;
|
||||
long plist_id = -1;
|
||||
long btplist_id = -1;
|
||||
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},
|
||||
@@ -130,7 +129,7 @@ public class TestH5Pfapl {
|
||||
}
|
||||
|
||||
private final long _createDataset(long fid, long dsid, String name, long dapl) {
|
||||
long did = -1;
|
||||
long did = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid,
|
||||
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
|
||||
@@ -385,7 +384,7 @@ public class TestH5Pfapl {
|
||||
|
||||
@Test
|
||||
public void testH5Pget_elink_fapl() {
|
||||
long ret_val_id = -1;
|
||||
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);
|
||||
@@ -403,7 +402,7 @@ public class TestH5Pfapl {
|
||||
|
||||
@Test
|
||||
public void testH5P_elink_fapl() {
|
||||
long ret_val_id = -1;
|
||||
long ret_val_id = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
H5.H5Pset_elink_fapl(plapl_id, fapl_id );
|
||||
ret_val_id = H5.H5Pget_elink_fapl(plapl_id);
|
||||
@@ -421,7 +420,7 @@ public class TestH5Pfapl {
|
||||
|
||||
@Test
|
||||
public void testH5P_elink_file_cache_size() {
|
||||
long elink_fapl_id = -1;
|
||||
long elink_fapl_id = HDF5Constants.H5I_INVALID_HID;
|
||||
int efc_size = 0;
|
||||
try {
|
||||
H5.H5Pset_elink_fapl(plapl_id, fapl_id );
|
||||
@@ -1398,4 +1397,36 @@ public class TestH5Pfapl {
|
||||
fail("H5P_evict_on_close: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
catch (HDF5PropertyListInterfaceException err) {
|
||||
// parallel is not supported
|
||||
if (err.getMinorErrorNumber() != HDF5Constants.H5E_UNSUPPORTED) {
|
||||
err.printStackTrace();
|
||||
fail("H5P_test_file_locking: " + err);
|
||||
}
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("H5P_test_file_locking: " + err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -34,11 +33,11 @@ import org.junit.rules.TestName;
|
||||
public class TestH5Pfaplhdfs {
|
||||
@Rule public TestName testname = new TestName();
|
||||
|
||||
long fapl_id = -1;
|
||||
long plapl_id = -1;
|
||||
long dapl_id = -1;
|
||||
long plist_id = -1;
|
||||
long btplist_id = -1;
|
||||
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
|
||||
public void createFileAccess() throws NullPointerException, HDF5Exception
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -34,11 +33,11 @@ import org.junit.rules.TestName;
|
||||
public class TestH5Pfapls3 {
|
||||
@Rule public TestName testname = new TestName();
|
||||
|
||||
long fapl_id = -1;
|
||||
long plapl_id = -1;
|
||||
long dapl_id = -1;
|
||||
long plist_id = -1;
|
||||
long btplist_id = -1;
|
||||
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
|
||||
public void createFileAccess() throws NullPointerException, HDF5Exception
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -85,7 +84,7 @@ public class TestH5Plist {
|
||||
PROP3_NAME,
|
||||
PROP4_NAME};
|
||||
|
||||
long plist_class_id = -1;
|
||||
long plist_class_id = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
@Before
|
||||
public void createPropClass()throws NullPointerException, HDF5Exception
|
||||
@@ -114,9 +113,9 @@ public class TestH5Plist {
|
||||
@Test
|
||||
public void testH5P_genprop_basic_class() {
|
||||
int status = -1;
|
||||
long cid1 = -1; // Generic Property class ID
|
||||
long cid2 = -1; // Generic Property class ID
|
||||
long cid3 = -1; // Generic Property class ID
|
||||
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 {
|
||||
@@ -162,7 +161,7 @@ public class TestH5Plist {
|
||||
// Close parent class
|
||||
try {
|
||||
H5.H5Pclose_class(cid2);
|
||||
cid2 = -1;
|
||||
cid2 = HDF5Constants.H5I_INVALID_HID;
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
@@ -172,7 +171,7 @@ public class TestH5Plist {
|
||||
// Close class
|
||||
try {
|
||||
H5.H5Pclose_class(plist_class_id);
|
||||
plist_class_id = -1;
|
||||
plist_class_id = HDF5Constants.H5I_INVALID_HID;
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
@@ -242,7 +241,7 @@ public class TestH5Plist {
|
||||
// Close parent class's parent
|
||||
try {
|
||||
H5.H5Pclose_class(cid3);
|
||||
cid3 = -1;
|
||||
cid3 = HDF5Constants.H5I_INVALID_HID;
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
@@ -252,7 +251,7 @@ public class TestH5Plist {
|
||||
// Close parent class's parent
|
||||
try {
|
||||
H5.H5Pclose_class(cid2);
|
||||
cid2 = -1;
|
||||
cid2 = HDF5Constants.H5I_INVALID_HID;
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
@@ -262,7 +261,7 @@ public class TestH5Plist {
|
||||
// Close parent class's parent
|
||||
try {
|
||||
H5.H5Pclose_class(cid1);
|
||||
cid1 = -1;
|
||||
cid1 = HDF5Constants.H5I_INVALID_HID;
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
@@ -634,7 +633,7 @@ public class TestH5Plist {
|
||||
@Test
|
||||
public void testH5P_genprop_basic_list_prop() {
|
||||
boolean status = false;
|
||||
long lid1 = -1; // Generic Property list ID
|
||||
long lid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
|
||||
long nprops = -1; // Number of properties in class
|
||||
|
||||
try {
|
||||
@@ -760,7 +759,7 @@ public class TestH5Plist {
|
||||
// @Test
|
||||
// public void testH5P_genprop_class_callback() {
|
||||
// class cdata {
|
||||
// public long cls_id = -1;
|
||||
// public long cls_id = HDF5Constants.H5I_INVALID_HID;
|
||||
// public int cls_count = -1;
|
||||
// cdata(long id, int count) {
|
||||
// this.cls_id = id;
|
||||
@@ -813,11 +812,11 @@ public class TestH5Plist {
|
||||
// }
|
||||
// H5P_cls_close_func_cb cls_close_cb = new H5P_cls_close_callback();
|
||||
//
|
||||
// long cid1 = -1; // Generic Property class ID
|
||||
// long cid2 = -1; // Generic Property class ID
|
||||
// long lid1 = -1; // Generic Property list ID
|
||||
// long lid2 = -1; // Generic Property list ID
|
||||
// long lid3 = -1; // Generic Property list ID
|
||||
// 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 {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -52,13 +51,13 @@ public class TestH5Pvirtual {
|
||||
private static final int fill_value = -1;
|
||||
long[] H5dims = { DIM_Y };
|
||||
long[] VDSH5dims = { VDSDIM_X, VDSDIM_Y };
|
||||
long H5fid = -1;
|
||||
long H5dsid = -1;
|
||||
long H5dssid = -1;
|
||||
long H5dvsid = -1;
|
||||
long H5did = -1;
|
||||
long H5dcplid = -1;
|
||||
long H5dapl_id = -1;
|
||||
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);
|
||||
@@ -69,8 +68,8 @@ public class TestH5Pvirtual {
|
||||
}
|
||||
|
||||
private final long _createDataset(long fid, long dsid, String name, long dcpl, long dapl) {
|
||||
long did = -1;
|
||||
long space_id = -1;
|
||||
long did = HDF5Constants.H5I_INVALID_HID;
|
||||
long space_id = HDF5Constants.H5I_INVALID_HID;
|
||||
long[] start = {0, 0};
|
||||
long[] stride = null;
|
||||
long[] count = {1, 1};
|
||||
@@ -100,9 +99,9 @@ public class TestH5Pvirtual {
|
||||
int[] dset_data = new int[DIM_Y];
|
||||
// Create source files and datasets
|
||||
for (int i=0; i < 3; i++) {
|
||||
long space_id = -1;
|
||||
long dset_id = -1;
|
||||
long file_id = -1;
|
||||
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;
|
||||
|
||||
try {
|
||||
@@ -265,7 +264,7 @@ public class TestH5Pvirtual {
|
||||
|
||||
@Test
|
||||
public void testH5Pget_selection_source_dataset() throws Throwable {
|
||||
long src_space = -1;
|
||||
long src_space = HDF5Constants.H5I_INVALID_HID;
|
||||
long src_selection = -1;
|
||||
|
||||
H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -39,11 +38,11 @@ public class TestH5R {
|
||||
private static final String H5_FILE = "testH5R.h5";
|
||||
private static final int DIM_X = 4;
|
||||
private static final int DIM_Y = 6;
|
||||
long H5fid = -1;
|
||||
long H5dsid = -1;
|
||||
long H5did = -1;
|
||||
long H5gid = -1;
|
||||
long H5did2 = -1;
|
||||
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;
|
||||
@@ -62,7 +61,7 @@ public class TestH5R {
|
||||
}
|
||||
|
||||
private final long _createDataset(long fid, long dsid, String name, long dapl) {
|
||||
long did = -1;
|
||||
long did = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
did = H5.H5Dcreate(fid, name,
|
||||
HDF5Constants.H5T_STD_I32BE, dsid,
|
||||
@@ -78,7 +77,7 @@ public class TestH5R {
|
||||
}
|
||||
|
||||
private final long _createGroup(long fid, String name) {
|
||||
long gid = -1;
|
||||
long gid = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
|
||||
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
|
||||
@@ -150,109 +149,6 @@ public class TestH5R {
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
// Test v1.8 APIs params
|
||||
/*
|
||||
* @Ignore public void testH5Rget_name() { long loc_id = H5fid; int ref_type =
|
||||
* HDF5Constants.H5R_OBJECT; long ret_val = -1; byte[] ref = null; String[] name = {""}; String
|
||||
* objName = "/dset";
|
||||
*
|
||||
* try { ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); } catch (Throwable err) {
|
||||
* err.printStackTrace(); fail("H5.H5Rget_name:H5Rcreate " + err); }
|
||||
*
|
||||
* try { ret_val = H5.H5Rget_name(loc_id, ref_type, ref, name, 16); } catch (Throwable err) {
|
||||
* err.printStackTrace(); fail("H5.H5Rget_name: " + err); }
|
||||
*
|
||||
* assertTrue("testH5Rget_name: H5Rget_name", ret_val>0); assertTrue("The name of the object: ",
|
||||
* objName.equals(name[0])); }
|
||||
*
|
||||
* @Ignore public void testH5Rget_obj_type2() { int ref_type=HDF5Constants.H5R_OBJECT; byte[]
|
||||
* ref=null;
|
||||
*
|
||||
* String objName = "/dset"; int obj_type = -1;
|
||||
*
|
||||
* try { ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); } catch(Throwable err) {
|
||||
* err.printStackTrace(); }
|
||||
*
|
||||
* try { obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, ref); } catch (Throwable
|
||||
* err) { err.printStackTrace(); fail("H5.H5Rget_obj_type2: " + err); } assertEquals(obj_type,
|
||||
* HDF5Constants.H5O_TYPE_DATASET); }
|
||||
*
|
||||
* @Ignore public void testH5Rcreate_refobj() { byte[] ref = null;
|
||||
*
|
||||
* try { ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); } catch (Throwable err) {
|
||||
* err.printStackTrace(); fail("H5.H5Rcreate: " + err); } assertNotNull(ref); }
|
||||
*
|
||||
* @Ignore public void testH5Rcreate_regionrefobj() { byte[] ref = null; try { ref =
|
||||
* H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); } catch (Throwable err) {
|
||||
* err.printStackTrace(); fail("H5.H5Rcreate: " + err); } assertNotNull(ref); }
|
||||
*
|
||||
* @Ignore public void testH5Rdereference() { byte[] ref1 = null; byte[] ref2 = null; long
|
||||
* dataset_id = -1; long group_id = -1; try { //Create reference on dataset ref1 =
|
||||
* H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); 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) {} } }
|
||||
*
|
||||
* @Ignore public void testH5Rget_region() { byte[] ref = null; long dsid = -1; try { ref =
|
||||
* H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); 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) {} }
|
||||
* }
|
||||
*
|
||||
* @Ignore//(expected = IllegalArgumentException.class) public void testH5Rget_name_Invalidreftype()
|
||||
* throws Throwable { byte[] ref = null; String[] name = {""}; ref = H5.H5Rcreate(H5fid, "/dset",
|
||||
* HDF5Constants.H5R_OBJECT, -1); H5.H5Rget_name(H5fid, HDF5Constants.H5R_DATASET_REGION, ref, name,
|
||||
* 16); }
|
||||
*
|
||||
* @Ignore//(expected = NullPointerException.class) public void testH5Rget_name_NULLreference()
|
||||
* throws Throwable { byte[] ref = null; String[] name = {""}; H5.H5Rget_name(H5fid,
|
||||
* HDF5Constants.H5R_OBJECT, ref, name, 16); }
|
||||
*
|
||||
* @Ignore//(expected = HDF5LibraryException.class) public void
|
||||
* testH5Rget_obj_type2_Invalidreftype() throws Throwable { byte[] ref = null; ref =
|
||||
* H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); H5.H5Rget_obj_type(H5fid,
|
||||
* HDF5Constants.H5R_DATASET_REGION, ref); }
|
||||
*
|
||||
* @Ignore//(expected = HDF5LibraryException.class) public void testH5Rcreate_InvalidObjectName()
|
||||
* throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/GROUPS", HDF5Constants.H5R_OBJECT, -1); }
|
||||
*
|
||||
* @Ignore//(expected = HDF5LibraryException.class) public void testH5Rcreate_Invalidspace_id()
|
||||
* throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, -1);
|
||||
* }
|
||||
*
|
||||
* @Ignore//(expected = IllegalArgumentException.class) public void testH5Rcreate_Invalidreftype()
|
||||
* throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_BADTYPE, -1); }
|
||||
*
|
||||
* @Ignore//(expected = IllegalArgumentException.class) public void
|
||||
* testH5Rgetregion_Invalidreftype() throws Throwable { byte[] ref = null; ref = H5.H5Rcreate(H5fid,
|
||||
* "/dset", HDF5Constants.H5R_OBJECT, H5dsid); H5.H5Rget_region(H5fid,
|
||||
* HDF5Constants.H5R_DATASET_REGION, ref); }
|
||||
*
|
||||
* @Ignore//(expected = IllegalArgumentException.class) public void
|
||||
* testH5Rgetregion_Badreferencetype() throws Throwable { byte[] ref = null; ref =
|
||||
* H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, H5dsid); H5.H5Rget_region(H5fid,
|
||||
* HDF5Constants.H5R_OBJECT, ref); }
|
||||
*
|
||||
* @Ignore//(expected = NullPointerException.class) public void testH5Rgetregion_Nullreference()
|
||||
* throws Throwable { byte[] ref = null; H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION,
|
||||
* ref); }
|
||||
*
|
||||
* @Ignore//(expected = NullPointerException.class) public void testH5Rdereference_Nullreference()
|
||||
* throws Throwable { byte[] ref = null; H5.H5Rdereference(H5did2, HDF5Constants.H5P_DEFAULT,
|
||||
* HDF5Constants.H5R_OBJECT, ref); }
|
||||
*
|
||||
* @Ignore//(expected = IllegalArgumentException.class) public void
|
||||
* testH5Rdereference_Invalidreference() throws Throwable { byte[] ref1 = null; byte[] ref2 = null;
|
||||
* ref1 = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); ref2 =
|
||||
* H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); H5.H5Rdereference(H5gid,
|
||||
* HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref1); }
|
||||
*/
|
||||
// Test v1.12 APIs params
|
||||
|
||||
@Test
|
||||
|
||||
561
java/test/TestH5Rref.java
Normal file
561
java/test/TestH5Rref.java
Normal file
@@ -0,0 +1,561 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the COPYING file, which can be found at the root of the source code *
|
||||
* distribution tree, or in https://www.hdfgroup.org/licenses. *
|
||||
* If you do not have access to either file, you may request a copy from *
|
||||
* help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
package test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
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.HDF5Exception;
|
||||
import hdf.hdf5lib.exceptions.HDF5LibraryException;
|
||||
import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestName;
|
||||
|
||||
public class TestH5Rref {
|
||||
@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;
|
||||
|
||||
private boolean byteArrayCheck(final byte[] array) {
|
||||
for (byte b : array) {
|
||||
if (b != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@After
|
||||
public void closeH5file() throws HDF5LibraryException {
|
||||
if (H5did >= 0)
|
||||
try {H5.H5Dclose(H5did);} catch (Exception ex) {}
|
||||
if (H5dsid > 0)
|
||||
try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
|
||||
if (H5fid > 0)
|
||||
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
|
||||
H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5dsid = HDF5Constants.H5I_INVALID_HID;
|
||||
H5did = HDF5Constants.H5I_INVALID_HID;
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void verifyCount()
|
||||
throws NullPointerException, HDF5Exception {
|
||||
assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0);
|
||||
System.out.print(testname.getMethodName());
|
||||
}
|
||||
|
||||
// Test 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;
|
||||
byte[][] refbuf = null;
|
||||
String name = "";
|
||||
String objName = "/DS_NA";
|
||||
|
||||
try {
|
||||
openH5file(H5_DREG_FILE, objName);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Rget_object: openH5file: " + err);
|
||||
}
|
||||
try {
|
||||
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);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Rget_object: " + err);
|
||||
}
|
||||
finally {
|
||||
try {H5.H5Tclose(f_type);} catch (Exception ex) {}
|
||||
}
|
||||
try {
|
||||
ndims = H5.H5Sget_simple_extent_ndims(H5dsid);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Rget_object: 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_object: H5Dread: " + err);
|
||||
}
|
||||
|
||||
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);
|
||||
if (!byteArrayCheck(refbuf[i])) {
|
||||
try {
|
||||
obj_type = H5.H5Rget_obj_type3(refbuf[i], HDF5Constants.H5P_DEFAULT);
|
||||
assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET);
|
||||
}
|
||||
catch (Throwable err2) {
|
||||
err2.printStackTrace();
|
||||
fail("testH5Rget_object: H5.H5Rget_obj_type3: " + err2);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Rget_object: H5Rget_type: " + err);
|
||||
}
|
||||
finally {
|
||||
H5.H5Rdestroy(refbuf[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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;
|
||||
byte[][] refbuf = null;
|
||||
String objName = "/Dataset1";
|
||||
|
||||
try {
|
||||
openH5file(H5_DREG_FILE, objName);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Rget_obj_type3: openH5file: " + err);
|
||||
}
|
||||
try {
|
||||
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);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Rget_obj_type3: " + err);
|
||||
}
|
||||
finally {
|
||||
try {H5.H5Tclose(f_type);} catch (Exception ex) {}
|
||||
}
|
||||
try {
|
||||
ndims = H5.H5Sget_simple_extent_ndims(H5dsid);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Rget_obj_type3: 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 {
|
||||
ret_val = H5.H5Rget_type(refbuf[i]);
|
||||
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);
|
||||
assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET);
|
||||
}
|
||||
catch (Throwable err2) {
|
||||
err2.printStackTrace();
|
||||
fail("testH5Rget_obj_type3: H5.H5Rget_obj_type3: " + err2);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("testH5Rget_obj_type3: H5Rget_type: " + err);
|
||||
}
|
||||
finally {
|
||||
H5.H5Rdestroy(refbuf[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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 = H5.H5Sget_simple_extent_ndims(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 {
|
||||
ret_val = H5.H5Rget_type(refbuf[i]);
|
||||
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);
|
||||
boolean regionzero = byteArrayCheck(refbuf[i]);
|
||||
if (i > 1)
|
||||
assertTrue(regionzero);
|
||||
else {
|
||||
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();
|
||||
fail("testH5Rget_region_dataset: H5Sget_select_type: " + err2);
|
||||
}
|
||||
}
|
||||
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";
|
||||
|
||||
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 = H5.H5Sget_simple_extent_ndims(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);
|
||||
}
|
||||
|
||||
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();
|
||||
fail("testH5Rget_region_attribute: " + err0);
|
||||
}
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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) {}
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -30,7 +29,7 @@ import org.junit.rules.TestName;
|
||||
|
||||
public class TestH5S {
|
||||
@Rule public TestName testname = new TestName();
|
||||
long H5sid = -1;
|
||||
long H5sid = HDF5Constants.H5I_INVALID_HID;
|
||||
int H5rank = 2;
|
||||
long H5dims[] = {5, 5};
|
||||
long H5maxdims[] = {10, 10};
|
||||
@@ -181,7 +180,7 @@ public class TestH5S {
|
||||
|
||||
@Test
|
||||
public void testH5Scopy() {
|
||||
long sid = -1;
|
||||
long sid = HDF5Constants.H5I_INVALID_HID;
|
||||
int read_rank = -1;
|
||||
|
||||
try {
|
||||
@@ -201,7 +200,7 @@ public class TestH5S {
|
||||
|
||||
@Test
|
||||
public void testH5Sextent_copy() {
|
||||
long sid = -1;
|
||||
long sid = HDF5Constants.H5I_INVALID_HID;
|
||||
int class_type = -1;
|
||||
|
||||
try {
|
||||
@@ -222,7 +221,7 @@ public class TestH5S {
|
||||
|
||||
@Test
|
||||
public void testH5Sextent_equal() {
|
||||
long sid = -1;
|
||||
long sid = HDF5Constants.H5I_INVALID_HID;
|
||||
boolean result = false;
|
||||
|
||||
try {
|
||||
@@ -252,8 +251,8 @@ public class TestH5S {
|
||||
|
||||
@Test
|
||||
public void testH5Sencode_decode_null_dataspace() {
|
||||
long sid = -1;
|
||||
long decoded_sid = -1;
|
||||
long sid = HDF5Constants.H5I_INVALID_HID;
|
||||
long decoded_sid = HDF5Constants.H5I_INVALID_HID;
|
||||
byte[] null_sbuf = null;
|
||||
boolean result = false;
|
||||
|
||||
@@ -299,8 +298,8 @@ public class TestH5S {
|
||||
|
||||
@Test
|
||||
public void testH5Sencode_decode_scalar_dataspace() {
|
||||
long sid = -1;
|
||||
long decoded_sid = -1;
|
||||
long sid = HDF5Constants.H5I_INVALID_HID;
|
||||
long decoded_sid = HDF5Constants.H5I_INVALID_HID;
|
||||
byte[] scalar_sbuf = null;
|
||||
boolean result = false;
|
||||
int iresult = -1;
|
||||
@@ -470,7 +469,7 @@ public class TestH5S {
|
||||
|
||||
@Test
|
||||
public void testH5Sget_select_hyper() {
|
||||
long space1 = -1;
|
||||
long space1 = HDF5Constants.H5I_INVALID_HID;
|
||||
long start[] = {0,0};
|
||||
long stride[] = {1,1};
|
||||
long count[] = {1,1};
|
||||
@@ -508,7 +507,7 @@ public class TestH5S {
|
||||
|
||||
@Test
|
||||
public void testH5Sget_select_valid() {
|
||||
long space1 = -1;
|
||||
long space1 = HDF5Constants.H5I_INVALID_HID;
|
||||
long start[] = {1,0};
|
||||
long stride[] = {1,1};
|
||||
long count[] = {2,3};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -56,7 +55,7 @@ public class TestH5Sbasic {
|
||||
|
||||
@Test
|
||||
public void testH5Screate_scalar() {
|
||||
long sid = -1;
|
||||
long sid = HDF5Constants.H5I_INVALID_HID;
|
||||
int class_type = -1;
|
||||
try {
|
||||
sid = H5.H5Screate(HDF5Constants.H5S_SCALAR);
|
||||
@@ -75,7 +74,7 @@ public class TestH5Sbasic {
|
||||
|
||||
@Test
|
||||
public void testH5Screate_null() {
|
||||
long sid = -1;
|
||||
long sid = HDF5Constants.H5I_INVALID_HID;
|
||||
int class_type = -1;
|
||||
try {
|
||||
sid = H5.H5Screate(HDF5Constants.H5S_NULL);
|
||||
@@ -125,7 +124,7 @@ public class TestH5Sbasic {
|
||||
|
||||
@Test
|
||||
public void testH5Screate_simple() {
|
||||
long sid = -1;
|
||||
long sid = HDF5Constants.H5I_INVALID_HID;
|
||||
int class_type = -1;
|
||||
int rank = 2;
|
||||
long dims[] = {5, 5};
|
||||
@@ -148,7 +147,7 @@ public class TestH5Sbasic {
|
||||
|
||||
@Test
|
||||
public void testH5Screate_simple_unlimted() {
|
||||
long sid = -1;
|
||||
long sid = HDF5Constants.H5I_INVALID_HID;
|
||||
int class_type = -1;
|
||||
int rank = 2;
|
||||
long dims[] = {5, 5};
|
||||
@@ -171,7 +170,7 @@ public class TestH5Sbasic {
|
||||
|
||||
@Test
|
||||
public void testH5Screate_simple_unlimted_1d() {
|
||||
long sid = -1;
|
||||
long sid = HDF5Constants.H5I_INVALID_HID;
|
||||
int class_type = -1;
|
||||
int rank = 1;
|
||||
long dims[] = {5};
|
||||
@@ -194,7 +193,7 @@ public class TestH5Sbasic {
|
||||
|
||||
@Test
|
||||
public void testH5Screate_simple_max_default() {
|
||||
long sid = -1;
|
||||
long sid = HDF5Constants.H5I_INVALID_HID;
|
||||
int rank = 2;
|
||||
long dims[] = {5, 5};
|
||||
|
||||
@@ -213,7 +212,7 @@ public class TestH5Sbasic {
|
||||
|
||||
@Test
|
||||
public void testH5Screate_simple_extent() {
|
||||
long sid = -1;
|
||||
long sid = HDF5Constants.H5I_INVALID_HID;
|
||||
int rank = 2;
|
||||
long dims[] = {5, 5};
|
||||
long maxdims[] = {10, 10};
|
||||
@@ -242,4 +241,142 @@ public class TestH5Sbasic {
|
||||
H5.H5Sdecode(null);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
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];
|
||||
|
||||
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 {
|
||||
H5.H5Sselect_copy(-1, -1);
|
||||
}
|
||||
|
||||
@Test(expected = hdf.hdf5lib.exceptions.HDF5DataspaceInterfaceException.class)
|
||||
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}};
|
||||
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}};
|
||||
|
||||
try {
|
||||
sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE);
|
||||
assertTrue("H5.H5Screate_simple_extent",sid > 0);
|
||||
H5.H5Sselect_adjust(sid, offset);
|
||||
}
|
||||
finally {
|
||||
try {H5.H5Sclose(sid);} catch (Exception ex) {}
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testH5Sselect_intersect_block_invalid() throws Throwable {
|
||||
long start[] = 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;
|
||||
long start[] = new long[2];
|
||||
long end[] = null;
|
||||
|
||||
try {
|
||||
sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE);
|
||||
assertTrue("H5.H5Screate_simple_extent",sid > 0);
|
||||
H5.H5Sselect_intersect_block(sid, start, end);
|
||||
}
|
||||
finally {
|
||||
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;
|
||||
long start[] = null;
|
||||
long end[] = new long[2];
|
||||
|
||||
try {
|
||||
sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE);
|
||||
assertTrue("H5.H5Screate_simple_extent",sid > 0);
|
||||
H5.H5Sselect_intersect_block(sid, start, end);
|
||||
}
|
||||
finally {
|
||||
try {H5.H5Sclose(sid);} catch (Exception ex) {}
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = hdf.hdf5lib.exceptions.HDF5DataspaceInterfaceException.class)
|
||||
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 {
|
||||
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;
|
||||
long stride[] = null;
|
||||
long count[] = new long[2];
|
||||
long block[] = null;
|
||||
|
||||
try {
|
||||
sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE);
|
||||
assertTrue("H5.H5Screate_simple_extent",sid > 0);
|
||||
H5.H5Scombine_hyperslab(sid, 0, start, stride, count, block);
|
||||
}
|
||||
finally {
|
||||
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];
|
||||
long stride[] = null;
|
||||
long count[] = null;
|
||||
long block[] = null;
|
||||
|
||||
try {
|
||||
sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE);
|
||||
assertTrue("H5.H5Screate_simple_extent",sid > 0);
|
||||
H5.H5Scombine_hyperslab(sid, 0, start, stride, count, block);
|
||||
}
|
||||
finally {
|
||||
try {H5.H5Sclose(sid);} catch (Exception ex) {}
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = hdf.hdf5lib.exceptions.HDF5FunctionArgumentException.class)
|
||||
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 {
|
||||
H5.H5Scombine_select(-1, 0, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -33,8 +32,8 @@ import org.junit.rules.TestName;
|
||||
public class TestH5T {
|
||||
@Rule public TestName testname = new TestName();
|
||||
private static final String H5_FILE = "testT.h5";
|
||||
long H5fid = -1;
|
||||
long H5strdid = -1;
|
||||
long H5fid = HDF5Constants.H5I_INVALID_HID;
|
||||
long H5strdid = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
private final void _deleteFile(String filename) {
|
||||
File file = null;
|
||||
@@ -129,7 +128,7 @@ public class TestH5T {
|
||||
|
||||
@Test
|
||||
public void testH5Tarray_create() {
|
||||
long filetype_id = -1;
|
||||
long filetype_id = HDF5Constants.H5I_INVALID_HID;
|
||||
long[] adims = { 3, 5 };
|
||||
|
||||
try {
|
||||
@@ -148,7 +147,7 @@ public class TestH5T {
|
||||
|
||||
@Test
|
||||
public void testH5Tget_array_ndims() {
|
||||
long filetype_id = -1;
|
||||
long filetype_id = HDF5Constants.H5I_INVALID_HID;
|
||||
int ndims = 0;
|
||||
long[] adims = { 3, 5 };
|
||||
|
||||
@@ -176,7 +175,7 @@ public class TestH5T {
|
||||
|
||||
@Test
|
||||
public void testH5Tget_array_dims() {
|
||||
long filetype_id = -1;
|
||||
long filetype_id = HDF5Constants.H5I_INVALID_HID;
|
||||
int ndims = 0;
|
||||
long[] adims = { 3, 5 };
|
||||
long[] rdims = new long[2];
|
||||
@@ -207,7 +206,7 @@ public class TestH5T {
|
||||
|
||||
@Test
|
||||
public void testH5Tenum_functions() {
|
||||
long filetype_id =-1;
|
||||
long filetype_id = HDF5Constants.H5I_INVALID_HID;
|
||||
String enum_type ="Enum_type";
|
||||
byte[] enum_val = new byte[1];
|
||||
String enum_name = null;
|
||||
@@ -275,7 +274,7 @@ public class TestH5T {
|
||||
|
||||
@Test
|
||||
public void testH5Tenum_create_functions() {
|
||||
long filetype_id = -1;
|
||||
long filetype_id = HDF5Constants.H5I_INVALID_HID;
|
||||
byte[] enum_val = new byte[1];
|
||||
|
||||
// Create a enumerate datatype
|
||||
@@ -315,7 +314,7 @@ public class TestH5T {
|
||||
|
||||
@Test
|
||||
public void testH5Topaque_functions() {
|
||||
long filetype_id = -1;
|
||||
long filetype_id = HDF5Constants.H5I_INVALID_HID;
|
||||
String opaque_name = null;
|
||||
|
||||
// Create a opaque datatype
|
||||
@@ -345,7 +344,7 @@ public class TestH5T {
|
||||
|
||||
@Test
|
||||
public void testH5Tvlen_create() {
|
||||
long filetype_id = -1;
|
||||
long filetype_id = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
filetype_id = H5.H5Tvlen_create(HDF5Constants.H5T_C_S1);
|
||||
@@ -368,7 +367,7 @@ public class TestH5T {
|
||||
|
||||
@Test
|
||||
public void testH5Tis_variable_str() {
|
||||
long filetype_id = -1;
|
||||
long filetype_id = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
try {
|
||||
filetype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
|
||||
@@ -399,7 +398,7 @@ public class TestH5T {
|
||||
|
||||
@Test
|
||||
public void testH5Tcompound_functions() {
|
||||
long filetype_id =-1;
|
||||
long filetype_id = HDF5Constants.H5I_INVALID_HID;
|
||||
|
||||
// Create a compound datatype
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -40,7 +39,7 @@ public class TestH5Tbasic {
|
||||
|
||||
@Test
|
||||
public void testH5Tcopy() {
|
||||
long H5strdid = -1;
|
||||
long H5strdid = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
|
||||
assertTrue("H5.H5Tcopy",H5strdid > 0);
|
||||
@@ -57,7 +56,7 @@ public class TestH5Tbasic {
|
||||
|
||||
@Test
|
||||
public void testH5Tequal() {
|
||||
long H5strdid = -1;
|
||||
long H5strdid = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
|
||||
assertTrue("H5.H5Tcopy",H5strdid > 0);
|
||||
@@ -76,7 +75,7 @@ public class TestH5Tbasic {
|
||||
|
||||
@Test
|
||||
public void testH5Tequal_not() {
|
||||
long H5strdid = -1;
|
||||
long H5strdid = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_STD_U64LE);
|
||||
assertTrue("H5.H5Tcopy",H5strdid > 0);
|
||||
@@ -98,8 +97,8 @@ public class TestH5Tbasic {
|
||||
String[] strs = {"a1234","b1234"};
|
||||
int srcLen = 5;
|
||||
int dstLen = 10;
|
||||
long srcId = -1;
|
||||
long dstId = -1;
|
||||
long srcId = HDF5Constants.H5I_INVALID_HID;
|
||||
long dstId = HDF5Constants.H5I_INVALID_HID;
|
||||
int dimSize = strs.length;
|
||||
byte[] buf = new byte[dimSize*dstLen];
|
||||
|
||||
@@ -131,7 +130,7 @@ public class TestH5Tbasic {
|
||||
|
||||
@Test
|
||||
public void testH5Torder_size() {
|
||||
long H5strdid = -1;
|
||||
long H5strdid = HDF5Constants.H5I_INVALID_HID;
|
||||
try {
|
||||
// Fixed length string
|
||||
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
@@ -72,28 +71,28 @@ public class TestH5VL {
|
||||
|
||||
@Test
|
||||
public void testH5VLget_connector_id() {
|
||||
String H5_FILE = "testFvl.h5";
|
||||
String H5_FILE = "testFvl.h5";
|
||||
|
||||
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);
|
||||
assertTrue("H5.H5VLget_connector_id", native_id >= 0);
|
||||
try {
|
||||
long native_id = H5.H5VLget_connector_id(H5fid);
|
||||
assertTrue("H5.H5VLget_connector_id", native_id >= 0);
|
||||
|
||||
/*
|
||||
* If HDF5_VOL_CONNECTOR is set, this might not be the
|
||||
* native connector. Only check for the native connector
|
||||
* if this isn't set.
|
||||
*/
|
||||
String connector = System.getenv("HDF5_VOL_CONNECTOR");
|
||||
if (connector == null)
|
||||
assertEquals(HDF5Constants.H5VL_NATIVE, native_id);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("H5.H5VLget_connector_id " + err);
|
||||
}
|
||||
/*
|
||||
* If HDF5_VOL_CONNECTOR is set, this might not be the
|
||||
* native connector. Only check for the native connector
|
||||
* if this isn't set.
|
||||
*/
|
||||
String connector = System.getenv("HDF5_VOL_CONNECTOR");
|
||||
if (connector == null)
|
||||
assertEquals(HDF5Constants.H5VL_NATIVE, native_id);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("H5.H5VLget_connector_id " + err);
|
||||
}
|
||||
finally {
|
||||
if (H5fid > 0) {
|
||||
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
|
||||
@@ -139,14 +138,14 @@ public class TestH5VL {
|
||||
try {
|
||||
String native_name = H5.H5VLget_connector_name(H5fid);
|
||||
|
||||
/*
|
||||
* If HDF5_VOL_CONNECTOR is set, this might not be the
|
||||
* native connector. Only check for the native connector
|
||||
* if this isn't set.
|
||||
*/
|
||||
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);
|
||||
/*
|
||||
* If HDF5_VOL_CONNECTOR is set, this might not be the
|
||||
* native connector. Only check for the native connector
|
||||
* if this isn't set.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
|
||||
@@ -45,6 +45,8 @@ HDFLIB_HOME="$top_srcdir/java/lib"
|
||||
BLDDIR="."
|
||||
BLDLIBDIR="$BLDDIR/testlibs"
|
||||
HDFTEST_HOME="$top_srcdir/java/test"
|
||||
TOOLS_TESTFILES="$top_srcdir/tools/testfiles"
|
||||
|
||||
JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar
|
||||
TESTJARFILE=jar@PACKAGE_TARNAME@test.jar
|
||||
test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR
|
||||
@@ -88,10 +90,12 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5T.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5Dparams.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5D.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5Dplist.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5Drw.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5Lparams.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5Lbasic.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5Lcreate.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5R.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5Rref.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5P.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5PData.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5Pfapl.txt
|
||||
@@ -100,6 +104,7 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5Pfaplhdfs.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5Pvirtual.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5Plist.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5A.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5Arw.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5Oparams.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5Obasic.txt
|
||||
$HDFTEST_HOME/testfiles/JUnit-TestH5Ocreate.txt
|
||||
@@ -145,7 +150,7 @@ COPY_LIBFILES_TO_BLDLIBDIR()
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ "$IS_DARWIN" = "yes" ]; then
|
||||
if [ "$IS_DARWIN" = "yes" ]; then
|
||||
(cd testlibs; \
|
||||
install_name_tool -add_rpath @loader_path libhdf5_java.dylib; \
|
||||
exist_path=` otool -l libhdf5_java.dylib | grep libhdf5 | grep -v java | awk '{print $2}'`; \
|
||||
@@ -247,6 +252,12 @@ COPY_DATAFILES_TO_BLDDIR()
|
||||
$CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateL2.hdf
|
||||
$CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateO1.hdf
|
||||
$CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateO2.hdf
|
||||
$CP -f $TOOLS_TESTFILES/trefer_reg.h5 $BLDDIR/trefer_reg.h5
|
||||
$CP -f $TOOLS_TESTFILES/trefer_attr.h5 $BLDDIR/trefer_attr.h5
|
||||
$CP -f $TOOLS_TESTFILES/tdatareg.h5 $BLDDIR/tdatareg.h5
|
||||
$CP -f $TOOLS_TESTFILES/tattrreg.h5 $BLDDIR/tattrreg.h5
|
||||
$CP -f $TOOLS_TESTFILES/tintsattrs.h5 $BLDDIR/tintsattrs.h5
|
||||
$CP -f $TOOLS_TESTFILES/tfloatsattrs.h5 $BLDDIR/tfloatsattrs.h5
|
||||
}
|
||||
|
||||
CLEAN_DATAFILES_AND_BLDDIR()
|
||||
@@ -662,6 +673,27 @@ else
|
||||
test yes = "$verbose" && $DIFF JUnit-TestH5D.txt JUnit-TestH5D.out |sed 's/^/ /'
|
||||
fi
|
||||
|
||||
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Drw"
|
||||
TESTING JUnit-TestH5Drw
|
||||
($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Drw > JUnit-TestH5Drw.ext)
|
||||
|
||||
# Extract file name, line number, version and thread IDs because they may be different
|
||||
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
|
||||
-e 's/line [0-9]*/line (number)/' \
|
||||
-e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
|
||||
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
|
||||
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
|
||||
JUnit-TestH5Drw.ext > JUnit-TestH5Drw.out
|
||||
|
||||
if diff JUnit-TestH5Drw.out JUnit-TestH5Drw.txt > /dev/null; then
|
||||
echo " PASSED JUnit-TestH5Drw"
|
||||
else
|
||||
echo "**FAILED** JUnit-TestH5Drw"
|
||||
echo " Expected result differs from actual result"
|
||||
nerrors="`expr $nerrors + 1`"
|
||||
test yes = "$verbose" && $DIFF JUnit-TestH5Drw.txt JUnit-TestH5Drw.out |sed 's/^/ /'
|
||||
fi
|
||||
|
||||
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dplist"
|
||||
TESTING JUnit-TestH5Dplist
|
||||
($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dplist > JUnit-TestH5Dplist.ext)
|
||||
@@ -767,6 +799,27 @@ else
|
||||
test yes = "$verbose" && $DIFF JUnit-TestH5R.txt JUnit-TestH5R.out |sed 's/^/ /'
|
||||
fi
|
||||
|
||||
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Rref"
|
||||
TESTING JUnit-TestH5Rref
|
||||
($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Rref > JUnit-TestH5Rref.ext)
|
||||
|
||||
# Extract file name, line number, version and thread IDs because they may be different
|
||||
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
|
||||
-e 's/line [0-9]*/line (number)/' \
|
||||
-e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
|
||||
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
|
||||
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
|
||||
JUnit-TestH5Rref.ext > JUnit-TestH5Rref.out
|
||||
|
||||
if diff JUnit-TestH5Rref.out JUnit-TestH5Rref.txt > /dev/null; then
|
||||
echo " PASSED JUnit-TestH5Rref"
|
||||
else
|
||||
echo "**FAILED** JUnit-TestH5Rref"
|
||||
echo " Expected result differs from actual result"
|
||||
nerrors="`expr $nerrors + 1`"
|
||||
test yes = "$verbose" && $DIFF JUnit-TestH5Rref.txt JUnit-TestH5Rref.out |sed 's/^/ /'
|
||||
fi
|
||||
|
||||
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P"
|
||||
TESTING JUnit-TestH5P
|
||||
($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P > JUnit-TestH5P.ext)
|
||||
@@ -893,6 +946,27 @@ else
|
||||
test yes = "$verbose" && $DIFF JUnit-TestH5A.txt JUnit-TestH5A.out |sed 's/^/ /'
|
||||
fi
|
||||
|
||||
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Arw"
|
||||
TESTING JUnit-TestH5Arw
|
||||
($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Arw > JUnit-TestH5Arw.ext)
|
||||
|
||||
# Extract file name, line number, version and thread IDs because they may be different
|
||||
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
|
||||
-e 's/line [0-9]*/line (number)/' \
|
||||
-e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
|
||||
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
|
||||
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
|
||||
JUnit-TestH5Arw.ext > JUnit-TestH5Arw.out
|
||||
|
||||
if diff JUnit-TestH5Arw.out JUnit-TestH5Arw.txt > /dev/null; then
|
||||
echo " PASSED JUnit-TestH5Arw"
|
||||
else
|
||||
echo "**FAILED** JUnit-TestH5Arw"
|
||||
echo " Expected result differs from actual result"
|
||||
nerrors="`expr $nerrors + 1`"
|
||||
test yes = "$verbose" && $DIFF JUnit-TestH5Arw.txt JUnit-TestH5Arw.out |sed 's/^/ /'
|
||||
fi
|
||||
|
||||
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Oparams"
|
||||
TESTING JUnit-TestH5Oparams
|
||||
($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Oparams > JUnit-TestH5Oparams.ext)
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
JUnit version 4.11
|
||||
.testH5export_region
|
||||
.testH5get_libversion_null_param
|
||||
.testJ2C
|
||||
.testH5export_dataset
|
||||
.testIsSerializable
|
||||
.testH5export_attrdataset
|
||||
.testH5garbage_collect
|
||||
.testH5error_off
|
||||
.testH5export_regdataset
|
||||
.testH5export_attribute
|
||||
.serializeToDisk
|
||||
.testH5open
|
||||
.testH5check_version
|
||||
@@ -13,5 +17,5 @@ JUnit version 4.11
|
||||
|
||||
Time: XXXX
|
||||
|
||||
OK (11 tests)
|
||||
OK (15 tests)
|
||||
|
||||
|
||||
13
java/test/testfiles/JUnit-TestH5Arw.txt
Normal file
13
java/test/testfiles/JUnit-TestH5Arw.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
JUnit version 4.11
|
||||
.testH5Aread_128bit_floats
|
||||
.testH5Aread_64bit_floats
|
||||
.testH5Aread_8bit_ints
|
||||
.testH5Aread_32bit_ints
|
||||
.testH5Aread_64bit_ints
|
||||
.testH5Aread_32bit_floats
|
||||
.testH5Aread_16bit_ints
|
||||
|
||||
Time: XXXX
|
||||
|
||||
OK (7 tests)
|
||||
|
||||
13
java/test/testfiles/JUnit-TestH5Drw.txt
Normal file
13
java/test/testfiles/JUnit-TestH5Drw.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
JUnit version 4.11
|
||||
.testH5Dread_32bit_floats
|
||||
.testH5Dread_32bit_ints
|
||||
.testH5Dread_64bit_ints
|
||||
.testH5Dread_64bit_floats
|
||||
.testH5Dread_8bit_ints
|
||||
.testH5Dread_128bit_floats
|
||||
.testH5Dread_16bit_ints
|
||||
|
||||
Time: XXXX
|
||||
|
||||
OK (7 tests)
|
||||
|
||||
@@ -28,6 +28,7 @@ JUnit version 4.11
|
||||
.testH5Pset_elink_fapl
|
||||
.testH5P_hyper_vector_size
|
||||
.testH5P_gc_references
|
||||
.testH5P_file_locking
|
||||
.testH5P_family_offset
|
||||
.testH5P_fapl_core
|
||||
.testH5P_fapl_muti
|
||||
@@ -37,5 +38,5 @@ JUnit version 4.11
|
||||
|
||||
Time: XXXX
|
||||
|
||||
OK (35 tests)
|
||||
OK (36 tests)
|
||||
|
||||
|
||||
10
java/test/testfiles/JUnit-TestH5Rref.txt
Normal file
10
java/test/testfiles/JUnit-TestH5Rref.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
JUnit version 4.11
|
||||
.testH5Rget_region_dataset
|
||||
.testH5Rget_object
|
||||
.testH5Rget_region_attribute
|
||||
.testH5Rget_obj_type3
|
||||
|
||||
Time: XXXX
|
||||
|
||||
OK (4 tests)
|
||||
|
||||
@@ -5,18 +5,32 @@ JUnit version 4.11
|
||||
.testH5Sdecode_null
|
||||
.testH5Screate_simple_dims_exceed
|
||||
.testH5Screate_simple_unlimted_1d
|
||||
.testH5Sselect_intersect_block_rank_start
|
||||
.testH5Sget_regular_hyperslab_invalid
|
||||
.testH5Sselect_adjust_rank_offset
|
||||
.testH5Screate_simple_dims_invalid
|
||||
.testH5Screate_scalar
|
||||
.testH5Screate_simple
|
||||
.testH5Sselect_project_intersection_invalid
|
||||
.testH5Screate_simple_rank_invalid
|
||||
.testH5Sget_simple_extent_type_invalid
|
||||
.testH5Scombine_hyperslab_invalid
|
||||
.testH5Scombine_hyperslab_null_count
|
||||
.testH5Scombine_hyperslab_null_start
|
||||
.testH5Sencode_invalid
|
||||
.testH5Screate_null
|
||||
.testH5Screate_simple_extent
|
||||
.testH5Screate_invalid
|
||||
.testH5Sselect_intersect_block_invalid
|
||||
.testH5Sselect_adjust_invalid
|
||||
.testH5Screate_simple_unlimted
|
||||
.testH5Sselect_shape_same_invalid
|
||||
.testH5Smodify_select_invalid
|
||||
.testH5Scombine_select_invalid
|
||||
.testH5Sselect_copy_invalid
|
||||
.testH5Sselect_intersect_block_rank_end
|
||||
|
||||
Time: XXXX
|
||||
|
||||
OK (16 tests)
|
||||
OK (30 tests)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user