diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2015-03-04 00:27:40 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2015-03-04 00:27:40 (GMT) |
commit | 5b294640c003dac45c2cc489793950207bf63c8f (patch) | |
tree | ef451f922a5242888c2cd63552212fa278284162 /test | |
parent | dc059968de3823ffa1b0008c14b7e7e46c1fb8d8 (diff) | |
parent | 6ee9ea656fad6f408e81bd995eb465e0dd4ce0db (diff) | |
download | hdf5-5b294640c003dac45c2cc489793950207bf63c8f.zip hdf5-5b294640c003dac45c2cc489793950207bf63c8f.tar.gz hdf5-5b294640c003dac45c2cc489793950207bf63c8f.tar.bz2 |
[svn-r26350] Merge of r26273-26348 from the trunk.
Tested on: h5committest
Diffstat (limited to 'test')
-rw-r--r-- | test/cache.c | 7 | ||||
-rw-r--r-- | test/cache_api.c | 8 | ||||
-rw-r--r-- | test/cache_common.c | 4 | ||||
-rw-r--r-- | test/cross_read.c | 8 | ||||
-rw-r--r-- | test/dsets.c | 86 | ||||
-rw-r--r-- | test/dt_arith.c | 4 | ||||
-rw-r--r-- | test/dtransform.c | 2 | ||||
-rw-r--r-- | test/fheap.c | 8 | ||||
-rw-r--r-- | test/fillval.c | 8 | ||||
-rw-r--r-- | test/flush2.c | 14 | ||||
-rw-r--r-- | test/hyperslab.c | 6 | ||||
-rw-r--r-- | test/links.c | 2 | ||||
-rw-r--r-- | test/mtime.c | 2 | ||||
-rw-r--r-- | test/objcopy.c | 20 | ||||
-rw-r--r-- | test/set_extent.c | 4 | ||||
-rw-r--r-- | test/tarray.c | 10 | ||||
-rw-r--r-- | test/tattr.c | 20 | ||||
-rw-r--r-- | test/tfile.c | 4 | ||||
-rw-r--r-- | test/tgenprop.c | 4 | ||||
-rw-r--r-- | test/th5s.c | 98 | ||||
-rw-r--r-- | test/tmisc.c | 24 | ||||
-rw-r--r-- | test/tselect.c | 164 | ||||
-rw-r--r-- | test/tsohm.c | 4 | ||||
-rw-r--r-- | test/tunicode.c | 4 | ||||
-rw-r--r-- | test/tvltypes.c | 16 |
25 files changed, 401 insertions, 130 deletions
diff --git a/test/cache.c b/test/cache.c index 5ad1314..8725b31 100644 --- a/test/cache.c +++ b/test/cache.c @@ -20340,7 +20340,10 @@ check_auto_cache_resize(void) auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; - auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */ + /* NOTE: upper_hr_threshold MUST be type double (not float) + * or the cache test will fail on 64-bit systems. + */ + auto_size_ctl.upper_hr_threshold = H5_DOUBLE(0.999); /* for ease of testing */ auto_size_ctl.decrement = 0.5f; @@ -28353,7 +28356,7 @@ check_auto_cache_resize_aux_fcns(void) pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate failed.\n"; - } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5, FP_EPSILON) ) { /* i.e. hit_rate != 0.5 */ + } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5F, FP_EPSILON) ) { /* i.e. hit_rate != 0.5 */ pass = FALSE; failure_mssg = diff --git a/test/cache_api.c b/test/cache_api.c index b1ccef1..8f556be 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -2173,7 +2173,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* long int epoch_length = */ 50000, /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, /* double lower_hr_threshold = */ 0.9f, - /* double increment = */ 0.999999999999, + /* double increment = */ H5_DOUBLE(0.999999999999), /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ @@ -2532,7 +2532,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double flash_threshold = */ 0.5f, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, /* double upper_hr_threshold = */ 0.999f, - /* double decrement = */ 1.0000000001, + /* double decrement = */ H5_DOUBLE(1.0000000001), /* hbool_t apply_max_decrement = */ TRUE, /* size_t max_decrement = */ (1 * 1024 * 1024), /* int epochs_before_eviction = */ 3, @@ -2712,7 +2712,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* size_t max_decrement = */ (1 * 1024 * 1024), /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 1.00000000001, + /* double empty_reserve = */ H5_DOUBLE(1.00000000001), /* int dirty_bytes_threshold = */ (256 * 1024), /* int metadata_write_strategy = */ H5AC__DEFAULT_METADATA_WRITE_STRATEGY @@ -2776,7 +2776,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double flash_multiple = */ 2.0f, /* double flash_threshold = */ 0.5f, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 1.00000001, + /* double upper_hr_threshold = */ H5_DOUBLE(1.00000001), /* double decrement = */ 0.9f, /* hbool_t apply_max_decrement = */ TRUE, /* size_t max_decrement = */ (1 * 1024 * 1024), diff --git a/test/cache_common.c b/test/cache_common.c index 7b26714..0231a11 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -5161,7 +5161,7 @@ check_and_validate_cache_hit_rate(hid_t file_id, } else { - expected_hit_rate = 0.0; + expected_hit_rate = 0.0F; } result = H5Fget_mdc_hit_rate(file_id, &hit_rate); @@ -5171,7 +5171,7 @@ check_and_validate_cache_hit_rate(hid_t file_id, pass = FALSE; failure_mssg = "H5Fget_mdc_hit_rate() failed."; - } else if ( ! DBL_REL_EQUAL(hit_rate, expected_hit_rate, 0.00001) ) { + } else if ( ! DBL_REL_EQUAL(hit_rate, expected_hit_rate, 0.00001F) ) { pass = FALSE; failure_mssg = "unexpected hit rate."; diff --git a/test/cross_read.c b/test/cross_read.c index 2d95d15..35dd2ce 100644 --- a/test/cross_read.c +++ b/test/cross_read.c @@ -100,15 +100,15 @@ static int check_data(const char *dsetname, hid_t fid, hbool_t floating_number) for (j = 0; j < NX; j++) { for (i = 0; i < NY; i++) { data_in[j][i] = ((double)(i + j + 1))/3; - data_out[j][i] = 0; + data_out[j][i] = 0.0F; int_data_in[j][i] = i + j; int_data_out[j][i] = 0; } } for (i = 0; i < NY; i++) { - data_in[NX][i] = -2.2; - data_out[NX][i] = 0; + data_in[NX][i] = -2.2F; + data_out[NX][i] = 0.0F; int_data_in[NX][i] = -2; int_data_out[NX][i] = 0; @@ -126,7 +126,7 @@ static int check_data(const char *dsetname, hid_t fid, hbool_t floating_number) /* Check results */ for (j=0; j<(NX+1); j++) { for (i=0; i<NY; i++) { - if (!DBL_REL_EQUAL(data_out[j][i], data_in[j][i], 0.001)) { + if (!DBL_REL_EQUAL(data_out[j][i], data_in[j][i], 0.001F)) { if (!nerrors++) { H5_FAILED(); printf("element [%d][%d] is %g but should have been %g\n", diff --git a/test/dsets.c b/test/dsets.c index c782e70..3244bd6 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -2814,8 +2814,8 @@ test_nbit_float(hid_t file) /* orig_data[] are initialized to be within the range that can be represented by * dataset datatype (no precision loss during datatype conversion) */ - float orig_data[2][5] = {{(float)188384.00f, (float)19.103516f, (float)-1.0831790e9f, (float)-84.242188f, - (float)5.2045898f}, {(float)-49140.000f, (float)2350.2500f, (float)-3.2110596e-1f, (float)6.4998865e-5f, (float)-0.0000000f}}; + float orig_data[2][5] = {{188384.0f, 19.103516f, -1.0831790e9f, -84.242188f, 5.2045898f}, + {-49140.0f, 2350.25f, -3.2110596e-1f, 6.4998865e-5f, -0.0f}}; float new_data[2][5]; size_t precision, offset; size_t i, j; @@ -2926,9 +2926,21 @@ test_nbit_double(hid_t file) /* orig_data[] are initialized to be within the range that can be represented by * dataset datatype (no precision loss during datatype conversion) */ - double orig_data[2][5] = {{1.6081706885101836e+60, -255.32099170994480, - 1.2677579992621376e-61, 64568.289448797700, -1.0619721778839084e-75}, {2.1499497833454840e+56, - 6.6562295504670740e-3, -1.5747263393432150, 1.0711093225222612, -9.8971679387636870e-1}}; + double orig_data[2][5] = { + { + H5_DOUBLE(1.6081706885101836e+60), + H5_DOUBLE(-255.32099170994480), + H5_DOUBLE(1.2677579992621376e-61), + H5_DOUBLE(64568.289448797700), + H5_DOUBLE(-1.0619721778839084e-75) + }, + { + H5_DOUBLE(2.1499497833454840e+56), + H5_DOUBLE(6.6562295504670740e-3), + H5_DOUBLE(-1.5747263393432150), + H5_DOUBLE(1.0711093225222612), + H5_DOUBLE(-9.8971679387636870e-1) + }}; double new_data[2][5]; size_t precision, offset; size_t i, j; @@ -3081,7 +3093,7 @@ test_nbit_array(hid_t file) for(m = 0; m < (size_t)adims[0]; m++) for(n = 0; n < (size_t)adims[1]; n++) orig_data[i][j][m][n] = (unsigned int)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)precision)) << offset); + (long long)HDpow(2.0F, (double)precision)) << offset); PASSED(); /*---------------------------------------------------------------------- @@ -3175,8 +3187,8 @@ test_nbit_compound(hid_t file) hid_t dataset, space, dc; const hsize_t size[2] = {2, 5}; const hsize_t chunk_size[2] = {2, 5}; - const float float_val[2][5] = {{(float)188384.00, (float)19.103516, (float)-1.0831790e9, (float)-84.242188, - (float)5.2045898}, {(float)-49140.000, (float)2350.2500, (float)-3.2110596e-1, (float)6.4998865e-5, (float)-0.0000000}}; + const float float_val[2][5] = {{188384.0F, 19.103516F, -1.0831790e9F, -84.242188F, 5.2045898F}, + {-49140.0F, 2350.25F, -3.2110596e-1F, 6.4998865e-5F, -0.0F}}; atomic orig_data[2][5]; atomic new_data[2][5]; unsigned int i_mask, s_mask, c_mask; @@ -3240,11 +3252,11 @@ test_nbit_compound(hid_t file) for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { orig_data[i][j].i = (int)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); + (long long)HDpow(2.0F, (double)(precision[0]-1))) << offset[0]); orig_data[i][j].c = (char)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]); + (long long)HDpow(2.0F, (double)(precision[1]-1))) << offset[1]); orig_data[i][j].s = (short)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]); + (long long)HDpow(2.0F, (double)(precision[2]-1))) << offset[2]); orig_data[i][j].f = float_val[i][j]; /* some even-numbered integer values are negtive */ @@ -3369,8 +3381,8 @@ test_nbit_compound_2(hid_t file) hid_t dataset, space, dc; const hsize_t size[2] = {2, 5}; const hsize_t chunk_size[2] = {2, 5}; - const float float_val[2][5] = {{(float)188384.00, (float)19.103516, (float)-1.0831790e9, (float)-84.242188, - (float)5.2045898}, {(float)-49140.000, (float)2350.2500, (float)-3.2110596e-1, (float)6.4998865e-5, (float)-0.0000000}}; + const float float_val[2][5] = {{188384.0F, 19.103516F, -1.0831790e9F, -84.242188F, 5.2045898F}, + {-49140.0F, 2350.25F, -3.2110596e-1F, 6.4998865e-5F, -0.0F}}; complex orig_data[2][5]; complex new_data[2][5]; unsigned int i_mask, s_mask, c_mask, b_mask; @@ -3466,29 +3478,29 @@ test_nbit_compound_2(hid_t file) for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { orig_data[i][j].a.i = (int)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); + (long long)HDpow(2.0F, (double)(precision[0]-1))) << offset[0]); orig_data[i][j].a.c = (char)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]); + (long long)HDpow(2.0F, (double)(precision[1]-1))) << offset[1]); orig_data[i][j].a.s = (short)(-((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]); + (long long)HDpow(2.0F, (double)(precision[2]-1))) << offset[2]); orig_data[i][j].a.f = float_val[i][j]; orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)precision[3])) << offset[3]); + (long long)HDpow(2.0F, (double)precision[3])) << offset[3]); for(m = 0; m < (size_t)array_dims[0]; m++) for(n = 0; n < (size_t)array_dims[1]; n++) orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[4]-1))) << offset[4]); + (long long)HDpow(2.0F, (double)(precision[4]-1))) << offset[4]); for(m = 0; m < (size_t)array_dims[0]; m++) for(n = 0; n < (size_t)array_dims[1]; n++) { orig_data[i][j].d[m][n].i = (int)(-((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[0]-1))) << offset[0]); + (long long)HDpow(2.0F, (double)(precision[0]-1))) << offset[0]); orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[1]-1))) << offset[1]); + (long long)HDpow(2.0F, (double)(precision[1]-1))) << offset[1]); orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % - (long long)HDpow(2.0, (double)(precision[2]-1))) << offset[2]); + (long long)HDpow(2.0F, (double)(precision[2]-1))) << offset[2]); orig_data[i][j].d[m][n].f = float_val[i][j]; } } @@ -3684,7 +3696,7 @@ test_nbit_compound_3(hid_t file) /* Initialize data */ for(i = 0; i < (size_t)size[0]; i++) { HDmemset(&orig_data[i], 0, sizeof(orig_data[i])); - orig_data[i].i = HDrandom() % (long)HDpow(2.0, 17.0 - 1.0); + orig_data[i].i = HDrandom() % (long)HDpow(2.0F, 17.0F - 1.0F); HDstrcpy(orig_data[i].str, "fixed-length C string"); orig_data[i].vl_str = HDstrdup("variable-length C string"); @@ -4436,7 +4448,7 @@ test_scaleoffset_float(hid_t file) /* Initialize data */ for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { - orig_data[i][j] = (float)((HDrandom() % 100000) / (float)1000.0); + orig_data[i][j] = (float)((HDrandom() % 100000) / 1000.0F); /* even-numbered values are negtive */ if((i*size[1]+j+1)%2 == 0) @@ -4469,7 +4481,7 @@ test_scaleoffset_float(hid_t file) /* Check that the values read are the same as the values written */ for(i=0; i<(size_t)size[0]; i++) { for(j=0; j<(size_t)size[1]; j++) { - if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0, -3.0)) { + if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0F, -3.0F)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -4539,7 +4551,7 @@ test_scaleoffset_float_2(hid_t file) if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; /* Set fill value */ - fillval = 10000.0; + fillval = 10000.0F; if(H5Pset_fill_value(dc, H5T_NATIVE_FLOAT, &fillval) < 0) goto error; /* Set up to use scaleoffset filter, decimal scale factor is 3, @@ -4567,7 +4579,7 @@ test_scaleoffset_float_2(hid_t file) /* Initialize data of hyperslab */ for(j = 0; j < (size_t)size[1]; j++) { - orig_data[0][j] = (float)((HDrandom() % 100000) / (float)1000.0); + orig_data[0][j] = (float)((HDrandom() % 100000) / 1000.0F); /* even-numbered values are negtive */ if((j+1)%2 == 0) @@ -4600,7 +4612,7 @@ test_scaleoffset_float_2(hid_t file) /* Check that the values read are the same as the values written */ for(j=0; j<(size_t)size[1]; j++) { - if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0, -3.0)) { + if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0F, -3.0F)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); @@ -4678,7 +4690,7 @@ test_scaleoffset_double(hid_t file) /* Initialize data */ for(i= 0;i< (size_t)size[0]; i++) for(j = 0; j < (size_t)size[1]; j++) { - orig_data[i][j] = (HDrandom() % 10000000) / 10000000.0; + orig_data[i][j] = (HDrandom() % 10000000) / 10000000.0F; /* even-numbered values are negtive */ if((i*size[1]+j+1)%2 == 0) @@ -4711,7 +4723,7 @@ test_scaleoffset_double(hid_t file) /* Check that the values read are the same as the values written */ for(i=0; i<(size_t)size[0]; i++) { for(j=0; j<(size_t)size[1]; j++) { - if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0, -7.0)) { + if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0F, -7.0F)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -4781,7 +4793,7 @@ test_scaleoffset_double_2(hid_t file) if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; /* Set fill value */ - fillval = 10000.0; + fillval = 10000.0F; if(H5Pset_fill_value(dc, H5T_NATIVE_DOUBLE, &fillval) < 0) goto error; /* Set up to use scaleoffset filter, decimal scale factor is 7, @@ -4809,7 +4821,7 @@ test_scaleoffset_double_2(hid_t file) /* Initialize data of hyperslab */ for(j = 0; j < (size_t)size[1]; j++) { - orig_data[0][j] = (HDrandom() % 10000000) / 10000000.0; + orig_data[0][j] = (HDrandom() % 10000000) / 10000000.0F; /* even-numbered values are negtive */ if((j+1)%2 == 0) @@ -4842,7 +4854,7 @@ test_scaleoffset_double_2(hid_t file) /* Check that the values read are the same as the values written */ for(j=0; j<(size_t)size[1]; j++) { - if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0, -7.0)) { + if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0F, -7.0F)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); @@ -5609,11 +5621,11 @@ test_set_local(hid_t fapl) h5_fixname(FILENAME[5], fapl, filename, sizeof filename); /* Initialize the integer & floating-point dataset */ - n=1.0; + n=1.0F; for(i = 0; i < DSET_DIM1; i++) for(j = 0; j < DSET_DIM2; j++) { points[i][j] = (int)n++; - points_dbl[i][j] = (double)1.5*n++; + points_dbl[i][j] = (double)1.5F*n++; } /* Open file */ @@ -5807,7 +5819,7 @@ test_set_local(hid_t fapl) for(j=0; j<dims[1]; j++) { /* If the difference between two values is greater than 0.001%, they're * considered not equal. */ - if(!DBL_REL_EQUAL(points_dbl[i][j],check_dbl[i][j],0.00001)) { + if(!DBL_REL_EQUAL(points_dbl[i][j],check_dbl[i][j],0.00001F)) { H5_FAILED(); printf(" Line %d: Read different values than written.\n",__LINE__); printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); @@ -7130,7 +7142,7 @@ test_chunk_cache(hid_t fapl) /* Set new rdcc settings on fapl */ nslots_2 = nslots_1 * 2; nbytes_2 = nbytes_1 * 2; - w0_2 = w0_1 / 2.; + w0_2 = w0_1 / 2.0F; if (H5Pset_cache(fapl_local, 0, nslots_2, nbytes_2, w0_2) < 0) FAIL_STACK_ERROR h5_fixname(FILENAME[8], fapl, filename, sizeof filename); @@ -7325,7 +7337,7 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Define cache size to be smaller than chunk size */ rdcc_nelmts = BYPASS_CHUNK_DIM/5; rdcc_nbytes = sizeof(int)*BYPASS_CHUNK_DIM/5; - if(H5Pset_cache(fapl_local, 0, rdcc_nelmts, rdcc_nbytes, (double)0.0) < 0) FAIL_STACK_ERROR + if(H5Pset_cache(fapl_local, 0, rdcc_nelmts, rdcc_nbytes, 0.0F) < 0) FAIL_STACK_ERROR /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_local)) < 0) FAIL_STACK_ERROR diff --git a/test/dt_arith.c b/test/dt_arith.c index e3749bf..db38c66 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -28,7 +28,7 @@ #define NTESTELEM 10000 /* Epsilon for floating-point comparisons */ -#define FP_EPSILON 0.000001 +#define FP_EPSILON 0.000001F /* * Offset from alinged memory returned by malloc(). This can be used to test @@ -3299,7 +3299,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) if(check_expo[0]<(-(int)dst_ebias) || check_expo[1]<(-(int)dst_ebias)) { int expo_diff=check_expo[0]-check_expo[1]; int valid_bits=(int)((dst_ebias+dst_msize)+MIN(check_expo[0],check_expo[1]))-1; - double epsilon=1.0; + double epsilon=1.0F; /* Re-scale the mantissas based on any exponent difference */ if(expo_diff!=0) diff --git a/test/dtransform.c b/test/dtransform.c index 9c78043..d80c21a 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -17,7 +17,7 @@ #define ROWS 12 #define COLS 18 -#define FLOAT_TOL 0.0001 +#define FLOAT_TOL 0.0001F static int init_test(hid_t file_id); static int test_copy(const hid_t dxpl_id_c_to_f_copy, const hid_t dxpl_id_polynomial_copy); diff --git a/test/fheap.c b/test/fheap.c index 96b0673..6bcd8bf 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -16061,9 +16061,9 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* Change size of data to write */ if(u < 20) - obj_size = (size_t)(obj_size * 1.3); + obj_size = (size_t)(obj_size * 1.3F); else - obj_size = (size_t)(obj_size / 1.3); + obj_size = (size_t)(obj_size / 1.3F); } /* end for */ /* Close the fractal heap */ @@ -16110,9 +16110,9 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* Change size of data to write */ if(u < 20) - obj_size = (size_t)(obj_size * 1.3); + obj_size = (size_t)(obj_size * 1.3F); else - obj_size = (size_t)(obj_size / 1.3); + obj_size = (size_t)(obj_size / 1.3F); } /* end for */ /* Close the fractal heap */ diff --git a/test/fillval.c b/test/fillval.c index 459620d..e6e8f8e 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -909,9 +909,9 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, else if(datatype == H5T_COMPOUND) { HDmemset(buf_c, 0, ((size_t)nelmts * sizeof(comp_datatype))); for(u = 0; u < nelmts; u++) { - buf_c[u].a = (float)1111.11; + buf_c[u].a = 1111.11F; buf_c[u].x = 2222; - buf_c[u].y = 3333.3333; + buf_c[u].y = 3333.3333F; buf_c[u].z = 'd'; } if(H5Dwrite(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, buf_c) < 0) @@ -1144,7 +1144,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) * as compound type */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; HDmemset(&fill_ctype, 0, sizeof(fill_ctype)); - fill_ctype.y = 4444.4444; + fill_ctype.y = 4444.4444F; if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset11", &fill_ctype, H5D_FILL_TIME_ALLOC, layout, H5T_COMPOUND, ctype_id); @@ -1197,7 +1197,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) * as compound type */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; HDmemset(&fill_ctype, 0, sizeof(fill_ctype)); - fill_ctype.y = 4444.4444; + fill_ctype.y = 4444.4444F; if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset12", &fill_ctype, H5D_FILL_TIME_ALLOC, layout, H5T_COMPOUND, ctype_id); diff --git a/test/flush2.c b/test/flush2.c index 06dd086..8108bba 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -73,13 +73,13 @@ check_dset(hid_t file, const char* name) * 1998-11-06 ptl */ error = fabs(the_data[i][j] - (double)(hssize_t)i / ((hssize_t)j + 1)); - if(error > 0.0001) { - H5_FAILED(); - printf(" dset[%lu][%lu] = %g\n", - (unsigned long)i, (unsigned long)j, the_data[i][j]); - printf(" should be %g\n", - (double)(hssize_t)i/(hssize_t)(j+1)); - goto error; + if(error > 0.0001F) { + H5_FAILED(); + printf(" dset[%lu][%lu] = %g\n", + (unsigned long)i, (unsigned long)j, the_data[i][j]); + printf(" should be %g\n", + (double)(hssize_t)i/(hssize_t)(j+1)); + goto error; } } if(H5Dclose(dset) < 0) goto error; diff --git a/test/hyperslab.c b/test/hyperslab.c index 5e2c109..9bc085c 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -609,10 +609,10 @@ test_multifill(size_t nx) for(i = 0; i < nx; i++) { src[i].left = 1111111; - src[i].mid = 12345.6789; + src[i].mid = 12345.6789F; src[i].right = 2222222; dst[i].left = 3333333; - dst[i].mid = 98765.4321; + dst[i].mid = 98765.4321F; dst[i].right = 4444444; } /* end for */ @@ -621,7 +621,7 @@ test_multifill(size_t nx) * over and over again. */ fill.left = 55555555; - fill.mid = 3.1415927; + fill.mid = 3.1415927F; fill.right = 66666666; src_stride = 0; diff --git a/test/links.c b/test/links.c index 6119bb3..891b5e4 100644 --- a/test/links.c +++ b/test/links.c @@ -141,7 +141,7 @@ const char *FILENAME[] = { #define H5L_DIM1 100 #define H5L_DIM2 100 -#define FILTER_FILESIZE_MAX_FRACTION .9 +#define FILTER_FILESIZE_MAX_FRACTION 0.9F /* Creation order macros */ #define CORDER_GROUP_NAME "corder_group" diff --git a/test/mtime.c b/test/mtime.c index 6e00fe0..0c0c923 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -114,7 +114,7 @@ main(void) puts(" Modification times will be mantained in the file but"); puts(" cannot be queried on this system. See H5O_mtime_decode()."); return 0; - } else if(HDfabs(HDdifftime(now, oi1.ctime)) > 60.0) { + } else if(HDfabs(HDdifftime(now, oi1.ctime)) > 60.0F) { H5_FAILED(); tm = HDlocaltime(&(oi1.ctime)); HDstrftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm); diff --git a/test/objcopy.c b/test/objcopy.c index 0a1d7a0..71a7236 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -2315,7 +2315,7 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t #endif /* H5_CLEAR_MEMORY */ for(i = 0; i < DIM_SIZE_1; i++) { buf[i].a = i; - buf[i].d = 1. / (i + 1); + buf[i].d = 1.0F / (i + 1); } /* end for */ /* Initialize the filenames */ @@ -2447,9 +2447,9 @@ test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* set initial data values */ for(i = 0; i < DIM_SIZE_1; i++) { - buf1d[i] = (float)(i / 2.0); + buf1d[i] = (float)(i / 2.0F); for(j = 0; j < DIM_SIZE_2; j++) - buf2d[i][j] = (float)(i + (j / 100.0)); + buf2d[i][j] = (float)(i + (j / 100.0F)); } /* end for */ /* Initialize the filenames */ @@ -2790,9 +2790,9 @@ test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* set initial data values */ for(i = 0; i < DIM_SIZE_1; i++) { - buf1d[i] = (float)(i / 10.0); + buf1d[i] = (float)(i / 10.0F); for(j = 0; j < DIM_SIZE_2; j++) - buf2d[i][j] = (float)(i + (j / 100.0)); + buf2d[i][j] = (float)(i + (j / 100.0F)); } /* end for */ /* Initialize the filenames */ @@ -2985,7 +2985,7 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid /* set initial data values */ for (i=0; i<DIM_SIZE_1; i++) for (j=0; j<DIM_SIZE_2; j++) - buf[i][j] = (float)(100.0); /* Something easy to compress */ + buf[i][j] = 100.0F; /* Something easy to compress */ /* Initialize the filenames */ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); @@ -3114,7 +3114,7 @@ test_copy_dataset_compact(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* set initial data values */ for (i=0; i<DIM_SIZE_1; i++) for (j=0; j<DIM_SIZE_2; j++) - buf[i][j] = (float)(i+j/100.0); + buf[i][j] = (float)(i+j/100.0F); /* Initialize the filenames */ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); @@ -7591,7 +7591,7 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int)); for(j = 0; j < buf[i].b.len; j++) ((int *)buf[i].b.p)[j] = (int)(i * 10 + j); - buf[i].c = 1. / (i + 1.); + buf[i].c = 1.0F / (i + 1.0F); } /* end for */ /* Initialize the filenames */ @@ -7730,7 +7730,7 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int)); for(j = 0; j < buf[i].b.len; j++) ((int *)buf[i].b.p)[j] = (int)(i * 10 + j); - buf[i].c = 1. / (i + 1.); + buf[i].c = 1.0F / (i + 1.0F); } /* end for */ /* Initialize the filenames */ @@ -7875,7 +7875,7 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int)); for(j = 0; j < buf[i].b.len; j++) ((int *)buf[i].b.p)[j] = (int)(i * 10 + j); - buf[i].c = 1. / (i + 1.); + buf[i].c = 1.0F / (i + 1.0F); } /* end for */ /* Initialize the filenames */ diff --git a/test/set_extent.c b/test/set_extent.c index aaa6516..f6c3766 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -130,10 +130,10 @@ int main( void ) if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR /* Set chunk cache so only part of the chunks can be cached on fapl */ - if(H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75) < 0) TEST_ERROR + if(H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75F) < 0) TEST_ERROR /* Disable chunk caching on fapl2 */ - if(H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.) < 0) TEST_ERROR + if(H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.0F) < 0) TEST_ERROR /* Set the "use the latest version of the format" bounds for creating objects in the file */ if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR diff --git a/test/tarray.c b/test/tarray.c index 1a53336..e3d7c37 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -541,7 +541,7 @@ test_array_compound_atomic(void) for(i = 0; i < SPACE1_DIM1; i++) for(j = 0; j < ARRAY1_DIM1; j++) { wdata[i][j].i = i * 10 + j; - wdata[i][j].f = (float)(i * 2.5 + j); + wdata[i][j].f = (float)(i * 2.5F + j); } /* end for */ /* Create file */ @@ -745,7 +745,7 @@ test_array_compound_array(void) for(j=0; j<ARRAY1_DIM1; j++) { wdata[i][j].i=i*10+j; for(k=0; k<ARRAY1_DIM1; k++) - wdata[i][j].f[k]=(float)(i*10+j*2.5+k); + wdata[i][j].f[k]=(float)(i * 10.0F + j * 2.5F + k); } /* end for */ /* Create file */ @@ -1534,8 +1534,8 @@ test_array_bkg(void) for (j = 0; j < ALEN; j++) { cf[i].a[j] = 100*(i+1) + j; - cf[i].b[j] = (float)(100.*(i+1) + 0.01*j); - cf[i].c[j] = 100.*(i+1) + 0.02*j; + cf[i].b[j] = (float)(100.0F*(i+1) + 0.01F*j); + cf[i].c[j] = (double)(100.0F*(i+1) + 0.02F*j); } } @@ -1674,7 +1674,7 @@ test_array_bkg(void) /* -------------------------------- */ for (i=0; i< LENGTH; i++) for (j = 0; j < ALEN; j++) - cf[i].b[j]=fld[i].b[j] = (float)1.313; + cf[i].b[j]=fld[i].b[j] = 1.313F; status = H5Dwrite (dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, fld); CHECK(status, FAIL, "H5Dwrite"); diff --git a/test/tattr.c b/test/tattr.c index 2885124..57d19ff 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -97,7 +97,7 @@ int attr_data2[ATTR2_DIM1][ATTR2_DIM2]={{7614,-416},{197814,-3}}; /* Test data f #define ATTR3_DIM1 2 #define ATTR3_DIM2 2 #define ATTR3_DIM3 2 -double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{2.3,-26.1},{0.123,-10.0}},{{973.23,-0.91827},{2.0,23.0}}}; /* Test data for 3rd attribute */ +double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{2.3F,-26.1F}, {0.123F,-10.0F}},{{973.23F,-0.91827F},{2.0F,23.0F}}}; /* Test data for 3rd attribute */ #define ATTR4_NAME "Attr4" #define ATTR4_RANK 2 @@ -113,12 +113,12 @@ struct attr4_struct { int i; double d; char c; - } attr_data4[ATTR4_DIM1][ATTR4_DIM2]={{{3,-26.1,'d'},{-100000, 0.123,'3'}}, - {{-23,981724.2,'Q'},{0,2.0,'\n'}}}; /* Test data for 4th attribute */ + } attr_data4[ATTR4_DIM1][ATTR4_DIM2]={{{3,-26.1F,'d'},{-100000, 0.123F,'3'}}, + {{-23,981724.2F,'Q'},{0,2.0F,'\n'}}}; /* Test data for 4th attribute */ #define ATTR5_NAME "Attr5" #define ATTR5_RANK 0 -float attr_data5=(float)-5.123; /* Test data for 5th attribute */ +float attr_data5=-5.123F; /* Test data for 5th attribute */ #define ATTR6_RANK 3 #define ATTR6_DIM1 100 @@ -500,7 +500,7 @@ test_attr_flush(hid_t fapl) att, /* Attribute ID */ spc, /* Dataspace ID */ set; /* Dataset ID */ - double wdata=3.14159; /* Data to write */ + double wdata=3.14159F; /* Data to write */ double rdata; /* Data read in */ herr_t ret; /* Generic return value */ @@ -522,8 +522,8 @@ test_attr_flush(hid_t fapl) ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); CHECK(ret, FAIL, "H5Awrite"); - if(!DBL_ABS_EQUAL(rdata,0.0)) - TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,0.0); + if(!DBL_ABS_EQUAL(rdata,0.0F)) + TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,0.0F); ret=H5Fflush(fil, H5F_SCOPE_GLOBAL); CHECK(ret, FAIL, "H5Fflush"); @@ -531,8 +531,8 @@ test_attr_flush(hid_t fapl) ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata); CHECK(ret, FAIL, "H5Awrite"); - if(!DBL_ABS_EQUAL(rdata,0.0)) - TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,0.0); + if(!DBL_ABS_EQUAL(rdata,0.0F)) + TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,0.0F); ret=H5Awrite(att, H5T_NATIVE_DOUBLE, &wdata); CHECK(ret, FAIL, "H5Awrite"); @@ -985,7 +985,7 @@ test_attr_scalar_read(hid_t fapl) hid_t sid; /* Dataspace ID */ hid_t attr; /* Attribute ID */ H5S_class_t stype; /* Dataspace class */ - float rdata = 0.0; /* Buffer for reading 1st attribute */ + float rdata = 0.0F; /* Buffer for reading 1st attribute */ H5O_info_t oinfo; /* Object info */ herr_t ret; /* Generic return value */ diff --git a/test/tfile.c b/test/tfile.c index 5de035a..52c8fd9 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -2362,7 +2362,7 @@ test_rw_noupdate(void) diff = HDdifftime(sb2.st_mtime, sb1.st_mtime); /* Check That Timestamps Are Equal */ - if(diff > 0.0) { + if(diff > 0.0F) { /* Output message about test being performed */ MESSAGE(1, ("Testing to verify that nothing is written if nothing is changed: This test is skipped on this system because the modification time from stat is the same as the last access time (We know OpenVMS behaves in this way).\n")); } /* end if */ @@ -2395,7 +2395,7 @@ test_rw_noupdate(void) /* Ensure That Timestamps Are Equal */ diff = HDdifftime(sb2.st_mtime, sb1.st_mtime); - ret = (diff > 0.0); + ret = (diff > 0.0F); VERIFY(ret, 0, "Timestamp"); } /* end else */ } /* end test_rw_noupdate() */ diff --git a/test/tgenprop.c b/test/tgenprop.c index 004e346..d147099 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -47,7 +47,7 @@ int prop1_def=10; /* Property 1 default value */ #define PROP1_DEF_VALUE (&prop1_def) #define PROP2_NAME "Property 2" -float prop2_def=(float)3.14; /* Property 2 default value */ +float prop2_def=3.14F; /* Property 2 default value */ #define PROP2_SIZE sizeof(prop2_def) #define PROP2_DEF_VALUE (&prop2_def) @@ -57,7 +57,7 @@ char prop3_def[10]="Ten chars"; /* Property 3 default value */ #define PROP3_DEF_VALUE (&prop3_def) #define PROP4_NAME "Property 4" -double prop4_def=1.41; /* Property 4 default value */ +double prop4_def=1.41F; /* Property 4 default value */ #define PROP4_SIZE sizeof(prop4_def) #define PROP4_DEF_VALUE (&prop4_def) diff --git a/test/th5s.c b/test/th5s.c index 43ad1bb..94268a7 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -79,7 +79,7 @@ struct space4_struct { unsigned u; float f; char c2; - } space4_data={'v',987123,(float)-3.14,'g'}; /* Test data for 4th dataspace */ + } space4_data={'v',987123,-3.14F,'g'}; /* Test data for 4th dataspace */ /**************************************************************** ** @@ -1647,7 +1647,7 @@ test_h5s_chunk(void) /* Initialize float array */ for(i = 0; i < 50000; i++) for(j = 0; j < 3; j++) - chunk_data_flt[i][j] = (float)((i + 1) * 2.5 - j * 100.3); + chunk_data_flt[i][j] = (float)((i + 1) * 2.5F - j * 100.3F); status = H5Dwrite(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt); CHECK(status, FAIL, "H5Dwrite"); @@ -1683,7 +1683,7 @@ test_h5s_chunk(void) for(i=0; i<50000; i++) { for(j=0; j<3; j++) { /* Check if the two values are within 0.001% range. */ - if(!DBL_REL_EQUAL(chunk_data_dbl[i][j], chunk_data_flt[i][j], 0.00001)) + if(!DBL_REL_EQUAL(chunk_data_dbl[i][j], chunk_data_flt[i][j], 0.00001F)) TestErrPrintf("%u: chunk_data_dbl[%d][%d]=%e, chunk_data_flt[%d][%d]=%e\n", (unsigned)__LINE__, i, j, chunk_data_dbl[i][j], i, j, chunk_data_flt[i][j]); } /* end for */ } /* end for */ @@ -2207,6 +2207,97 @@ test_h5s_extent_equal(void) /**************************************************************** ** +** test_h5s_extent_copy(): Exercise extent copy code +** +****************************************************************/ +static void +test_h5s_extent_copy(void) +{ + hid_t spaces[14] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; /* Array of all dataspaces */ + hid_t tmp_space = -1; + hsize_t d1_dims1[1] = {10}, /* 1-D dimensions */ + d1_dims2[1] = {20}, + d1_dims3[1] = {H5S_UNLIMITED}; + hsize_t d2_dims1[2] = {10, 10}, /* 2-D dimensions */ + d2_dims2[2] = {20, 20}, + d2_dims3[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t d3_dims1[3] = {10, 10, 10}, /* 3-D dimensions */ + d3_dims2[3] = {20, 20, 20}, + d3_dims3[3] = {H5S_UNLIMITED, H5S_UNLIMITED, H5S_UNLIMITED}; + htri_t ext_equal; /* Whether two dataspace extents are equal */ + const unsigned num_spaces = sizeof(spaces) / sizeof(spaces[0]); + unsigned i, j; + herr_t ret; /* Generic error return */ + + /* Create dataspaces */ + spaces[0] = H5Screate(H5S_NULL); + CHECK(spaces[0], FAIL, "H5Screate"); + + spaces[1] = H5Screate(H5S_SCALAR); + CHECK(spaces[1], FAIL, "H5Screate"); + + spaces[2] = H5Screate_simple(1, d1_dims1, NULL); + CHECK(spaces[2], FAIL, "H5Screate"); + spaces[3] = H5Screate_simple(1, d1_dims2, NULL); + CHECK(spaces[3], FAIL, "H5Screate"); + spaces[4] = H5Screate_simple(1, d1_dims1, d1_dims2); + CHECK(spaces[4], FAIL, "H5Screate"); + spaces[5] = H5Screate_simple(1, d1_dims1, d1_dims3); + CHECK(spaces[5], FAIL, "H5Screate"); + + spaces[6] = H5Screate_simple(2, d2_dims1, NULL); + CHECK(spaces[6], FAIL, "H5Screate"); + spaces[7] = H5Screate_simple(2, d2_dims2, NULL); + CHECK(spaces[7], FAIL, "H5Screate"); + spaces[8] = H5Screate_simple(2, d2_dims1, d2_dims2); + CHECK(spaces[8], FAIL, "H5Screate"); + spaces[9] = H5Screate_simple(2, d2_dims1, d2_dims3); + CHECK(spaces[9], FAIL, "H5Screate"); + + spaces[10] = H5Screate_simple(3, d3_dims1, NULL); + CHECK(spaces[10], FAIL, "H5Screate"); + spaces[11] = H5Screate_simple(3, d3_dims2, NULL); + CHECK(spaces[11], FAIL, "H5Screate"); + spaces[12] = H5Screate_simple(3, d3_dims1, d3_dims2); + CHECK(spaces[12], FAIL, "H5Screate"); + spaces[13] = H5Screate_simple(3, d3_dims1, d3_dims3); + CHECK(spaces[13], FAIL, "H5Screate"); + + tmp_space = H5Screate(H5S_NULL); + CHECK(tmp_space, FAIL, "H5Screate"); + + /* Copy between all dataspace combinations. Note there are a few + * duplicates. */ + for(i = 0; i < num_spaces; i++) + for(j = i; j < num_spaces; j++) { + /* Copy from i to j, unless the inner loop just restarted, in which + * case i and j are the same, so the second call to H5Sextent_copy() + * will test copying from i/j to i/j */ + ret = H5Sextent_copy(tmp_space, spaces[j]); + CHECK(ret, FAIL, "H5Sextent_copy"); + ext_equal = H5Sextent_equal(tmp_space, spaces[j]); + VERIFY(ext_equal, TRUE, "H5Sextent_equal"); + + /* Copy from j to i */ + ret = H5Sextent_copy(tmp_space, spaces[i]); + CHECK(ret, FAIL, "H5Sextent_copy"); + ext_equal = H5Sextent_equal(tmp_space, spaces[i]); + VERIFY(ext_equal, TRUE, "H5Sextent_equal"); + } /* end for */ + + /* Close dataspaces */ + for(i = 0; i < num_spaces; i++) { + ret = H5Sclose(spaces[i]); + CHECK(ret, FAIL, "H5Sclose"); + spaces[i] = -1; + } /* end for */ + + ret = H5Sclose(tmp_space); + CHECK(ret, FAIL, "H5Sclose"); +} /* test_h5s_extent_copy() */ + +/**************************************************************** +** ** test_h5s(): Main H5S (dataspace) testing routine. ** ****************************************************************/ @@ -2230,6 +2321,7 @@ test_h5s(void) test_h5s_chunk(); /* Exercise bug fix for chunked I/O */ test_h5s_extent_equal(); /* Test extent comparison code */ + test_h5s_extent_copy(); /* Test extent copy code */ } /* test_h5s() */ diff --git a/test/tmisc.c b/test/tmisc.c index cac6b04..cffb3df 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -2427,17 +2427,17 @@ test_misc13(void) static void test_misc14(void) { - hid_t file_id; /* File ID */ - hid_t fapl; /* File access property list ID */ - hid_t DataSpace; /* Dataspace ID */ - hid_t Dataset1; /* Dataset ID #1 */ - hid_t Dataset2; /* Dataset ID #2 */ - hid_t Dataset3; /* Dataset ID #3 */ - double data1 = 5.0; /* Data to write for dataset #1 */ - double data2 = 10.0; /* Data to write for dataset #2 */ - double data3 = 15.0; /* Data to write for dataset #3 */ - double rdata; /* Data read in */ - herr_t ret; /* Generic return value */ + hid_t file_id; /* File ID */ + hid_t fapl; /* File access property list ID */ + hid_t DataSpace; /* Dataspace ID */ + hid_t Dataset1; /* Dataset ID #1 */ + hid_t Dataset2; /* Dataset ID #2 */ + hid_t Dataset3; /* Dataset ID #3 */ + double data1 = 5.0F; /* Data to write for dataset #1 */ + double data2 = 10.0F; /* Data to write for dataset #2 */ + double data3 = 15.0F; /* Data to write for dataset #3 */ + double rdata; /* Data read in */ + herr_t ret; /* Generic return value */ /* Test creating two datasets and deleting the second */ @@ -4949,7 +4949,7 @@ test_misc28(void) * bytes). */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); - ret = H5Pset_cache(fapl, MISC28_NSLOTS, MISC28_NSLOTS, MISC28_SIZE, 0.75); + ret = H5Pset_cache(fapl, MISC28_NSLOTS, MISC28_NSLOTS, MISC28_SIZE, 0.75F); CHECK(ret, FAIL, "H5Pset_cache"); /* Create the dcpl and set the chunk size */ diff --git a/test/tselect.c b/test/tselect.c index d5a1f4c..b34d095 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -162,6 +162,12 @@ /* #defines for shape same / different rank tests */ #define SS_DR_MAX_RANK 5 +/* Information for regular hyperslab query test */ +#define SPACE13_RANK 3 +#define SPACE13_DIM1 50 +#define SPACE13_DIM2 50 +#define SPACE13_DIM3 50 +#define SPACE13_NPOINTS 4 /* Location comparison function */ @@ -13069,6 +13075,161 @@ test_select_bounds(void) /**************************************************************** ** +** test_hyper_regular(): Tests query operations on regular hyperslabs +** +****************************************************************/ +static void +test_hyper_regular(void) +{ + hid_t sid; /* Dataspace ID */ + const hsize_t dims[SPACE13_RANK] = {SPACE13_DIM1, SPACE13_DIM2, SPACE13_DIM3}; /* Dataspace dimensions */ + hsize_t coord[SPACE13_NPOINTS][SPACE13_RANK]; /* Coordinates for point selection */ + hsize_t start[SPACE13_RANK]; /* The start of the hyperslab */ + hsize_t stride[SPACE13_RANK]; /* The stride between block starts for the hyperslab */ + hsize_t count[SPACE13_RANK]; /* The number of blocks for the hyperslab */ + hsize_t block[SPACE13_RANK]; /* The size of each block for the hyperslab */ + hsize_t t_start[SPACE13_RANK]; /* Temporary start of the hyperslab */ + hsize_t t_count[SPACE13_RANK]; /* Temporary number of blocks for the hyperslab */ + hsize_t q_start[SPACE13_RANK]; /* The queried start of the hyperslab */ + hsize_t q_stride[SPACE13_RANK]; /* The queried stride between block starts for the hyperslab */ + hsize_t q_count[SPACE13_RANK]; /* The queried number of blocks for the hyperslab */ + hsize_t q_block[SPACE13_RANK]; /* The queried size of each block for the hyperslab */ + htri_t is_regular; /* Whether a hyperslab selection is regular */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(6, ("Testing queries on regular hyperslabs\n")); + + /* Create dataspace */ + sid = H5Screate_simple(SPACE13_RANK, dims, NULL); + CHECK(sid, FAIL, "H5Screate_simple"); + + /* Query if 'all' selection is regular hyperslab (should fail) */ + H5E_BEGIN_TRY { + is_regular = H5Sis_regular_hyperslab(sid); + } H5E_END_TRY; + VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); + + /* Query regular hyperslab selection info (should fail) */ + H5E_BEGIN_TRY { + ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); + + /* Set 'none' selection */ + ret = H5Sselect_none(sid); + CHECK(ret, FAIL, "H5Sselect_none"); + + /* Query if 'none' selection is regular hyperslab (should fail) */ + H5E_BEGIN_TRY { + is_regular = H5Sis_regular_hyperslab(sid); + } H5E_END_TRY; + VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); + + /* Query regular hyperslab selection info (should fail) */ + H5E_BEGIN_TRY { + ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); + + /* Set point selection */ + coord[0][0] = 3; coord[0][1] = 3; coord[0][2] = 3; + coord[1][0] = 3; coord[1][1] = 48; coord[1][2] = 48; + coord[2][0] = 48; coord[2][1] = 3; coord[2][2] = 3; + coord[3][0] = 48; coord[3][1] = 48; coord[3][2] = 48; + ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)SPACE13_NPOINTS, (const hsize_t *)coord); + CHECK(ret, FAIL, "H5Sselect_elements"); + + /* Query if 'point' selection is regular hyperslab (should fail) */ + H5E_BEGIN_TRY { + is_regular = H5Sis_regular_hyperslab(sid); + } H5E_END_TRY; + VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); + + /* Query regular hyperslab selection info (should fail) */ + H5E_BEGIN_TRY { + ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); + + /* Set "regular" hyperslab selection */ + start[0] = 2; start[1] = 2; start[2] = 2; + stride[0] = 5; stride[1] = 5; stride[2] = 5; + count[0] = 3; count[1] = 3; count[2] = 3; + block[0] = 4; block[1] = 4; block[2] = 4; + ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Query if 'hyperslab' selection is regular hyperslab (should be TRUE) */ + is_regular = H5Sis_regular_hyperslab(sid); + VERIFY(is_regular, TRUE, "H5Sis_regular_hyperslab"); + + /* Retrieve the hyperslab parameters */ + ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); + CHECK(ret, FAIL, "H5Sget_regular_hyperslab"); + + /* Verify the hyperslab parameters */ + for(u = 0; u < SPACE13_RANK; u++) { + if(start[u] != q_start[u]) + ERROR("H5Sget_regular_hyperslab, start"); + if(stride[u] != q_stride[u]) + ERROR("H5Sget_regular_hyperslab, stride"); + if(count[u] != q_count[u]) + ERROR("H5Sget_regular_hyperslab, count"); + if(block[u] != q_block[u]) + ERROR("H5Sget_regular_hyperslab, block"); + } /* end for */ + + /* 'OR' in another point */ + t_start[0] = 0; t_start[1] = 0; t_start[2] = 0; + t_count[0] = 1; t_count[1] = 1; t_count[2] = 1; + ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, t_start, NULL, t_count, NULL); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Query if 'hyperslab' selection is regular hyperslab (should be FALSE) */ + is_regular = H5Sis_regular_hyperslab(sid); + VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab"); + + /* Query regular hyperslab selection info (should fail) */ + H5E_BEGIN_TRY { + ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); + + /* 'XOR' in the point again, to remove it, which should make it regular again */ + t_start[0] = 0; t_start[1] = 0; t_start[2] = 0; + t_count[0] = 1; t_count[1] = 1; t_count[2] = 1; + ret = H5Sselect_hyperslab(sid, H5S_SELECT_XOR, t_start, NULL, t_count, NULL); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Query if 'hyperslab' selection is regular hyperslab (should be TRUE) */ + is_regular = H5Sis_regular_hyperslab(sid); + VERIFY(is_regular, TRUE, "H5Sis_regular_hyperslab"); + + /* Retrieve the hyperslab parameters */ + ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); + CHECK(ret, FAIL, "H5Sget_regular_hyperslab"); + + /* Verify the hyperslab parameters */ + for(u = 0; u < SPACE13_RANK; u++) { + if(start[u] != q_start[u]) + ERROR("H5Sget_regular_hyperslab, start"); + if(stride[u] != q_stride[u]) + ERROR("H5Sget_regular_hyperslab, stride"); + if(count[u] != q_count[u]) + ERROR("H5Sget_regular_hyperslab, count"); + if(block[u] != q_block[u]) + ERROR("H5Sget_regular_hyperslab, block"); + } /* end for */ + + /* Close the dataspace */ + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); +} /* test_hyper_regular() */ + +/**************************************************************** +** ** test_select(): Main H5S selection testing routine. ** ****************************************************************/ @@ -13228,6 +13389,9 @@ test_select(void) /* Test selection bounds with & without offsets */ test_select_bounds(); + /* Test 'regular' hyperslab query routines */ + test_hyper_regular(); + } /* test_select() */ diff --git a/test/tsohm.c b/test/tsohm.c index 8ebfd52..9da655e 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -57,7 +57,7 @@ const unsigned test_minsizes[H5O_SHMESG_MAX_NINDEXES] = {0, 2, 40, 100, 3, 1000} #define NAME_BUF_SIZE 512 /* How much overhead counts as "not much" when converting B-trees, etc. */ -#define OVERHEAD_ALLOWED 1.15 +#define OVERHEAD_ALLOWED 1.15F #define NUM_DATASETS 10 #define NUM_ATTRIBUTES 100 @@ -600,7 +600,7 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos wdata.i6 = 66; wdata.i7 = 77; wdata.i8 = 88; - wdata.f1 = 0.0; + wdata.f1 = 0.0F; /* Intialize rdata */ HDmemset(&rdata, 0, sizeof(rdata)); diff --git a/test/tunicode.c b/test/tunicode.c index 7dc3391..82dc429 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -39,8 +39,8 @@ #define RANK 1 #define COMP_INT_VAL 7 -#define COMP_FLOAT_VAL -42.0 -#define COMP_DOUBLE_VAL 42.0 +#define COMP_FLOAT_VAL -42.0F +#define COMP_DOUBLE_VAL 42.0F /* Test function prototypes */ void test_fl_string(hid_t fid, const char *string); diff --git a/test/tvltypes.c b/test/tvltypes.c index 516974e..2928e57 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -731,7 +731,7 @@ test_vltypes_vlen_compound(void) wdata[i].len=i+1; for(j=0; j<(i+1); j++) { ((s1 *)wdata[i].p)[j].i=i*10+j; - ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0); + ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0F); } /* end for */ } /* end for */ @@ -877,7 +877,7 @@ rewrite_vltypes_vlen_compound(void) wdata[i].len = i + increment; for(j = 0; j < (i + increment); j++) { ((s1 *)wdata[i].p)[j].i = i * 40 + j; - ((s1 *)wdata[i].p)[j].f = (float)((i * 60 + j) / 3.0); + ((s1 *)wdata[i].p)[j].f = (float)((i * 60 + j) / 3.0F); } /* end for */ } /* end for */ @@ -1018,7 +1018,7 @@ test_vltypes_compound_vlen_vlen(void) /* Allocate and initialize VL data to write */ for(i=0; i<SPACE3_DIM1; i++) { wdata[i].i=i*10; - wdata[i].f=(float)((i*20)/3.0); + wdata[i].f=(float)((i*20)/3.0F); wdata[i].v.p=HDmalloc((i+L1_INCM)*sizeof(hvl_t)); wdata[i].v.len=i+L1_INCM; for(t1=(wdata[i].v).p,j=0; j<(i+L1_INCM); j++, t1++) { @@ -1479,7 +1479,7 @@ test_vltypes_compound_vlen_atomic(void) /* Allocate and initialize VL data to write */ for(i=0; i<SPACE1_DIM1; i++) { wdata[i].i=i*10; - wdata[i].f=(float)((i*20)/3.0); + wdata[i].f=(float)((i*20)/3.0F); wdata[i].v.p=HDmalloc((i+1)*sizeof(unsigned int)); wdata[i].v.len=i+1; for(j=0; j<(i+1); j++) @@ -1595,7 +1595,7 @@ test_vltypes_compound_vlen_atomic(void) /* Check data read in */ for(i = 0; i < SPACE1_DIM1; i++) - if(rdata[i].i != 0 || !FLT_ABS_EQUAL(rdata[i].f, 0.0) || rdata[i].v.len != 0 || rdata[i].v.p != NULL) + if(rdata[i].i != 0 || !FLT_ABS_EQUAL(rdata[i].f, 0.0F) || rdata[i].v.len != 0 || rdata[i].v.p != NULL) TestErrPrintf("VL doesn't match!, rdata[%d].i=%d, rdata[%d].f=%f, rdata[%d].v.len=%u, rdata[%d].v.p=%p\n",(int)i,rdata[i].i,(int)i,rdata[i].f,(int)i,(unsigned)rdata[i].v.len,(int)i,rdata[i].v.p); /* Write dataset to disk */ @@ -1697,7 +1697,7 @@ rewrite_vltypes_compound_vlen_atomic(void) /* Allocate and initialize VL data to write */ for(i = 0; i < SPACE1_DIM1; i++) { wdata[i].i = i * 40; - wdata[i].f = (float)((i * 50) / 3.0); + wdata[i].f = (float)((i * 50) / 3.0F); wdata[i].v.p = HDmalloc((i + increment) * sizeof(unsigned int)); wdata[i].v.len = i + increment; for(j = 0; j < (i + increment); j++) @@ -2430,8 +2430,8 @@ test_vltypes_fill_value(void) hsize_t small_dims[] = {SPACE4_DIM_SMALL}; hsize_t large_dims[] = {SPACE4_DIM_LARGE}; size_t dset_elmts; /* Number of elements in a particular dataset */ - const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead", 3, 4.0, 100.0, 1.0, "liquid", "meter"}; - const dtype1_struct wdata = {3, 4, "", NULL, "\0", "foo", "two", 6, 8.0, 200.0, 2.0, "solid", "yard"}; + const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead", 3, 4.0F, 100.0F, 1.0F, "liquid", "meter"}; + const dtype1_struct wdata = {3, 4, "", NULL, "\0", "foo", "two", 6, 8.0F, 200.0F, 2.0F, "solid", "yard"}; dtype1_struct *rbuf = NULL; /* Buffer for reading data */ size_t mem_used = 0; /* Memory used during allocation */ H5D_layout_t layout; /* Dataset storage layout */ |