From f1b2c756e010bea07e37a7b761c2bda268bb6c01 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Thu, 23 Apr 1998 17:08:16 -0500 Subject: [svn-r359] Added tests for H5Fcreate with the H5F_ACC_EXCL flag. --- test/tfile.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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"); -- cgit v0.12