summaryrefslogtreecommitdiffstats
path: root/tools/h5copy/h5copygentest.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-02-13 23:45:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-02-13 23:45:13 (GMT)
commita5662c497884c2d182294b9aceabe3cbded28358 (patch)
tree60ca9a2ef9a3948f7f62773f2f52e6cc4c7a7da8 /tools/h5copy/h5copygentest.c
parentc6b3059a92b61a119da49c04fbdcd54545d95242 (diff)
downloadhdf5-a5662c497884c2d182294b9aceabe3cbded28358.zip
hdf5-a5662c497884c2d182294b9aceabe3cbded28358.tar.gz
hdf5-a5662c497884c2d182294b9aceabe3cbded28358.tar.bz2
[svn-r13294] Description:
Add empty & "full" groups to source HDF5 file and test copying them. Test renaming objects during copy Test specifying root group path for source & destination objects Tested on: Linux/32 2.6 (chicago) Too minor to require more tests
Diffstat (limited to 'tools/h5copy/h5copygentest.c')
-rw-r--r--tools/h5copy/h5copygentest.c90
1 files changed, 71 insertions, 19 deletions
diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c
index 79f43ef..c9dc01f 100644
--- a/tools/h5copy/h5copygentest.c
+++ b/tools/h5copy/h5copygentest.c
@@ -19,16 +19,16 @@
#include <stdlib.h>
#include "hdf5.h"
-#define FILENAME "h5copytst.h5"
-#define DATASET_SIMPLE "simple"
-#define DATASET_CHUNK "chunk"
-#define DATASET_COMPACT "compact"
-#define DATASET_COMPOUND "compound"
-#define DATASET_COMPRESSED "compressed"
-#define DATASET_NAMED_VL "named_vl"
-#define DATASET_NESTED_VL "nested_vl"
-
-
+#define FILENAME "h5copytst.h5"
+#define DATASET_SIMPLE "simple"
+#define DATASET_CHUNK "chunk"
+#define DATASET_COMPACT "compact"
+#define DATASET_COMPOUND "compound"
+#define DATASET_COMPRESSED "compressed"
+#define DATASET_NAMED_VL "named_vl"
+#define DATASET_NESTED_VL "nested_vl"
+#define GROUP_EMPTY "grp_empty"
+#define GROUP_DATASETS "grp_dsets"
/*-------------------------------------------------------------------------
@@ -306,6 +306,64 @@ static void gent_nested_vl(hid_t loc_id)
/*-------------------------------------------------------------------------
+ * Function: gent_datasets
+ *
+ * Purpose: Generate all datasets in a particular location
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_datasets(hid_t loc_id)
+{
+ gent_simple(loc_id);
+ gent_chunked(loc_id);
+ gent_compact(loc_id);
+ gent_compound(loc_id);
+ gent_compressed(loc_id);
+ gent_named_vl(loc_id);
+ gent_nested_vl(loc_id);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_empty_group
+ *
+ * Purpose: Generate an empty group in a location
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_empty_group(hid_t loc_id)
+{
+ hid_t gid;
+
+ /* Create group in location */
+ gid = H5Gcreate(loc_id, GROUP_EMPTY, (size_t)0);
+
+ /* Release resources */
+ H5Gclose(gid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_nested_datasets
+ *
+ * Purpose: Generate a group in a location and populate it with the "standard"
+ * datasets
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_nested_datasets(hid_t loc_id)
+{
+ hid_t gid;
+
+ /* Create group in location */
+ gid = H5Gcreate(loc_id, GROUP_DATASETS, (size_t)0);
+
+ /* Add datasets to group created */
+ gent_datasets(gid);
+
+ /* Release resources */
+ H5Gclose(gid);
+}
+
+/*-------------------------------------------------------------------------
* Function: main
*
*-------------------------------------------------------------------------
@@ -317,17 +375,11 @@ int main(void)
/* Create source file */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- gent_simple(fid);
- gent_chunked(fid);
- gent_compact(fid);
- gent_compound(fid);
- gent_compressed(fid);
- gent_named_vl(fid);
- gent_nested_vl(fid);
+ gent_datasets(fid);
+ gent_empty_group(fid);
+ gent_nested_datasets(fid);
H5Fclose(fid);
- /* Create destination file with all datasets in root group */
-
return 0;
}