summaryrefslogtreecommitdiffstats
path: root/java/test/TestH5Sbasic.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/test/TestH5Sbasic.java')
-rw-r--r--java/test/TestH5Sbasic.java153
1 files changed, 145 insertions, 8 deletions
diff --git a/java/test/TestH5Sbasic.java b/java/test/TestH5Sbasic.java
index 3f626dd..548ac95 100644
--- a/java/test/TestH5Sbasic.java
+++ b/java/test/TestH5Sbasic.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 *
@@ -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);
+ }
+
}