diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2011-03-15 21:34:26 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2011-03-15 21:34:26 (GMT) |
commit | e7275d364558c0d419acc6841baf83b35500163e (patch) | |
tree | 940729ca61e14279374576533ae94614ce8f0b55 /test | |
parent | 04c9fe36a9c3e66d0196b1f02af3039411b0a5f9 (diff) | |
download | hdf5-e7275d364558c0d419acc6841baf83b35500163e.zip hdf5-e7275d364558c0d419acc6841baf83b35500163e.tar.gz hdf5-e7275d364558c0d419acc6841baf83b35500163e.tar.bz2 |
[svn-r20256] Bug 2115 - add H5_VERSION_GE and H5_VERSION_LE macros. I added a new test case to show how to use them.
Tested on jam - simple change.
Diffstat (limited to 'test')
-rw-r--r-- | test/tfile.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/test/tfile.c b/test/tfile.c index dcd7d3e..6f18a08 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -99,6 +99,10 @@ #define USERBLOCK_SIZE ((hsize_t) 512) +/* Declaration for test_libver_macros2() */ +#define FILE5 "tfile5.h5" /* Test file */ + + static void create_objects(hid_t, hid_t, hid_t *, hid_t *, hid_t *, hid_t *); static void @@ -2613,6 +2617,70 @@ test_libver_macros(void) /**************************************************************** ** +** test_libver_macros2(): +** Verify that H5_VERSION_GE works correactly and show how +** to use it. +** +****************************************************************/ +static void +test_libver_macros2(void) +{ + hid_t file; + hid_t grp; + htri_t status; + herr_t ret; /* Return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing macros for library version comparison with a file\n")); + + /* + * Create a file. + */ + file = H5Fcreate(FILE5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(file, FAIL, "H5Fcreate"); + + /* + * Create a group in the file. + */ + grp = H5Gcreate(file, "Group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(file, FAIL, "H5Gcreate"); + + /* + * Close the group + */ + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + + /* + * Delete the group using different function based on the library version. + * And verify the action. + */ +#if H5_VERSION_GE(1,8,0) + ret = H5Ldelete(file, "Group", H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lunlink"); + + status = H5Lexists(file, "Group", H5P_DEFAULT); + VERIFY(status, FALSE, "H5Lexists"); +#else + ret = H5Gunlink(file, "Group"); + CHECK(ret, FAIL, "H5Gunlink"); + + H5E_BEGIN_TRY { + grp = H5Gopen(file, "Group"); + } H5E_END_TRY; + VERIFY(grp, FAIL, "H5Gopen"); +#endif + + /* + * Close the file. + */ + ret = H5Fclose(file); + CHECK(ret, FAIL, "H5Fclose"); + +} /* test_libver_macros2() */ + +/**************************************************************** +** ** test_file(): Main low-level file I/O test routine. ** ****************************************************************/ @@ -2648,6 +2716,7 @@ test_file(void) test_userblock_alignment(); /* Tests that files created with a userblock and alignment interact properly */ test_libver_bounds(); /* Test compatibility for file space management */ test_libver_macros(); /* Test the macros for library version comparison */ + test_libver_macros2(); /* Show the use of the macros for library version comparison */ } /* test_file() */ |