diff options
Diffstat (limited to 'java/test')
-rw-r--r-- | java/test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | java/test/TestH5Sbasic.java | 138 | ||||
-rw-r--r-- | java/test/testfiles/JUnit-TestH5Sbasic.txt | 16 |
3 files changed, 154 insertions, 2 deletions
diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index b97ad26..b0a0d53 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -96,7 +96,7 @@ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_ 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}) -if (WIN32 OR MINGW) +if (WIN32) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") diff --git a/java/test/TestH5Sbasic.java b/java/test/TestH5Sbasic.java index 2173647..9874584 100644 --- a/java/test/TestH5Sbasic.java +++ b/java/test/TestH5Sbasic.java @@ -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); + } + } diff --git a/java/test/testfiles/JUnit-TestH5Sbasic.txt b/java/test/testfiles/JUnit-TestH5Sbasic.txt index 707878e..3422442 100644 --- a/java/test/testfiles/JUnit-TestH5Sbasic.txt +++ b/java/test/testfiles/JUnit-TestH5Sbasic.txt @@ -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) |