summaryrefslogtreecommitdiffstats
path: root/test/tid.c
diff options
context:
space:
mode:
authorNat Furrer <nfurrer@ncsa.uiuc.edu>2004-06-30 15:33:19 (GMT)
committerNat Furrer <nfurrer@ncsa.uiuc.edu>2004-06-30 15:33:19 (GMT)
commit8e468d9dec965e575dd442d63af9e412fcb758e6 (patch)
tree4a31228176fe34c84079d0f0213ab1564412b76c /test/tid.c
parent358b8545dd9e3baa4b63c88a0d28aa8d7afb065b (diff)
downloadhdf5-8e468d9dec965e575dd442d63af9e412fcb758e6.zip
hdf5-8e468d9dec965e575dd442d63af9e412fcb758e6.tar.gz
hdf5-8e468d9dec965e575dd442d63af9e412fcb758e6.tar.bz2
[svn-r8766]
Purpose: Small H5I API changes. Description: Changed public version of H5Inmembers to return the number of IDs in a type by reference. This allows the user to differentiate between the case when H5Inmembers has an error and when the ID type is just empty. Added a new API function, H5Itype_exists, which allows the user to find out whether an ID type exists or not, without throwing an error. Solution: Platforms tested: Copper Misc. update:
Diffstat (limited to 'test/tid.c')
-rw-r--r--test/tid.c46
1 files changed, 33 insertions, 13 deletions
diff --git a/test/tid.c b/test/tid.c
index 2ad8481..ed34955 100644
--- a/test/tid.c
+++ b/test/tid.c
@@ -17,7 +17,7 @@ int id_test()
hid_t testID;
ssize_t testSize = -1;
herr_t err;
- int num_ref;
+ int num_ref, num_members;
testObj = malloc(7 * sizeof(int));
@@ -106,9 +106,15 @@ int id_test()
VERIFY(err, 0, "H5Idestroy_type");
if( err != 0)
goto out;
- VERIFY(H5Inmembers(myType), 0, "H5Inmembers");
- if(H5Inmembers(myType) != 0)
+ VERIFY(H5Itype_exists(myType), 0, "H5Itype_exists");
+ if(H5Itype_exists(myType) != 0)
+ goto out;
+
+ H5E_BEGIN_TRY
+ VERIFY(H5Inmembers(myType, NULL), -1, "H5Inmembers");
+ if(H5Inmembers(myType, NULL) != -1)
goto out;
+ H5E_END_TRY
/* Register another type and another object in that type */
myType = H5Iregister_type(64, 0, (H5I_free_t) free );
@@ -123,8 +129,12 @@ int id_test()
CHECK(arrayID, H5I_INVALID_HID, "H5Iregister");
if(arrayID == H5I_INVALID_HID)
goto out;
- VERIFY(H5Inmembers(myType), 1, "H5Inmembers");
- if(H5Inmembers(myType) != 1)
+ err = H5Inmembers(myType, &num_members);
+ CHECK(err, -1, "H5Inmembers");
+ if (err < 0)
+ goto out;
+ VERIFY(num_members, 1, "H5Inmembers");
+ if(num_members != 1)
goto out;
/* Increment references to type and ensure that dec_type_ref
@@ -137,8 +147,12 @@ int id_test()
VERIFY(num_ref, 1, "H5Idec_type_ref");
if(num_ref != 1)
goto out;
- VERIFY(H5Inmembers(myType), 1, "H5Inmembers");
- if(H5Inmembers(myType) != 1)
+ err = H5Inmembers(myType, &num_members);
+ CHECK(err, -1, "H5Inmembers");
+ if (err < 0)
+ goto out;
+ VERIFY(num_members, 1, "H5Inmembers");
+ if(num_members != 1)
goto out;
/* This call to dec_type_ref should destroy the type */
@@ -146,9 +160,15 @@ int id_test()
VERIFY(num_ref, 0, "H5Idec_type_ref");
if(num_ref != 0)
goto out;
- VERIFY(H5Inmembers(myType), 0, "H5Inmembers");
- if(H5Inmembers(myType) != 0)
+ VERIFY(H5Itype_exists(myType), 0, "H5Itype_exists");
+ if (H5Itype_exists(myType) != 0)
+ goto out;
+
+ H5E_BEGIN_TRY
+ err = H5Inmembers(myType, &num_members);
+ if(err >= 0)
goto out;
+ H5E_END_TRY
return 0;
@@ -195,11 +215,11 @@ int id_predefined_test()
goto out;
H5E_BEGIN_TRY
- testInt = H5Inmembers(H5I_ERROR_STACK);
+ testErr = H5Inmembers(H5I_ERROR_STACK, &testInt);
H5E_END_TRY
- VERIFY(testInt, -1, "H5Inmembers");
- if(testInt != -1)
+ VERIFY(testErr, -1, "H5Inmembers");
+ if(testErr != -1)
goto out;
H5E_BEGIN_TRY
@@ -341,4 +361,4 @@ void test_ids()
id_test();
id_predefined_test();
test_id_type_list();
-} \ No newline at end of file
+}