From 9fbb0d98d9bb88f118d94b1ff15aa12178d51b99 Mon Sep 17 00:00:00 2001 From: Christian Chilan Date: Wed, 17 Jan 2007 15:49:34 -0500 Subject: [svn-r13149] Added tests to verify that H5Sselect_valid() returns FAIL when dataspace is not valid, or when dataspace is valid but closed. --- test/tselect.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/test/tselect.c b/test/tselect.c index 43299cc..166a29b 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -4431,13 +4431,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; @@ -4459,7 +4479,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; @@ -4481,7 +4501,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; -- cgit v0.12