summaryrefslogtreecommitdiffstats
path: root/test/gheap.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-09-01 10:27:45 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-09-01 10:27:45 (GMT)
commit642f392ba3e2d30ae2a82e32f249461121d17cbc (patch)
treebbce1ae1606153f323156f207b50d88d7fba2ddf /test/gheap.c
parentc034336452ee48574f0dd65bf053079f9801e269 (diff)
downloadhdf5-642f392ba3e2d30ae2a82e32f249461121d17cbc.zip
hdf5-642f392ba3e2d30ae2a82e32f249461121d17cbc.tar.gz
hdf5-642f392ba3e2d30ae2a82e32f249461121d17cbc.tar.bz2
[svn-r19330] Description:
Bring r19109:19328 from trunk to revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, w/threadsafe, in production mode Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode Mac OS X/32 10.6.4 (amazon) in debug mode Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
Diffstat (limited to 'test/gheap.c')
-rw-r--r--test/gheap.c69
1 files changed, 35 insertions, 34 deletions
diff --git a/test/gheap.c b/test/gheap.c
index b2c9090..2829e34 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -75,24 +75,24 @@ const char *FILENAME[] = {
static int
test_1 (hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f=NULL;
+ hid_t file = -1;
+ H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
uint8_t in[1024];
int i;
size_t size;
herr_t status;
- int nerrors=0;
+ int nerrors = 0;
char filename[1024];
TESTING("monotonically increasing lengths");
/* Open a clean file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if (NULL==(f=H5I_object(file))) {
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
puts(" Unable to create file");
goto error;
@@ -103,16 +103,16 @@ test_1 (hid_t fapl)
* a clean file, the addresses allocated for the collections should also
* be monotonically increasing.
*/
- for (i=0; i<1024; i++) {
- size = i+1;
- memset (out, 'A'+i%26, size);
+ for(i = 0; i < 1024; i++) {
+ size = i + 1;
+ HDmemset(out, 'A' + i % 26, size);
H5Eclear2(H5E_DEFAULT);
- status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i);
- if (status<0) {
+ status = H5HG_insert(f, H5P_DATASET_XFER_DEFAULT, size, out, obj + i);
+ if(status < 0) {
H5_FAILED();
puts(" Unable to insert object into global heap");
nerrors++;
- } else if (i && H5F_addr_gt (obj[i-1].addr, obj[i].addr)) {
+ } else if(i && H5F_addr_gt(obj[i - 1].addr, obj[i].addr)) {
H5_FAILED();
puts(" Collection addresses are not monotonically increasing");
nerrors++;
@@ -122,27 +122,28 @@ test_1 (hid_t fapl)
/*
* Now try to read each object back.
*/
- for (i=0; i<1024; i++) {
- size = i+1;
- memset (out, 'A'+i%26, size);
+ for(i = 0; i < 1024; i++) {
+ size = i + 1;
+ HDmemset(out, 'A' + i % 26, size);
H5Eclear2(H5E_DEFAULT);
- if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in, NULL)) {
+ if(NULL == H5HG_read(f, H5P_DATASET_XFER_DEFAULT, obj + i, in, NULL)) {
H5_FAILED();
puts(" Unable to read object");
nerrors++;
- } else if (memcmp (in, out, size)) {
+ } else if(HDmemcmp(in, out, size)) {
H5_FAILED();
puts(" Value read doesn't match value written");
nerrors++;
}
}
- if (H5Fclose(file)<0) goto error;
- if (nerrors) goto error;
+ if(H5Fclose(file) < 0) goto error;
+ if(nerrors) goto error;
+
PASSED();
return 0;
- error:
+error:
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
@@ -170,23 +171,23 @@ test_1 (hid_t fapl)
static int
test_2 (hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f=NULL;
+ hid_t file = -1;
+ H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
uint8_t in[1024];
int i;
size_t size;
- int nerrors=0;
+ int nerrors = 0;
char filename[1024];
TESTING("monotonically decreasing lengths");
/* Open a clean file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if (NULL==(f=H5I_object(file))) {
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
puts(" Unable to create file");
goto error;
@@ -257,23 +258,23 @@ test_2 (hid_t fapl)
static int
test_3 (hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f=NULL;
+ hid_t file = -1;
+ H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
int i;
size_t size;
herr_t status;
- int nerrors=0;
+ int nerrors = 0;
char filename[1024];
TESTING("complete object removal");
/* Open a clean file */
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if (NULL==(f=H5I_object(file))) {
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
puts(" Unable to create file");
goto error;
@@ -336,23 +337,23 @@ test_3 (hid_t fapl)
static int
test_4 (hid_t fapl)
{
- hid_t file=-1;
- H5F_t *f=NULL;
+ hid_t file = -1;
+ H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
int i;
size_t size;
herr_t status;
- int nerrors=0;
+ int nerrors = 0;
char filename[1024];
TESTING("partial object removal");
/* Open a clean file */
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
- if (NULL==(f=H5I_object(file))) {
+ if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
puts(" Unable to create file");
goto error;