summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2011-06-10 02:34:35 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2011-06-10 02:34:35 (GMT)
commit5fde8ebdc25704ebc883dbbee2ad811cd0eaca85 (patch)
treeae808b6495051cd8fb9be5ee859482bbb4c34977 /hl
parent68688ba87e41e8b6d48118385483ac08580bf422 (diff)
downloadhdf5-5fde8ebdc25704ebc883dbbee2ad811cd0eaca85.zip
hdf5-5fde8ebdc25704ebc883dbbee2ad811cd0eaca85.tar.gz
hdf5-5fde8ebdc25704ebc883dbbee2ad811cd0eaca85.tar.bz2
[svn-r20957] Description: brought rev. 20937 from trunk, additional test for attaching and detaching DS.
Teste: jam (intel)
Diffstat (limited to 'hl')
-rw-r--r--hl/test/test_ds.c77
1 files changed, 76 insertions, 1 deletions
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c
index e8c4eff..663b18a 100644
--- a/hl/test/test_ds.c
+++ b/hl/test/test_ds.c
@@ -4882,7 +4882,7 @@ static int test_attach_detach(void)
hid_t sid; /* dataspace ID */
hid_t dcpl_id; /* dataset creation property */
hid_t dsid = -1; /* DS dataset ID */
- hid_t var1_id, var2_id; /* DS component name */
+ hid_t var1_id, var2_id, var3_id; /* DS component name */
hsize_t dims[RANK1] = {DIM1};
TESTING2("permutations of attaching and detaching");
@@ -4948,6 +4948,27 @@ static int test_attach_detach(void)
if(H5Sclose(sid) < 0)
goto out;
+ /* Create 3rd variable that uses this dimension scale. */
+ if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+
+ if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0)
+ goto out;
+
+ if((sid = H5Screate_simple(DIM1, dims, dims)) < 0)
+ goto out;
+
+ if((var3_id = H5Dcreate2(gid, DS_33_NAME, H5T_NATIVE_FLOAT, sid,
+ H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ goto out;
+
+ if(H5Pclose(dcpl_id) < 0)
+ goto out;
+
+ if(H5Sclose(sid) < 0)
+ goto out;
+
+ /* Attached var2 scale */
if(H5DSattach_scale(var2_id, dsid, 0) < 0)
goto out;
@@ -5000,6 +5021,57 @@ static int test_attach_detach(void)
if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */
goto out;
+ /***************************************************
+ * Attach Three DS and remove the middle one first
+ *****************************************************/
+
+ if(H5DSattach_scale(var1_id, dsid, 0) < 0)
+ goto out;
+
+ if(H5DSattach_scale(var2_id, dsid, 0) < 0)
+ goto out;
+
+ if(H5DSattach_scale(var3_id, dsid, 0) < 0)
+ goto out;
+
+
+ /* Detach the var2 scale */
+ if(H5DSdetach_scale(var2_id, dsid, 0) < 0)
+ goto out;
+
+ /* Check if in correct state of detached and attached */
+
+ if(H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */
+ goto out;
+ if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
+ if(H5DSis_attached(var3_id, dsid, 0) == 0) /* should still be attached */
+ goto out;
+
+ /* Detach the var3 scale */
+ if(H5DSdetach_scale(var3_id, dsid, 0) < 0)
+ goto out;
+
+ /* Check if in correct state of detached and attached */
+ if(H5DSis_attached(var1_id, dsid, 0) == 0) /* should still be attached */
+ goto out;
+ if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
+ if(H5DSis_attached(var3_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
+
+ /* Detach the var1 scale */
+ if(H5DSdetach_scale(var1_id, dsid, 0) < 0)
+ goto out;
+
+ /* Check if in correct state of detached and attached */
+ if(H5DSis_attached(var1_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
+ if(H5DSis_attached(var2_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
+ if(H5DSis_attached(var3_id, dsid, 0) != 0) /* should not be attached */
+ goto out;
+
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
@@ -5009,6 +5081,8 @@ static int test_attach_detach(void)
goto out;
if(H5Dclose(var2_id) < 0)
goto out;
+ if(H5Dclose(var3_id) < 0)
+ goto out;
if(H5Dclose(dsid) < 0)
goto out;
if(H5Gclose(gid) < 0)
@@ -5026,6 +5100,7 @@ out:
{
H5Dclose(var1_id);
H5Dclose(var2_id);
+ H5Dclose(var3_id);
H5Dclose(dsid);
H5Gclose(gid);
H5Fclose(fid);