HDFFV-10868 - add H5Sselect API java wrappers.

Also added javadoc comments to H5E and H5s constants.
This commit is contained in:
Allen Byrne
2020-10-27 16:48:02 -05:00
parent 313a8c8546
commit f8b3f576ce
8 changed files with 1910 additions and 320 deletions

View File

@@ -242,4 +242,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 = -1;
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 = -1;
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 = -1;
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 = -1;
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 = -1;
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);
}
}