summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>1998-04-23 22:08:16 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>1998-04-23 22:08:16 (GMT)
commitf1b2c756e010bea07e37a7b761c2bda268bb6c01 (patch)
tree81b8d4a11282f6e7d6829308ea7bb30faaf52815
parentee65e2eb8c2292f5ad45452fe6521c8d944d96d9 (diff)
downloadhdf5-f1b2c756e010bea07e37a7b761c2bda268bb6c01.zip
hdf5-f1b2c756e010bea07e37a7b761c2bda268bb6c01.tar.gz
hdf5-f1b2c756e010bea07e37a7b761c2bda268bb6c01.tar.bz2
[svn-r359] Added tests for H5Fcreate with the H5F_ACC_EXCL flag.
-rw-r--r--test/tfile.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/tfile.c b/test/tfile.c
index bfdf21f..028c509 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -70,6 +70,28 @@ test_file_create(void)
/* Output message about test being performed */
MESSAGE(5, ("Testing Low-Level File Creation I/O\n"));
+ /* Test create with various sequences of H5F_ACC_EXCL and */
+ /* H5F_ACC_TRUNC flags */
+
+ /* Create with H5F_ACC_EXCL */
+ /* First ensure the file does not exist */
+ remove(FILE1);
+ fid1 = H5Fcreate(FILE1, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid1, FAIL, "H5Fcreate");
+
+ /* try to create the same file with H5F_ACC_TRUNC (should fail) */
+ fid2 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(fid2, FAIL, "H5Fcreate");
+
+ /* Close the file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Try again with H5F_ACC_EXCL (should fail) */
+ fid1 = H5Fcreate(FILE1, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(fid1, FAIL, "H5Fcreate");
+
+ /* Test create with H5F_ACC_TRUNC */
/* Create first file */
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fcreate");
@@ -78,6 +100,10 @@ test_file_create(void)
fid2 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
VERIFY(fid2, FAIL, "H5Fcreate");
+ /* Try with H5F_ACC_EXCL (should fail too) */
+ fid2 = H5Fcreate(FILE1, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(fid2, FAIL, "H5Fcreate");
+
/* Get the file-creation template */
tmpl1 = H5Fget_create_template(fid1);
CHECK(tmpl1, FAIL, "H5Fget_create_template");