summaryrefslogtreecommitdiffstats
path: root/test/tarray.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/tarray.c')
-rw-r--r--test/tarray.c92
1 files changed, 45 insertions, 47 deletions
diff --git a/test/tarray.c b/test/tarray.c
index a35b8a3..e643fb0 100644
--- a/test/tarray.c
+++ b/test/tarray.c
@@ -13,7 +13,7 @@
/***********************************************************
*
-* Test program: tarray
+* Test program: tarray
*
* Test the Array Datatype functionality
*
@@ -22,14 +22,12 @@
#include "testhdf5.h"
#include "H5srcdir.h"
-#include "hdf5.h"
-
#define FILENAME "tarray1.h5"
#define TESTFILE "tarrold.h5"
/* 1-D array datatype */
-#define ARRAY1_RANK 1
-#define ARRAY1_DIM1 4
+#define ARRAY1_RANK 1
+#define ARRAY1_DIM1 4
/* 3-D array datatype */
#define ARRAY2_RANK 3
@@ -67,7 +65,7 @@ typedef struct
void *test_array_alloc_custom(size_t size, void *info);
void test_array_free_custom(void *mem, void *info);
-
+
/*-------------------------------------------------------------------------
* Function: test_array_atomic_1d
*
@@ -191,7 +189,7 @@ test_array_atomic_1d(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_atomic_1d() */
-
+
/*-------------------------------------------------------------------------
* Function: test_array_funcs
*
@@ -254,7 +252,7 @@ test_array_funcs(void)
CHECK(ret, FAIL, "H5Tclose");
} /* end test_array_funcs() */
-
+
/*-------------------------------------------------------------------------
* Function: test_array_atomic_3d
*
@@ -383,7 +381,7 @@ test_array_atomic_3d(void)
} /* end test_array_atomic_3d() */
-
+
/*-------------------------------------------------------------------------
* Function: test_array_array_atomic
*
@@ -542,7 +540,7 @@ test_array_array_atomic(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_array_atomic() */
-
+
/*-------------------------------------------------------------------------
* Function: test_array_compound_atomic
*
@@ -679,7 +677,7 @@ test_array_compound_atomic(void)
/* Check the 1st field's name */
mname = H5Tget_member_name(tid2, 0);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(HDstrcmp(mname, "i") != 0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
@@ -698,7 +696,7 @@ test_array_compound_atomic(void)
/* Check the 2nd field's name */
mname = H5Tget_member_name(tid2, 1);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(HDstrcmp(mname, "f") != 0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname);
H5free_memory(mname);
@@ -749,7 +747,7 @@ test_array_compound_atomic(void)
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_compound_atomic() */
-
+
/*-------------------------------------------------------------------------
* Function: test_array_compound_array
*
@@ -897,7 +895,7 @@ test_array_compound_array(void)
/* Check the 1st field's name */
mname=H5Tget_member_name(tid2,0);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(HDstrcmp(mname,"i")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
H5free_memory(mname);
@@ -916,7 +914,7 @@ test_array_compound_array(void)
/* Check the 2nd field's name */
mname=H5Tget_member_name(tid2,1);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(HDstrcmp(mname,"f")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
H5free_memory(mname);
@@ -1008,7 +1006,7 @@ test_array_compound_array(void)
** allocated.
**
****************************************************************/
-
+
/*-------------------------------------------------------------------------
* Function: test_array_alloc_custom
*
@@ -1047,7 +1045,7 @@ test_array_alloc_custom(size_t size, void *info)
return ret_value;
} /* end test_array_alloc_custom() */
-
+
/*-------------------------------------------------------------------------
* Function: test_array_free_custom
*
@@ -1076,14 +1074,14 @@ test_array_free_custom(void *_mem, void *info)
if(_mem != NULL) {
mem = ((unsigned char *)_mem) - extra;
- *mem_used -= *(size_t *)mem;
+ *mem_used -= *(size_t *)((void *)mem);
HDfree(mem);
} /* end if */
return;
} /* end test_array_free_custom() */
-
+
/*-------------------------------------------------------------------------
* Function: test_array_vlen_atomic
*
@@ -1270,15 +1268,15 @@ test_array_vlen_atomic(void)
} /* end for */
/* Reclaim the read VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid1,sid1,xfer_pid,rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used,0,"H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close dataset transfer property list */
ret = H5Pclose(xfer_pid);
@@ -1298,7 +1296,7 @@ test_array_vlen_atomic(void)
} /* end test_array_vlen_atomic() */
-
+
/*-------------------------------------------------------------------------
* Function: test_array_vlen_array
*
@@ -1343,7 +1341,7 @@ test_array_vlen_array(void)
for(k=0; k<(i+j+1); k++)
for(l=0; l<ARRAY1_DIM1; l++)
((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l] = (unsigned int)(i*1000+j*100+k*10+l);
- } /* end for */
+ }
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1525,15 +1523,15 @@ test_array_vlen_array(void)
} /* end for */
/* Reclaim the read VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid1,sid1,xfer_pid,rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used,0,"H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close dataset transfer property list */
ret = H5Pclose(xfer_pid);
@@ -1553,7 +1551,7 @@ test_array_vlen_array(void)
} /* end test_array_vlen_array() */
-
+
/*-------------------------------------------------------------------------
* Function: test_array_bkg
*
@@ -1582,9 +1580,9 @@ test_array_bkg(void)
unsigned ndims[3] = {1,1,1};
typedef struct {
- int a[ALEN];
- float b[ALEN];
- double c[ALEN];
+ int a[ALEN];
+ float b[ALEN];
+ double c[ALEN];
} CmpField;
CmpField cf[LENGTH];
@@ -1604,7 +1602,7 @@ test_array_bkg(void)
/* Initialize the data */
/* ------------------- */
dtsinfo = (CmpDTSinfo *)HDmalloc(sizeof(CmpDTSinfo));
- CHECK(dtsinfo, NULL, "HDmalloc");
+ CHECK_PTR(dtsinfo, "HDmalloc");
HDmemset(dtsinfo, 0, sizeof(CmpDTSinfo));
for (i = 0; i < LENGTH; i++) {
for (j = 0; j < ALEN; j++) {
@@ -1857,7 +1855,7 @@ test_array_bkg(void)
HDfree(dtsinfo);
} /* end test_array_bkg() */
-
+
/*-------------------------------------------------------------------------
* Function: test_compat
*
@@ -1927,7 +1925,7 @@ test_compat(void)
/* Check the 1st field's name */
mname=H5Tget_member_name(tid1,0);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(HDstrcmp(mname,"i")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
H5free_memory(mname);
@@ -1946,7 +1944,7 @@ test_compat(void)
/* Check the 2nd field's name */
mname=H5Tget_member_name(tid1,1);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(HDstrcmp(mname,"f")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
H5free_memory(mname);
@@ -1965,7 +1963,7 @@ test_compat(void)
/* Check the 3rd field's name */
mname=H5Tget_member_name(tid1,2);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(HDstrcmp(mname,"l")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
H5free_memory(mname);
@@ -2009,7 +2007,7 @@ test_compat(void)
/* Check the 1st field's name */
mname=H5Tget_member_name(tid1,0);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(mname && HDstrcmp(mname,"i")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
if(mname) H5free_memory(mname);
@@ -2028,7 +2026,7 @@ test_compat(void)
/* Check the 2nd field's name */
mname=H5Tget_member_name(tid1,1);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(mname && HDstrcmp(mname,"f")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
if(mname) H5free_memory(mname);
@@ -2073,7 +2071,7 @@ test_compat(void)
/* Check the 3rd field's name */
mname=H5Tget_member_name(tid1,2);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(mname && HDstrcmp(mname,"l")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
if(mname) H5free_memory(mname);
@@ -2118,7 +2116,7 @@ test_compat(void)
/* Check the 4th field's name */
mname=H5Tget_member_name(tid1,3);
- CHECK(mname, NULL, "H5Tget_member_name");
+ CHECK_PTR(mname, "H5Tget_member_name");
if(mname && HDstrcmp(mname,"d")!=0)
TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname);
if(mname) H5free_memory(mname);
@@ -2148,11 +2146,11 @@ test_compat(void)
CHECK_I(ret, "H5Fclose");
} /* end if */
else
- printf("***cannot open the pre-created compound datatype test file (%s)\n",testfile);
+ HDprintf("***cannot open the pre-created compound datatype test file (%s)\n",testfile);
} /* end test_compat() */
-
+
/*-------------------------------------------------------------------------
* Function: test_array
*
@@ -2185,7 +2183,7 @@ test_array(void)
} /* end test_array() */
-
+
/*-------------------------------------------------------------------------
* Function: cleanup_array
*