mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-27 02:10:55 +08:00
[svn-r20180] I added 2 public macros to the H5public.h - H5_VERSION_GE and H5_VERSION_LE - and put some test cases in tfile.c.
Tested on jam, heiwa, and amani.
This commit is contained in:
parent
f62a87c45b
commit
a0f4d6d40c
@ -83,6 +83,17 @@ extern "C" {
|
||||
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
|
||||
H5_VERS_RELEASE)
|
||||
|
||||
/* macros for comparing the version */
|
||||
#define H5_VERSION_GE(Maj,Min,Rel) \
|
||||
(((H5_VERS_MAJOR==Maj) && (H5_VERS_MINOR==Min) && (H5_VERS_RELEASE>=Rel)) || \
|
||||
((H5_VERS_MAJOR==Maj) && (H5_VERS_MINOR>Min)) || \
|
||||
(H5_VERS_MAJOR>Maj))
|
||||
|
||||
#define H5_VERSION_LE(Maj,Min,Rel) \
|
||||
(((H5_VERS_MAJOR==Maj) && (H5_VERS_MINOR==Min) && (H5_VERS_RELEASE<=Rel)) || \
|
||||
((H5_VERS_MAJOR==Maj) && (H5_VERS_MINOR<Min)) || \
|
||||
(H5_VERS_MAJOR<Maj))
|
||||
|
||||
/*
|
||||
* Status return values. Failed integer functions in HDF5 result almost
|
||||
* always in a negative value (unsigned failing functions sometimes return
|
||||
|
49
test/tfile.c
49
test/tfile.c
@ -3112,6 +3112,54 @@ test_libver_bounds(void)
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
} /* test_libver_bounds() */
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_libver_macros():
|
||||
** Verify that H5_VERSION_GE and H5_VERSION_LE work correactly.
|
||||
**
|
||||
****************************************************************/
|
||||
static void
|
||||
test_libver_macros(void)
|
||||
{
|
||||
unsigned major = H5_VERS_MAJOR;
|
||||
unsigned minor = H5_VERS_MINOR;
|
||||
unsigned release = H5_VERS_RELEASE;
|
||||
herr_t ret; /* Return value */
|
||||
|
||||
/* Output message about test being performed */
|
||||
MESSAGE(5, ("Testing macros for library version comparison\n"));
|
||||
|
||||
VERIFY(H5_VERSION_GE(major,minor,release), TRUE, "H5_VERSION_GE");
|
||||
VERIFY(H5_VERSION_GE(major-1,minor,release), TRUE, "H5_VERSION_GE");
|
||||
VERIFY(H5_VERSION_GE(major-1,minor+1,release), TRUE, "H5_VERSION_GE");
|
||||
VERIFY(H5_VERSION_GE(major-1,minor,release+1), TRUE, "H5_VERSION_GE");
|
||||
VERIFY(H5_VERSION_GE(major,minor-1,release), TRUE, "H5_VERSION_GE");
|
||||
VERIFY(H5_VERSION_GE(major,minor-1,release+1), TRUE, "H5_VERSION_GE");
|
||||
VERIFY(H5_VERSION_GE(major,minor,release-1), TRUE, "H5_VERSION_GE");
|
||||
|
||||
VERIFY(H5_VERSION_GE(major+1,minor,release), FALSE, "H5_VERSION_GE");
|
||||
VERIFY(H5_VERSION_GE(major+1,minor-1,release), FALSE, "H5_VERSION_GE");
|
||||
VERIFY(H5_VERSION_GE(major+1,minor-1,release-1), FALSE, "H5_VERSION_GE");
|
||||
VERIFY(H5_VERSION_GE(major,minor+1,release), FALSE, "H5_VERSION_GE");
|
||||
VERIFY(H5_VERSION_GE(major,minor+1,release-1), FALSE, "H5_VERSION_GE");
|
||||
VERIFY(H5_VERSION_GE(major,minor,release+1), FALSE, "H5_VERSION_GE");
|
||||
|
||||
VERIFY(H5_VERSION_LE(major,minor,release), TRUE, "H5_VERSION_LE");
|
||||
VERIFY(H5_VERSION_LE(major+1,minor,release), TRUE, "H5_VERSION_LE");
|
||||
VERIFY(H5_VERSION_LE(major+1,minor-1,release), TRUE, "H5_VERSION_LE");
|
||||
VERIFY(H5_VERSION_LE(major+1,minor-1,release-1), TRUE, "H5_VERSION_LE");
|
||||
VERIFY(H5_VERSION_LE(major,minor+1,release), TRUE, "H5_VERSION_LE");
|
||||
VERIFY(H5_VERSION_LE(major,minor+1,release-1), TRUE, "H5_VERSION_LE");
|
||||
VERIFY(H5_VERSION_LE(major,minor,release+1), TRUE, "H5_VERSION_LE");
|
||||
|
||||
VERIFY(H5_VERSION_LE(major-1,minor,release), FALSE, "H5_VERSION_LE");
|
||||
VERIFY(H5_VERSION_LE(major-1,minor+1,release), FALSE, "H5_VERSION_LE");
|
||||
VERIFY(H5_VERSION_LE(major-1,minor+1,release+1), FALSE, "H5_VERSION_LE");
|
||||
VERIFY(H5_VERSION_LE(major,minor-1,release), FALSE, "H5_VERSION_LE");
|
||||
VERIFY(H5_VERSION_LE(major,minor-1,release+1), FALSE, "H5_VERSION_LE");
|
||||
VERIFY(H5_VERSION_LE(major,minor,release-1), FALSE, "H5_VERSION_LE");
|
||||
} /* test_libver_macros() */
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_deprec():
|
||||
@ -3292,6 +3340,7 @@ test_file(void)
|
||||
test_filespace_info(); /* Test file creation public routines:H5Pget/set_file_space */
|
||||
test_filespace_compatible();/* Test compatibility for file space management */
|
||||
test_libver_bounds(); /* Test compatibility for file space management */
|
||||
test_libver_macros(); /* Test the macros for library version comparison */
|
||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
||||
test_deprec(); /* Test deprecated routines */
|
||||
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
||||
|
Loading…
Reference in New Issue
Block a user