summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2004-06-03 18:33:14 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2004-06-03 18:33:14 (GMT)
commit24ccbea9f36a976f8b9bb9ea138871664625a0b6 (patch)
treeaffaea994b8bbbc84a4588c80d2d596dba918815 /test
parent7d9e9bced381139da3b7744b7d2d25b430346a93 (diff)
downloadhdf5-24ccbea9f36a976f8b9bb9ea138871664625a0b6.zip
hdf5-24ccbea9f36a976f8b9bb9ea138871664625a0b6.tar.gz
hdf5-24ccbea9f36a976f8b9bb9ea138871664625a0b6.tar.bz2
[svn-r8608] Purpose: more test.
Description: Test if datatype operation can handle opaque type without any tag. Platforms tested: h5committest.
Diffstat (limited to 'test')
-rw-r--r--test/dtypes.c57
1 files changed, 52 insertions, 5 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index 6048b9d..18b837c 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -115,6 +115,7 @@ static int num_opaque_conversions_g = 0;
#define aligned_free(M) free((char*)(M)-ALIGNMENT)
void some_dummy_func(float x);
+static int opaque_check(int tag_it);
/*-------------------------------------------------------------------------
@@ -2567,6 +2568,46 @@ convert_opaque(hid_t UNUSED st, hid_t UNUSED dt, H5T_cdata_t *cdata,
/*-------------------------------------------------------------------------
* Function: test_opaque
*
+ * Purpose: Driver function to test opaque datatypes
+ *
+ * Return: Success: 0
+ *
+ * Failure: number of errors
+ *
+ * Programmer: Raymond Lu
+ * June 2, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_opaque(void)
+{
+ int num_errors = 0;
+
+ TESTING("opaque datatypes");
+
+ /* Test opaque types with tags */
+ num_errors += opaque_check(0);
+ /* Test opaque types without tag */
+ num_errors += opaque_check(1);
+
+ if(num_errors)
+ goto error;
+
+ PASSED();
+ return 0;
+
+ error:
+ H5_FAILED();
+ return num_errors;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: opaque_check
+ *
* Purpose: Test opaque datatypes
*
* Return: Success: 0
@@ -2577,25 +2618,32 @@ convert_opaque(hid_t UNUSED st, hid_t UNUSED dt, H5T_cdata_t *cdata,
* Thursday, May 20, 1999
*
* Modifications:
+ * Raymond Lu
+ * June 2, 2004
+ * Made tag for one opaque type optional.
*
*-------------------------------------------------------------------------
*/
static int
-test_opaque(void)
+opaque_check(int tag_it)
{
#define OPAQUE_NELMTS 1000
hid_t st=-1, dt=-1;
herr_t status;
char buf[1]; /*not really used*/
- int saved = num_opaque_conversions_g;
+ int saved;
- TESTING("opaque datatypes");
+ saved = num_opaque_conversions_g = 0;
/* Build source and destination types */
if ((st=H5Tcreate(H5T_OPAQUE, 4))<0) goto error;
if (H5Tset_tag(st, "opaque source type")<0) goto error;
+
if ((dt=H5Tcreate(H5T_OPAQUE, 4))<0) goto error;
- if (H5Tset_tag(dt, "opaque destination type")<0) goto error;
+ if (tag_it) {
+ if (H5Tset_tag(dt, "opaque destination type")<0)
+ goto error;
+ }
/* Make sure that we can't convert between the types yet */
H5E_BEGIN_TRY {
@@ -2621,7 +2669,6 @@ test_opaque(void)
H5Tclose(st);
H5Tclose(dt);
- PASSED();
return 0;
error: