diff options
author | Christian Chilan <chilan@hdfgroup.org> | 2007-01-05 18:26:41 (GMT) |
---|---|---|
committer | Christian Chilan <chilan@hdfgroup.org> | 2007-01-05 18:26:41 (GMT) |
commit | f87a2c34f833b5e5b667d4de7f4130ff0500b31e (patch) | |
tree | 066446a3ba72c13ae3b8c39cfcdcbfdb8653b53f /test/tselect.c | |
parent | 124d4e2e43e0dcd9985a60399674c55d85d337d0 (diff) | |
download | hdf5-f87a2c34f833b5e5b667d4de7f4130ff0500b31e.zip hdf5-f87a2c34f833b5e5b667d4de7f4130ff0500b31e.tar.gz hdf5-f87a2c34f833b5e5b667d4de7f4130ff0500b31e.tar.bz2 |
[svn-r13112] Added tests to verify that H5Sselect_valid() returns FAIL when dataspace is not valid, or when dataspace is valid but closed.
Diffstat (limited to 'test/tselect.c')
-rw-r--r-- | test/tselect.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/test/tselect.c b/test/tselect.c index 58552eb..c834336 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -4056,13 +4056,33 @@ test_select_valid(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Selection Validity\n")); + MESSAGE(8, ( "Case 1 : sub_space is not a valid dataspace\n")); + dims[0] = dims[1] = H5S_UNLIMITED; + + sub_space = H5Screate_simple(2,dims,NULL); + VERIFY(sub_space, FAIL, "H5Screate_simple"); + + valid=H5Sselect_valid(sub_space); + VERIFY(valid, FAIL, "H5Sselect_valid"); + + /* Set arrays and dataspace for the rest of the cases */ count[0] = count[1] = 1; dims[0] = dims[1] = maxdims[0] = maxdims[1] = 10; main_space = H5Screate_simple(2,dims,maxdims); CHECK(main_space, FAIL, "H5Screate_simple"); - MESSAGE(8, ( "Case 1 : in the dimensions\nTry offset (4,4) and size(6,6), the original space is of size (10,10)\n")); + MESSAGE(8, ( "Case 2 : sub_space is a valid but closed dataspace\n")); + sub_space = H5Scopy(main_space); + CHECK(sub_space, FAIL, "H5Scopy"); + + error=H5Sclose(sub_space); + CHECK(error, FAIL, "H5Sclose"); + + valid=H5Sselect_valid(sub_space); + VERIFY(valid, FAIL, "H5Sselect_valid"); + + MESSAGE(8, ( "Case 3 : in the dimensions\nTry offset (4,4) and size(6,6), the original space is of size (10,10)\n")); start[0] = start[1] = 4; size[0] = size[1] = 6; @@ -4084,7 +4104,7 @@ test_select_valid(void) error=H5Sclose(sub_space); CHECK(error, FAIL, "H5Sclose"); - MESSAGE(8, ( "Case 2 : exceed dimensions by 1\nTry offset (5,5) and size(6,6), the original space is of size (10,10)\n")); + MESSAGE(8, ( "Case 4 : exceed dimensions by 1\nTry offset (5,5) and size(6,6), the original space is of size (10,10)\n")); start[0] = start[1] = 5; size[0] = size[1] = 6; @@ -4106,7 +4126,7 @@ test_select_valid(void) error=H5Sclose(sub_space); CHECK(error, FAIL, "H5Sclose"); - MESSAGE(8, ( "Case 3 : exceed dimensions by 2\nTry offset (6,6) and size(6,6), the original space is of size (10,10)\n")); + MESSAGE(8, ( "Case 5 : exceed dimensions by 2\nTry offset (6,6) and size(6,6), the original space is of size (10,10)\n")); start[0] = start[1] = 6; size[0] = size[1] = 6; @@ -4127,6 +4147,7 @@ test_select_valid(void) error=H5Sclose(sub_space); CHECK(error, FAIL, "H5Sclose"); + error=H5Sclose(main_space); CHECK(error, FAIL, "H5Sclose"); } /* test_select_valid() */ |