summaryrefslogtreecommitdiffstats
path: root/java/test/TestH5Giterate.java
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2022-04-22 15:24:27 (GMT)
committerGitHub <noreply@github.com>2022-04-22 15:24:27 (GMT)
commit974aefb8416d78b0687a54e5f72f21d0ca72ae2d (patch)
tree0fe4e4327b95c38f362ceace220d59cb08aa88a3 /java/test/TestH5Giterate.java
parentf5042fd4d3549e9e3453ab99d81bb46f1688b240 (diff)
downloadhdf5-974aefb8416d78b0687a54e5f72f21d0ca72ae2d.zip
hdf5-974aefb8416d78b0687a54e5f72f21d0ca72ae2d.tar.gz
hdf5-974aefb8416d78b0687a54e5f72f21d0ca72ae2d.tar.bz2
Add java clang-format (#1672)
Diffstat (limited to 'java/test/TestH5Giterate.java')
-rw-r--r--java/test/TestH5Giterate.java71
1 files changed, 40 insertions, 31 deletions
diff --git a/java/test/TestH5Giterate.java b/java/test/TestH5Giterate.java
index 388d2ac..eb4b5bf 100644
--- a/java/test/TestH5Giterate.java
+++ b/java/test/TestH5Giterate.java
@@ -15,6 +15,7 @@ package test;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
@@ -28,11 +29,13 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Giterate {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
private static final String H5_FILE = "h5ex_g_iterate.hdf";
- long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
- private final long _openGroup(long fid, String name) {
+ private final long _openGroup(long fid, String name)
+ {
long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT);
@@ -47,14 +50,13 @@ public class TestH5Giterate {
}
@Before
- public void openH5file()
- throws HDF5LibraryException, NullPointerException {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void openH5file() throws HDF5LibraryException, NullPointerException
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
- H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY,
- HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -63,15 +65,21 @@ public class TestH5Giterate {
}
@After
- public void deleteH5file() throws HDF5LibraryException {
+ public void deleteH5file() throws HDF5LibraryException
+ {
if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
}
System.out.println();
}
@Test
- public void testH5Gget_obj_info_all() {
+ public void testH5Gget_obj_info_all()
+ {
H5G_info_t info = null;
long gid = _openGroup(H5fid, "/");
@@ -90,45 +98,46 @@ public class TestH5Giterate {
}
assertNotNull(info);
assertTrue("number of links is empty", info.nlinks > 0);
- String objNames[] = new String[(int) info.nlinks];
- int objTypes[] = new int[(int) info.nlinks];
- int lnkTypes[] = new int[(int) info.nlinks];
- H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks];
+ String objNames[] = new String[(int)info.nlinks];
+ int objTypes[] = new int[(int)info.nlinks];
+ int lnkTypes[] = new int[(int)info.nlinks];
+ H5O_token_t objTokens[] = new H5O_token_t[(int)info.nlinks];
int names_found = 0;
try {
- names_found = H5.H5Gget_obj_info_all(H5fid, "/", objNames,
- objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME);
+ names_found = H5.H5Gget_obj_info_all(H5fid, "/", objNames, objTypes, lnkTypes, objTokens,
+ HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Gget_obj_info_all: " + err);
}
- assertTrue("number found[" + names_found + "] different than expected["
- + objNames.length + "]", names_found == objNames.length);
+ assertTrue("number found[" + names_found + "] different than expected[" + objNames.length + "]",
+ names_found == objNames.length);
for (int i = 0; i < objNames.length; i++) {
assertNotNull("name #" + i + " does not exist", objNames[i]);
assertTrue(objNames[i].length() > 0);
- if (objTypes[i]==HDF5Constants.H5O_TYPE_GROUP) {
- assertTrue("Group is index: "+i + " ",i==2);
- assertTrue("Group is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("G1")==0);
+ if (objTypes[i] == HDF5Constants.H5O_TYPE_GROUP) {
+ assertTrue("Group is index: " + i + " ", i == 2);
+ assertTrue("Group is : " + objNames[i] + " ", objNames[i].compareToIgnoreCase("G1") == 0);
}
- else if (objTypes[i]==HDF5Constants.H5O_TYPE_DATASET) {
- assertTrue("Dataset is index: "+i + " ",(i==0)||(i==3));
- if(i==0)
- assertTrue("Dataset is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("DS1")==0);
+ else if (objTypes[i] == HDF5Constants.H5O_TYPE_DATASET) {
+ assertTrue("Dataset is index: " + i + " ", (i == 0) || (i == 3));
+ if (i == 0)
+ assertTrue("Dataset is : " + objNames[i] + " ",
+ objNames[i].compareToIgnoreCase("DS1") == 0);
else
- assertTrue("Dataset is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("L1")==0);
+ assertTrue("Dataset is : " + objNames[i] + " ",
+ objNames[i].compareToIgnoreCase("L1") == 0);
}
- else if (objTypes[i]==HDF5Constants.H5O_TYPE_NAMED_DATATYPE) {
- assertTrue("Datatype is index: "+i + " ",i==1);
- assertTrue("Datatype is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("DT1")==0);
+ else if (objTypes[i] == HDF5Constants.H5O_TYPE_NAMED_DATATYPE) {
+ assertTrue("Datatype is index: " + i + " ", i == 1);
+ assertTrue("Datatype is : " + objNames[i] + " ", objNames[i].compareToIgnoreCase("DT1") == 0);
}
else {
fail(" Unknown at index: " + i + " " + objNames[i]);
}
}
}
-
}