summaryrefslogtreecommitdiffstats
path: root/test/cmpd_dset.c
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>1998-05-28 23:02:29 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>1998-05-28 23:02:29 (GMT)
commit1327f0c65ecaa72a0e8983f6a0574cc9b802f130 (patch)
treecea0d53dd380e5ec5503e29f87a49631cb0476b8 /test/cmpd_dset.c
parent2a4d82a6ce3f16b916bb78717f199a160ca0ec1c (diff)
downloadhdf5-1327f0c65ecaa72a0e8983f6a0574cc9b802f130.zip
hdf5-1327f0c65ecaa72a0e8983f6a0574cc9b802f130.tar.gz
hdf5-1327f0c65ecaa72a0e8983f6a0574cc9b802f130.tar.bz2
[svn-r402] Added cleanup function that removes all temporary test files when
the tests pass. Should add a "noclean" option that allows the temporary to stay around even when the tests pass.
Diffstat (limited to 'test/cmpd_dset.c')
-rw-r--r--test/cmpd_dset.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index 31492b9..13d9ca3 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -12,6 +12,8 @@
#include <stdlib.h>
#include <string.h>
+#define TEST_FILE_NAME "cmpd_dset.h5"
+
/* The first dataset */
typedef struct s1_t {
unsigned int a;
@@ -63,6 +65,26 @@ typedef struct s5_t {
/*-------------------------------------------------------------------------
+ * Function: cleanup
+ *
+ * Purpose: Cleanup temporary test files
+ *
+ * Return: none
+ *
+ * Programmer: Albert Cheng
+ * May 28, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+cleanup(void)
+{
+ remove(TEST_FILE_NAME);
+}
+
+/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Creates a simple dataset of a compound type and then reads
@@ -131,7 +153,7 @@ main (void)
hsize_t h_sample[2]; /*hyperslab sampling */
/* Create the file */
- file = H5Fcreate ("cmpd_dset.h5", H5F_ACC_TRUNC|H5F_ACC_DEBUG,
+ file = H5Fcreate (TEST_FILE_NAME, H5F_ACC_TRUNC|H5F_ACC_DEBUG,
H5P_DEFAULT, H5P_DEFAULT);
assert (file>=0);
@@ -591,5 +613,6 @@ STEP 11: Write an array back to the middle third of the dataset to\n\
H5Dclose (dataset);
H5Fclose (file);
+ cleanup();
return 0;
}