diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/bittests.c | 12 | ||||
-rw-r--r-- | test/dsets.c | 7 | ||||
-rw-r--r-- | test/dtransform.c | 68 | ||||
-rw-r--r-- | test/dtypes.c | 8 | ||||
-rw-r--r-- | test/h5test.c | 2 | ||||
-rw-r--r-- | test/ntypes.c | 2 | ||||
-rw-r--r-- | test/th5s.c | 4 |
7 files changed, 57 insertions, 46 deletions
diff --git a/test/bittests.c b/test/bittests.c index 2823a56..cb038f7 100644 --- a/test/bittests.c +++ b/test/bittests.c @@ -310,7 +310,7 @@ test_shift (void) /* Look for the ones */ n = H5T_bit_find (vector, 0, 8*sizeof(vector), H5T_BIT_LSB, 1); - if (n!=offset+shift_dist) { + if ((size_t)n!=offset+shift_dist) { H5_FAILED(); printf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); @@ -337,7 +337,7 @@ test_shift (void) /* Look for the ones */ n = H5T_bit_find (vector, 0, 8*sizeof(vector), H5T_BIT_LSB, 1); - if (n!=offset) { + if ((size_t)n!=offset) { H5_FAILED(); printf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); @@ -363,7 +363,7 @@ test_shift (void) if(size % 2 == 0) shift_dist = size; else - shift_dist = -size; + shift_dist = -((ssize_t)size); memset (vector, 0x00, sizeof vector); H5T_bit_set (vector, offset, size, 1); @@ -445,7 +445,7 @@ test_increment (void) /* Look for the one */ n = H5T_bit_find (vector, 0, 8*sizeof(vector), H5T_BIT_LSB, 1); - if (size!=1 && n!=offset+size-1) { + if (size!=1 && (size_t)n!=offset+size-1) { H5_FAILED(); printf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); @@ -529,7 +529,7 @@ test_decrement (void) /* Look for the ones */ n = H5T_bit_find (vector, 0, 8*sizeof(vector), H5T_BIT_LSB, 1); - if (n!=offset) { + if ((size_t)n!=offset) { H5_FAILED(); printf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); @@ -601,7 +601,7 @@ test_negate (void) /* Look for the ones */ n = H5T_bit_find (vector, 0, 8*sizeof(vector), H5T_BIT_LSB, 1); - if (n!=offset) { + if ((size_t)n!=offset) { H5_FAILED(); printf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); diff --git a/test/dsets.c b/test/dsets.c index 152dc97..8cdb5bf 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -791,7 +791,7 @@ test_conv_buffer(hid_t fid) cf->a[j][k][l] = 10*(j+1) + l + k; for (j = 0; j < DIM2; j++) - cf->b[j] = 100.*(j+1) + 0.01*j; + cf->b[j] = (float)(100.*(j+1) + 0.01*j); for (j = 0; j < DIM3; j++) cf->c[j] = 100.*(j+1) + 0.02*j; @@ -2964,9 +2964,10 @@ test_set_local(hid_t fapl) h5_fixname(FILENAME[5], fapl, filename, sizeof filename); /* Initialize the integer & floating-point dataset */ - for (i = n = 0; i < DSET_DIM1; i++) + n=0.0; + for (i = 0; i < DSET_DIM1; i++) for (j = 0; j < DSET_DIM2; j++) { - points[i][j] = n++; + points[i][j] = (int)n++; points_dbl[i][j] = (double)1.5*n++; } diff --git a/test/dtransform.c b/test/dtransform.c index 5e67986..9d1665b 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -47,42 +47,52 @@ int main() herr_t err; int row, col; + TESTING("data transform, setting up") + for(row = 0; row<ROWS; row++) { for(col = 0; col<COLS; col++) windchillCint[row][col] = (5/9.0)*(windchillFint[row][col] - 32); } - dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER); - dxpl_id_c_to_f = H5Pcreate(H5P_DATASET_XFER); - dxpl_id_simple = H5Pcreate(H5P_DATASET_XFER); + if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; + if((dxpl_id_c_to_f = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; + if((dxpl_id_simple = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; - err= H5Pset_data_transform(dxpl_id_f_to_c, f_to_c); - err= H5Pset_data_transform(dxpl_id_c_to_f, c_to_f); - err = H5Pset_data_transform(dxpl_id_simple, simple); + if((err= H5Pset_data_transform(dxpl_id_f_to_c, f_to_c))<0) TEST_ERROR; + if((err= H5Pset_data_transform(dxpl_id_c_to_f, c_to_f))<0) TEST_ERROR; + if((err = H5Pset_data_transform(dxpl_id_simple, simple))<0) TEST_ERROR; + + if((file_id = H5Fcreate("dtransform.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) TEST_ERROR; - file_id = H5Fcreate("dtransform.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if((dataspace = H5Screate_simple(2, dim, NULL))<0) TEST_ERROR; + + PASSED(); - dataspace = H5Screate_simple(2, dim, NULL); + TESTING("data transform, writing integer data") /* Write out the integer dataset to the file, converting it to c */ - datatype = H5Tcopy(H5T_NATIVE_INT); - dset_id_int = H5Dcreate(file_id, "/transformtest_int", datatype, dataspace, H5P_DEFAULT); - err = H5Dwrite(dset_id_int, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFint); - H5Tclose(datatype); + if((datatype = H5Tcopy(H5T_NATIVE_INT))<0) TEST_ERROR; + if((dset_id_int = H5Dcreate(file_id, "/transformtest_int", datatype, dataspace, H5P_DEFAULT))<0) TEST_ERROR; + if((err = H5Dwrite(dset_id_int, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFint))<0) TEST_ERROR; + if((err = H5Tclose(datatype))<0) TEST_ERROR; + + PASSED(); + + TESTING("data transform, writing float data") /* Write out a floating point version to the file, converting it to c */ - datatype = H5Tcopy(H5T_NATIVE_FLOAT); - dset_id_float = H5Dcreate(file_id, "/transformtest_float", datatype, dataspace, H5P_DEFAULT); - err = H5Dwrite(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFint); - H5Tclose(datatype); + if((datatype = H5Tcopy(H5T_NATIVE_FLOAT))<0) TEST_ERROR; + if((dset_id_float = H5Dcreate(file_id, "/transformtest_float", datatype, dataspace, H5P_DEFAULT))<0) TEST_ERROR; + if((err = H5Dwrite(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFint))<0) TEST_ERROR; + if((err = H5Tclose(datatype))<0) TEST_ERROR; - + PASSED(); TESTING("data transform, no data type conversion (int->int)") /* Read in the integer data with a data transform. */ - err = H5Dread(dset_id_int, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillFintread); + if((err = H5Dread(dset_id_int, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillFintread))<0) TEST_ERROR; if( (compare_int(*windchillFintread, *windchillFint, 2)) == 0) { @@ -93,7 +103,7 @@ int main() PASSED(); TESTING("data transform, no data type conversion (float->float)") - err = H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillFfloatread); + if((err = H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillFfloatread))<0) TEST_ERROR; if( (compare_float(*windchillFfloat, *windchillFfloatread, 2.0)) == 0) { fprintf(stderr, "ERROR: Conversion failed to match computed data\n"); @@ -103,7 +113,7 @@ int main() PASSED(); TESTING("data transform, with data type conversion (int->float)") - err = H5Dread(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillFfloatread); + if((err = H5Dread(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillFfloatread))<0) TEST_ERROR; if( (compare_float(*windchillFfloat, *windchillFfloatread, 2.0)) == 0) { fprintf(stderr, "ERROR: Conversion failed to match computed data\n"); @@ -113,7 +123,7 @@ int main() PASSED(); TESTING("data transform, with data type conversion (float->int)") - err = H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillFintread); + if((err = H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillFintread))<0) TEST_ERROR; if( (compare_int(*windchillFint, *windchillFintread, 2)) == 0) { fprintf(stderr, "ERROR: Conversion failed to match computed data\n"); @@ -123,7 +133,7 @@ int main() PASSED(); TESTING("data transform, trivial transform, without type conversion") - err = H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFfloatread); + if((err = H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFfloatread))<0) TEST_ERROR; for(row = 0; row<ROWS; row++) { for(col = 0; col<COLS; col++) @@ -138,7 +148,7 @@ int main() PASSED(); TESTING("data transform, trivial transform, with type conversion") - err = H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFintread); + if((err = H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFintread))<0) TEST_ERROR; for(row = 0; row<ROWS; row++) { for(col = 0; col<COLS; col++) @@ -153,12 +163,12 @@ int main() /* Close the objects we opened/created */ - err = H5Sclose(dataspace); - err = H5Dclose(dset_id_int); - err = H5Dclose(dset_id_float); - err = H5Fclose(file_id); - err = H5Pclose(dxpl_id_f_to_c); - err = H5Pclose(dxpl_id_c_to_f); + if((err = H5Sclose(dataspace))<0) TEST_ERROR; + if((err = H5Dclose(dset_id_int))<0) TEST_ERROR; + if((err = H5Dclose(dset_id_float))<0) TEST_ERROR; + if((err = H5Fclose(file_id))<0) TEST_ERROR; + if((err = H5Pclose(dxpl_id_f_to_c))<0) TEST_ERROR; + if((err = H5Pclose(dxpl_id_c_to_f))<0) TEST_ERROR; PASSED(); diff --git a/test/dtypes.c b/test/dtypes.c index 5d2297d..fc85ad3 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1488,9 +1488,9 @@ static int test_compound_9(void) { typedef struct cmpd_struct { - int i1; - const char* str; - int i2; + int i1; + char* str; + int i2; } cmpd_struct; cmpd_struct wdata = {11, "variable-length string", 22}; @@ -1593,7 +1593,7 @@ test_compound_9(void) goto error; } /* end if */ - if(rdata.i1!=wdata.i1 || rdata.i2!=wdata.i2 || strcmp(rdata.str, wdata.str)) { + if(rdata.i1!=wdata.i1 || rdata.i2!=wdata.i2 || HDstrcmp(rdata.str, wdata.str)) { H5_FAILED(); AT(); printf("incorrect read data\n"); goto error; diff --git a/test/h5test.c b/test/h5test.c index 5c21181..1338b5b 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -793,7 +793,7 @@ h5_get_file_size(const char *filename) /* Get the file's statistics */ if (HDstat(filename, &sb)>=0) - return(sb.st_size); + return((off_t)sb.st_size); return(0); } /* end get_file_size() */ diff --git a/test/ntypes.c b/test/ntypes.c index 9772bb6..952c90c 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -1577,7 +1577,7 @@ test_vl_dtype(hid_t file) tmp=malloc(t2->len*sizeof(unsigned int)); memcpy(tmp, t2->p, t2->len*H5Tget_size(nat_super_type)); - if (H5Tconvert(nat_super_type, H5T_NATIVE_UINT, (hsize_t)t2->len, tmp, NULL, H5P_DEFAULT)) + if (H5Tconvert(nat_super_type, H5T_NATIVE_UINT, t2->len, tmp, NULL, H5P_DEFAULT)) TEST_ERROR; for(k=0; k<t2->len; k++) { diff --git a/test/th5s.c b/test/th5s.c index deb2dae..f77f0cd 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -362,7 +362,7 @@ test_h5s_null(void) VERIFY(stype, H5S_NULL, "H5Sget_simple_extent_type"); /* Verify there is zero element in the dataspace */ - ret = H5Sget_simple_extent_npoints(dset_sid2); + ret = (herr_t)H5Sget_simple_extent_npoints(dset_sid2); VERIFY(ret, 0, "H5Sget_simple_extent_npoints"); /* Try reading from the dataset (make certain our buffer is unmodified) */ @@ -390,7 +390,7 @@ test_h5s_null(void) VERIFY(stype, H5S_NULL, "H5Sget_simple_extent_type"); /* Verify there is zero element in the dataspace */ - ret = H5Sget_simple_extent_npoints(attr_sid); + ret = (herr_t)H5Sget_simple_extent_npoints(attr_sid); VERIFY(ret, 0, "H5Sget_simple_extent_npoints"); /* Close the dataspace */ |