From d7e1464058515d07b838741f65a77977224814de Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 13 Apr 2019 22:58:16 -0500 Subject: Add C++, Java, and FORTRAN wrappers and tests for H5Fget_fileno --- c++/src/C2Cppfunction_map.htm | 36 ++++++++++ c++/src/H5File.cpp | 21 ++++++ c++/src/H5File.h | 3 + c++/test/tfile.cpp | 59 +++++++++++++++ fortran/src/H5Ff.c | 34 +++++++++ fortran/src/H5Fff.F90 | 38 ++++++++++ fortran/src/H5f90proto.h | 1 + fortran/test/tH5F.F90 | 29 ++++++++ java/src/hdf/hdf5lib/H5.java | 13 ++++ java/src/jni/h5fImp.c | 20 ++++++ java/src/jni/h5fImp.h | 9 +++ java/test/TestH5F.java | 130 ++++++++++++++++++++++++++++++++++ java/test/testfiles/JUnit-TestH5F.txt | 4 +- 13 files changed, 396 insertions(+), 1 deletion(-) diff --git a/c++/src/C2Cppfunction_map.htm b/c++/src/C2Cppfunction_map.htm index b53ea15..2d779a3 100644 --- a/c++/src/C2Cppfunction_map.htm +++ b/c++/src/C2Cppfunction_map.htm @@ -7666,6 +7666,42 @@ normal'> 

+ + +

H5Fget_fileno

+ + +

unsigned long H5File::getFileNum()

+ + +

 

+ + +

 

+ + +

 

+ + 0) { + try {H5.H5Fclose(H5fid2);} catch (Exception ex) {} + H5fid2 = -1; + } _deleteFile(H5_FILE); + _deleteFile(H5_FILE2); System.out.println(); } @@ -223,6 +235,124 @@ public class TestH5F { } @Test + public void testH5Fget_fileno_same() { + long fileno1 = 0; + long fileno2 = 0; + long fid1 = -1; + long fid2 = -1; + + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = -1; + } + + try { + fid1 = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + fid2 = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + fileno1 = H5.H5Fget_fileno(fid1); + } + catch (Throwable err) { + fail("H5.H5Fget_fileno: " + err); + } + + try { + fileno2 = H5.H5Fget_fileno(fid2); + } + catch (Throwable err) { + fail("H5.H5Fget_fileno: " + err); + } + + assertEquals(fileno1, fileno2); + + try { + H5.H5Fclose(fid1); + } + catch (Exception ex) { + } + + try { + H5.H5Fclose(fid2); + } + catch (Exception ex) { + } + } + + @Test + public void testH5Fget_fileno_diff() { + long fileno1 = 0; + long fileno2 = 0; + long fid1 = -1; + long fid2 = -1; + + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = -1; + } + if (H5fid2 > 0) { + try {H5.H5Fclose(H5fid2);} catch (Exception ex) {} + H5fid2 = -1; + } + + try { + fid1 = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + fid2 = H5.H5Fopen(H5_FILE2, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + fileno1 = H5.H5Fget_fileno(fid1); + } + catch (Throwable err) { + fail("H5.H5Fget_fileno: " + err); + } + + try { + fileno2 = H5.H5Fget_fileno(fid2); + } + catch (Throwable err) { + fail("H5.H5Fget_fileno: " + err); + } + + assertNotEquals(fileno1, fileno2); + + try { + H5.H5Fclose(fid1); + } + catch (Exception ex) { + } + + try { + H5.H5Fclose(fid2); + } + catch (Exception ex) { + } + } + + @Test public void testH5Fget_obj_count() { long count = -1; diff --git a/java/test/testfiles/JUnit-TestH5F.txt b/java/test/testfiles/JUnit-TestH5F.txt index 16a423e..791e82d 100644 --- a/java/test/testfiles/JUnit-TestH5F.txt +++ b/java/test/testfiles/JUnit-TestH5F.txt @@ -7,8 +7,10 @@ JUnit version 4.11 .testH5Fget_intent_rdonly .testH5Fget_create_plist .testH5Fget_obj_count +.testH5Fget_fileno_same +.testH5Fget_fileno_diff Time: XXXX -OK (8 tests) +OK (10 tests) -- cgit v0.12