diff options
author | Xiaowen Wu <wuxiaowe@ncsa.uiuc.edu> | 2005-01-31 15:14:01 (GMT) |
---|---|---|
committer | Xiaowen Wu <wuxiaowe@ncsa.uiuc.edu> | 2005-01-31 15:14:01 (GMT) |
commit | 3926845f87c72bf5348f6a73e627654fc5035645 (patch) | |
tree | ea2266298d15fc099f91e6728bab7e4814d146c6 | |
parent | 5e057c32bd6564e3e9c845ac18bd4354f4db0a29 (diff) | |
download | hdf5-3926845f87c72bf5348f6a73e627654fc5035645.zip hdf5-3926845f87c72bf5348f6a73e627654fc5035645.tar.gz hdf5-3926845f87c72bf5348f6a73e627654fc5035645.tar.bz2 |
[svn-r9895] Purpose:
Add test cases of nbit filter, tests are now turned on
Description:
Six test cases are added for testing the nbit filter with different
datatypes including int, float, double, array datatype, a simple
compound datatype and a complex compound datatype. Improvements are
made to testing of int and floating point.
Solution:
Platforms tested:
AIX 5.1 and Linux 2.4.
Misc. update:
-rw-r--r-- | test/dsets.c | 746 |
1 files changed, 427 insertions, 319 deletions
diff --git a/test/dsets.c b/test/dsets.c index 851b68f..c647f39 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -75,11 +75,11 @@ const char *FILENAME[] = { #define DSET_SET_LOCAL_NAME_2 "set_local_2" #define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle" #define DSET_NBIT_INT_NAME "nbit_int" +#define DSET_NBIT_FLOAT_NAME "nbit_float" +#define DSET_NBIT_DOUBLE_NAME "nbit_double" #define DSET_NBIT_ARRAY_NAME "nbit_array" -#define DSET_NBIT_ARRAY_NAME_2 "nbit_array_2" #define DSET_NBIT_COMPOUND_NAME "nbit_compound" #define DSET_NBIT_COMPOUND_NAME_2 "nbit_compound_2" -#define DSET_NBIT_FLOAT_NAME "nbit_float" #define DSET_COMPARE_DCPL_NAME "compare_dcpl" #define DSET_COMPARE_DCPL_NAME_2 "compare_dcpl_2" @@ -2394,7 +2394,7 @@ error: * Failure: -1 * * Programmer: Kent Yang - * Wednesday, , 2002 Nov. 13th + * Wednesday, Nov. 13th, 2002 * * Modifications: * @@ -2512,7 +2512,7 @@ error: * Failure: -1 * * Programmer: Xiaowen Wu - * Wednesday, , 2004 Dec. 23th + * Wednesday, Dec. 23th, 2004 * * Modifications: * @@ -2527,17 +2527,19 @@ test_nbit_int(hid_t file) const hsize_t chunk_size[2] = {2,5}; int orig_data[2][5]; int new_data[2][5]; + unsigned int mask; size_t precision, offset; hsize_t i, j; #else /* H5_HAVE_FILTER_NBIT */ const char *not_supported= " Nbit is not enabled."; #endif /* H5_HAVE_FILTER_NBIT */ - TESTING("nbit int (setup)"); + puts("Testing nbit filter"); + TESTING(" nbit int (setup)"); #ifdef H5_HAVE_FILTER_NBIT /* Define dataset datatype (integer), and set precision, offset */ datatype = H5Tcopy(H5T_NATIVE_INT); - precision = 16; + precision = 17; /* precision includes sign bit */ if(H5Tset_precision(datatype,precision)<0) goto error; offset = 4; if(H5Tset_offset(datatype,offset)<0) goto error; @@ -2554,28 +2556,150 @@ test_nbit_int(hid_t file) /* Use nbit filter */ if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error; if (H5Pset_chunk(dc, 2, chunk_size)<0) goto error; - /*if (H5Pset_nbit(dc)<0) goto error;*/ + if (H5Pset_nbit(dc)<0) goto error; /* Create the dataset */ if ((dataset = H5Dcreate(file, DSET_NBIT_INT_NAME, datatype, space,dc))<0) goto error; + /* Initialize data, assuming size of long_long >= size of int */ for (i= 0;i< size[0]; i++) - for (j = 0; j < size[1]; j++) + for (j = 0; j < size[1]; j++) { orig_data[i][j] = ((long_long)HDrandom() % (long_long)HDpow(2, precision - 1)) << offset; + /* even-numbered values are negtive */ + if((i*size[1]+j+1)%2 == 0) + orig_data[i][j] = -orig_data[i][j]; + } - /*printf("\n"); - for (i= 0;i< size[0]; i++) - for (j = 0; j < size[1]; j++) { - printf("orig[%d]", i); printf("[%d]: ", j); - printf("%08x ", orig_data[i][j]); - if((i*size[1]+j+1)%4 == 0) printf("\n"); - } - printf("\n"); */ + PASSED(); +#else + SKIPPED(); + puts(not_supported); +#endif + /*---------------------------------------------------------------------- + * STEP 1: Test nbit by setting up a chunked dataset and writing + * to it. + *---------------------------------------------------------------------- + */ + TESTING(" nbit int (write)"); + +#ifdef H5_HAVE_FILTER_NBIT + if (H5Dwrite(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, + orig_data)<0) + goto error; + PASSED(); +#else + SKIPPED(); + puts(not_supported); +#endif + + /*---------------------------------------------------------------------- + * STEP 2: Try to read the data we just wrote. + *---------------------------------------------------------------------- + */ + TESTING(" nbit int (read)"); + +#ifdef H5_HAVE_FILTER_NBIT + /* Read the dataset back */ + if (H5Dread(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, + new_data)<0) + goto error; + + /* Check that the values read are the same as the values written + * Use mask for checking the significant bits, ignoring the padding bits + */ + mask = ~(~0 << (precision + offset)) & (~0 << offset); + for (i=0; i<size[0]; i++) { + for (j=0; j<size[1]; j++) { + if ((new_data[i][j] & mask) != (orig_data[i][j] & mask)) { + H5_FAILED(); + printf(" Read different values than written.\n"); + printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + goto error; + } + } + } + /*---------------------------------------------------------------------- + * Cleanup + *---------------------------------------------------------------------- + */ + if (H5Tclose(datatype)<0) goto error; + if (H5Tclose(mem_datatype)<0) goto error; + if (H5Pclose (dc)<0) goto error; + if (H5Dclose(dataset)<0) goto error; + + PASSED(); +#else + SKIPPED(); + puts(not_supported); +#endif + return 0; +error: + return -1; +} + + +/*------------------------------------------------------------------------- + * Function: test_nbit_float + * + * Purpose: Tests the float datatype of nbit filter + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Xiaowen Wu + * Friday, Jan. 21th, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +test_nbit_float(hid_t file) +{ +#ifdef H5_HAVE_FILTER_NBIT + hid_t dataset, datatype, space, dc; + const hsize_t size[2] = {2, 5}; + const hsize_t chunk_size[2] = {2, 5}; + /* 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] = {{188384.00, 19.103516, -1.0831790e9, -84.242188, + 5.2045898}, {-49140.000, 2350.2500, -3.2110596e-1, 6.4998865e-5, -0.0000000}}; + float new_data[2][5]; + size_t precision, offset; + hsize_t i, j; +#else /* H5_HAVE_FILTER_NBIT */ + const char *not_supported= " Nbit is not enabled."; +#endif /* H5_HAVE_FILTER_NBIT */ + + TESTING(" nbit float (setup)"); +#ifdef H5_HAVE_FILTER_NBIT + /* Define user-defined single-precision floating-point type for dataset */ + datatype = H5Tcopy(H5T_IEEE_F32BE); + if(H5Tset_fields(datatype, 26, 20, 6, 7, 13)<0) goto error; + offset = 7; + if(H5Tset_offset(datatype,offset)<0) goto error; + precision = 20; + if(H5Tset_precision(datatype,precision)<0) goto error; + if(H5Tset_size(datatype, 4)<0) goto error; + if(H5Tset_ebias(datatype, 31)<0) goto error; + + /* Create the data space */ + if ((space = H5Screate_simple(2, size, NULL))<0) goto error; + + /* Use nbit filter */ + if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error; + if (H5Pset_chunk(dc, 2, chunk_size)<0) goto error; + if (H5Pset_nbit(dc)<0) goto error; + + /* Create the dataset */ + if ((dataset = H5Dcreate(file, DSET_NBIT_FLOAT_NAME, datatype, + space,dc))<0) goto error; PASSED(); - /*printf("*** Dataset datatype precision is %d, offset is %d\n", precision, offset);*/ #else SKIPPED(); puts(not_supported); @@ -2586,12 +2710,13 @@ test_nbit_int(hid_t file) * to it. *---------------------------------------------------------------------- */ - TESTING("nbit int (write)"); + TESTING(" nbit float (write)"); #ifdef H5_HAVE_FILTER_NBIT - if (H5Dwrite(dataset, mem_datatype /*H5T_NATIVE_UINT*/, H5S_ALL, H5S_ALL, H5P_DEFAULT, + if (H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data)<0) goto error; + PASSED(); #else SKIPPED(); @@ -2602,26 +2727,26 @@ test_nbit_int(hid_t file) * STEP 2: Try to read the data we just wrote. *---------------------------------------------------------------------- */ - TESTING("nbit int (read)"); + TESTING(" nbit float (read)"); #ifdef H5_HAVE_FILTER_NBIT /* Read the dataset back */ - if (H5Dread(dataset, mem_datatype /*H5T_NATIVE_UINT*/, H5S_ALL, H5S_ALL, H5P_DEFAULT, + if (H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data)<0) goto error; - /* Check that the values read are the same as the values written */ - /*printf("\n");*/ + /* Check that the values read are the same as the values written + * Assume size of int = size of float + */ for (i=0; i<size[0]; i++) { for (j=0; j<size[1]; j++) { + if (!(orig_data[i][j]==orig_data[i][j])) continue; /* skip if value is NaN */ if (new_data[i][j] != orig_data[i][j]) { H5_FAILED(); printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", - (unsigned long)i, (unsigned long)j); - /*printf(" orig: %08x new: %08x\n", orig_data[i][j], new_data[i][j]);*/ - goto error; - } /*else*/ + printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + goto error; + } } } @@ -2629,9 +2754,139 @@ test_nbit_int(hid_t file) * Cleanup *---------------------------------------------------------------------- */ + if (H5Tclose(datatype)<0) goto error; + if (H5Pclose (dc)<0) goto error; + if (H5Dclose(dataset)<0) goto error; + + PASSED(); +#else + SKIPPED(); + puts(not_supported); +#endif + + return 0; + +error: + return -1; +} + +/*------------------------------------------------------------------------- + * Function: test_nbit_double + * + * Purpose: Tests the double datatype of nbit filter + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Xiaowen Wu + * Wednesday, Jan. 26th, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +test_nbit_double(hid_t file) +{ +/* assume unsigned int and float has the same number of bytes */ +#ifdef H5_HAVE_FILTER_NBIT + hid_t dataset, datatype, space, dc; + const hsize_t size[2] = {2, 5}; + const hsize_t chunk_size[2] = {2, 5}; + /* 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 new_data[2][5]; + size_t precision, offset; + hsize_t i, j; +#else /* H5_HAVE_FILTER_NBIT */ + const char *not_supported= " Nbit is not enabled."; +#endif /* H5_HAVE_FILTER_NBIT */ + + TESTING(" nbit double (setup)"); +#ifdef H5_HAVE_FILTER_NBIT + /* Define user-defined doule-precision floating-point type for dataset */ + datatype = H5Tcopy(H5T_IEEE_F64BE); + if(H5Tset_fields(datatype, 55, 46, 9, 5, 41)<0) goto error; + offset = 5; + if(H5Tset_offset(datatype,offset)<0) goto error; + precision = 51; + if(H5Tset_precision(datatype,precision)<0) goto error; + if(H5Tset_size(datatype, 8)<0) goto error; + if(H5Tset_ebias(datatype, 255)<0) goto error; + + /* Create the data space */ + if ((space = H5Screate_simple(2, size, NULL))<0) goto error; + + /* Use nbit filter */ + if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error; + if (H5Pset_chunk(dc, 2, chunk_size)<0) goto error; + if (H5Pset_nbit(dc)<0) goto error; + + /* Create the dataset */ + if ((dataset = H5Dcreate(file, DSET_NBIT_DOUBLE_NAME, datatype, + space, dc))<0) goto error; + + PASSED(); +#else + SKIPPED(); + puts(not_supported); +#endif + + /*---------------------------------------------------------------------- + * STEP 1: Test nbit by setting up a chunked dataset and writing + * to it. + *---------------------------------------------------------------------- + */ + TESTING(" nbit double (write)"); + +#ifdef H5_HAVE_FILTER_NBIT + if (H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, + orig_data)<0) + goto error; + PASSED(); +#else + SKIPPED(); + puts(not_supported); +#endif + + /*---------------------------------------------------------------------- + * STEP 2: Try to read the data we just wrote. + *---------------------------------------------------------------------- + */ + TESTING(" nbit double (read)"); + +#ifdef H5_HAVE_FILTER_NBIT + /* Read the dataset back */ + if (H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, + new_data)<0) + goto error; + + /* Check that the values read are the same as the values written + * Assume size of long_long = size of double + */ + for (i=0; i<size[0]; i++) { + for (j=0; j<size[1]; j++) { + if (!(orig_data[i][j]==orig_data[i][j])) continue; /* skip if value is NaN */ + if (new_data[i][j] != orig_data[i][j]) { + H5_FAILED(); + printf(" Read different values than written.\n"); + printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + goto error; + } + } + } + + /*---------------------------------------------------------------------- + * Cleanup + *---------------------------------------------------------------------- + */ if (H5Tclose(datatype)<0) goto error; - if (H5Tclose(mem_datatype)<0) goto error; if (H5Pclose (dc)<0) goto error; if (H5Dclose(dataset)<0) goto error; @@ -2640,6 +2895,7 @@ test_nbit_int(hid_t file) SKIPPED(); puts(not_supported); #endif + return 0; error: @@ -2657,7 +2913,7 @@ error: * Failure: -1 * * Programmer: Xiaowen Wu - * Wednesday, , 2004 Dec. 23th + * Tuesday, Jan. 18th, 2005 * * Modifications: * @@ -2670,17 +2926,18 @@ test_nbit_array(hid_t file) hid_t dataset, base_datatype, array_datatype, space, dc; hid_t mem_base_datatype, mem_array_datatype; const hsize_t size[2] = {2, 5}; - const hsize_t adims[] = {3, 2}; + const hsize_t adims[2] = {3, 2}; const hsize_t chunk_size[2] = {2,5}; unsigned int orig_data[2][5][3][2]; unsigned int new_data[2][5][3][2]; + unsigned int mask; size_t precision, offset; hsize_t i, j, m, n; #else /* H5_HAVE_FILTER_NBIT */ const char *not_supported= " Nbit is not enabled."; #endif /* H5_HAVE_FILTER_NBIT */ - TESTING("nbit array (setup)"); + TESTING(" nbit array (setup)"); #ifdef H5_HAVE_FILTER_NBIT /* Define dataset array datatype's base datatype and set precision, offset */ base_datatype = H5Tcopy(H5T_NATIVE_UINT); @@ -2713,26 +2970,13 @@ test_nbit_array(hid_t file) if ((dataset = H5Dcreate(file, DSET_NBIT_ARRAY_NAME, array_datatype, space,dc))<0) goto error; + /* Initialize data, assuming size of long_long >= size of unsigned int */ for (i= 0;i< size[0]; i++) for (j = 0; j < size[1]; j++) for (m = 0; m < adims[0]; m++) for (n = 0; n < adims[1]; n++) orig_data[i][j][m][n] = ((long_long)HDrandom() % (long_long)HDpow(2, precision)) << offset; - /* - printf("\n"); - for (i= 0;i< size[0]; i++) - for (j = 0; j < size[1]; j++) - for (m = 0; m < adims[0]; m++) - for (n = 0; n < adims[1]; n++) { - printf("orig[%d]", i); printf("[%d]", j); - printf("[%d]", m); printf("[%d]: ", n); - printf("%08x ", orig_data[i][j][m][n]); - if((i*size[1]*adims[0]*adims[1]+j*adims[0]*adims[1]+m*adims[1]+n+1)%3 == 0) - printf("\n"); - } - printf("\n");*/ - PASSED(); #else SKIPPED(); @@ -2744,10 +2988,10 @@ test_nbit_array(hid_t file) * to it. *---------------------------------------------------------------------- */ - TESTING("nbit array (write)"); + TESTING(" nbit array (write)"); #ifdef H5_HAVE_FILTER_NBIT - if (H5Dwrite(dataset, mem_array_datatype/*H5T_NATIVE_UINT*/, H5S_ALL, H5S_ALL, H5P_DEFAULT, + if (H5Dwrite(dataset, mem_array_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data)<0) goto error; @@ -2761,16 +3005,18 @@ test_nbit_array(hid_t file) * STEP 2: Try to read the data we just wrote. *---------------------------------------------------------------------- */ - TESTING("nbit array (read)"); + TESTING(" nbit array (read)"); #ifdef H5_HAVE_FILTER_NBIT /* Read the dataset back */ - if (H5Dread(dataset, mem_array_datatype/*H5T_NATIVE_UINT*/, H5S_ALL, H5S_ALL, H5P_DEFAULT, + if (H5Dread(dataset, mem_array_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data)<0) goto error; - /* Check that the values read are the same as the values written */ - /*printf("\n");*/ + /* Check that the values read are the same as the values written + * Use mask for checking the significant bits, ignoring the padding bits + */ + mask = ~(~0 << (precision + offset)) & (~0 << offset); for (i=0; i<size[0]; i++) for (j=0; j<size[1]; j++) for (m = 0; m < adims[0]; m++) @@ -2781,15 +3027,13 @@ test_nbit_array(hid_t file) printf(" At index %lu,%lu,%lu,%lu\n", (unsigned long)i, (unsigned long)j, (unsigned long)m, (unsigned long)n); goto error; - } /*else - printf(" orig: %08x new: %08x\n", orig_data[i][j][m][n], new_data[i][j][m][n]);*/ + } } /*---------------------------------------------------------------------- * Cleanup *---------------------------------------------------------------------- */ - if (H5Tclose(array_datatype)<0) goto error; if (H5Tclose(base_datatype)<0) goto error; if (H5Tclose(mem_array_datatype)<0) goto error; @@ -2802,7 +3046,6 @@ test_nbit_array(hid_t file) SKIPPED(); puts(not_supported); #endif - return 0; error: @@ -2820,7 +3063,7 @@ error: * Failure: -1 * * Programmer: Xiaowen Wu - * Wednesday, , 2004 Dec. 23th + * Tuesday, Jan. 18th, 2005 * * Modifications: * @@ -2834,31 +3077,36 @@ test_nbit_compound(hid_t file) int i; char c; short s; + float f; } atomic; - hid_t i_tid, c_tid, s_tid; - hid_t cmpd_tid1; /* atomic compound datatype */ - hid_t mem_cmpd_tid1; /* memory atomic compound datatype */ + hid_t i_tid, c_tid, s_tid, f_tid; + hid_t cmpd_tid; /* atomic compound datatype */ + hid_t mem_cmpd_tid; /* memory atomic compound datatype */ size_t precision[3] = {15, 7, 10}; size_t offset[3] = {9, 0, 3}; hid_t dataset, space, dc; const hsize_t size[2] = {2, 5}; - const hsize_t chunk_size[2] = {2,5}; + const hsize_t chunk_size[2] = {2, 5}; + const float float_val[2][5] = {{188384.00, 19.103516, -1.0831790e9, -84.242188, + 5.2045898}, {-49140.000, 2350.2500, -3.2110596e-1, 6.4998865e-5, -0.0000000}}; atomic orig_data[2][5]; atomic new_data[2][5]; + unsigned int i_mask, s_mask, c_mask; hsize_t i, j; #else /* H5_HAVE_FILTER_NBIT */ const char *not_supported= " Nbit is not enabled."; #endif /* H5_HAVE_FILTER_NBIT */ - TESTING("nbit compound (setup)"); + TESTING(" nbit compound (setup)"); #ifdef H5_HAVE_FILTER_NBIT /* Define datatypes of members of compound datatype */ i_tid=H5Tcopy(H5T_NATIVE_INT); c_tid=H5Tcopy(H5T_NATIVE_CHAR); s_tid=H5Tcopy(H5T_NATIVE_SHORT); + f_tid=H5Tcopy(H5T_IEEE_F32BE); - /* Set precision and offset */ + /* Set precision and offset etc. */ if(H5Tset_precision(i_tid,precision[0])<0) goto error; if(H5Tset_offset(i_tid,offset[0])<0) goto error; @@ -2868,22 +3116,30 @@ test_nbit_compound(hid_t file) if(H5Tset_precision(s_tid,precision[2])<0) goto error; if(H5Tset_offset(s_tid,offset[2])<0) goto error; - /* Create a memory compound datatype before setting the order */ - mem_cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic)); - if(H5Tinsert(mem_cmpd_tid1, "i", HOFFSET(atomic, i), i_tid)<0) goto error; - if(H5Tinsert(mem_cmpd_tid1, "c", HOFFSET(atomic, c), c_tid)<0) goto error; - if(H5Tinsert(mem_cmpd_tid1, "s", HOFFSET(atomic, s), s_tid)<0) goto error; + if(H5Tset_fields(f_tid, 26, 20, 6, 7, 13)<0) goto error; + if(H5Tset_offset(f_tid, 7)<0) goto error; + if(H5Tset_precision(f_tid, 20)<0) goto error; + if(H5Tset_size(f_tid, 4)<0) goto error; + if(H5Tset_ebias(f_tid, 31)<0) goto error; + /* Create a memory compound datatype before setting the order */ + mem_cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic)); + if(H5Tinsert(mem_cmpd_tid, "i", HOFFSET(atomic, i), i_tid)<0) goto error; + if(H5Tinsert(mem_cmpd_tid, "c", HOFFSET(atomic, c), c_tid)<0) goto error; + if(H5Tinsert(mem_cmpd_tid, "s", HOFFSET(atomic, s), s_tid)<0) goto error; + if(H5Tinsert(mem_cmpd_tid, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT)<0) goto error; + /* Set order of dataset compound member datatype */ if(H5Tset_order(i_tid, H5T_ORDER_BE)<0) goto error; if(H5Tset_order(c_tid, H5T_ORDER_BE)<0) goto error; if(H5Tset_order(s_tid, H5T_ORDER_BE)<0) goto error; /* Create a dataset compound datatype and insert some atomic types */ - cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic)); - if(H5Tinsert(cmpd_tid1, "i", HOFFSET(atomic, i), i_tid)<0) goto error; - if(H5Tinsert(cmpd_tid1, "c", HOFFSET(atomic, c), c_tid)<0) goto error; - if(H5Tinsert(cmpd_tid1, "s", HOFFSET(atomic, s), s_tid)<0) goto error; + cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic)); + if(H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid)<0) goto error; + if(H5Tinsert(cmpd_tid, "c", HOFFSET(atomic, c), c_tid)<0) goto error; + if(H5Tinsert(cmpd_tid, "s", HOFFSET(atomic, s), s_tid)<0) goto error; + if(H5Tinsert(cmpd_tid, "f", HOFFSET(atomic, f), f_tid)<0) goto error; /* Create the data space */ if ((space = H5Screate_simple(2, size, NULL))<0) goto error; @@ -2891,31 +3147,29 @@ test_nbit_compound(hid_t file) /* Use nbit filter */ if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error; if (H5Pset_chunk(dc, 2, chunk_size)<0) goto error; - if (H5Pset_nbit(dc)<0) goto error; + if (H5Pset_nbit(dc)<0) goto error; /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_NBIT_COMPOUND_NAME, cmpd_tid1, + if ((dataset = H5Dcreate(file, DSET_NBIT_COMPOUND_NAME, cmpd_tid, space,dc))<0) goto error; + /* Initialize data, assuming size of long_long >= size of member datatypes */ for (i= 0;i< size[0]; i++) for (j = 0; j < size[1]; j++) { orig_data[i][j].i = ((long_long)HDrandom() % - (long_long)HDpow(2, precision[0])) << offset[0]; + (long_long)HDpow(2, precision[0]-1)) << offset[0]; orig_data[i][j].c = ((long_long)HDrandom() % - (long_long)HDpow(2, precision[1])) << offset[1]; + (long_long)HDpow(2, precision[1]-1)) << offset[1]; orig_data[i][j].s = ((long_long)HDrandom() % - (long_long)HDpow(2, precision[2])) << offset[2]; - } -/* - printf("\n"); - for (i= 0;i< size[0]; i++) - for (j = 0; j < size[1]; j++) { - printf("orig[%d]", i); printf("[%d]: ", j); - printf("i: %08x ", orig_data[i][j].i); - printf("c: %02x ", (unsigned char)orig_data[i][j].c); - printf("s: %04x \n", (unsigned short)orig_data[i][j].s); + (long_long)HDpow(2, precision[2]-1)) << offset[2]; + orig_data[i][j].f = float_val[i][j]; + + /* some even-numbered integer values are negtive */ + if((i*size[1]+j+1)%2 == 0) { + orig_data[i][j].i = -orig_data[i][j].i; + orig_data[i][j].s = -orig_data[i][j].s; + } } - printf("\n"); */ PASSED(); #else @@ -2928,10 +3182,10 @@ test_nbit_compound(hid_t file) * to it. *---------------------------------------------------------------------- */ - TESTING("nbit compound (write)"); + TESTING(" nbit compound (write)"); #ifdef H5_HAVE_FILTER_NBIT - if (H5Dwrite(dataset, mem_cmpd_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, + if (H5Dwrite(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data)<0) goto error; PASSED(); @@ -2944,25 +3198,30 @@ test_nbit_compound(hid_t file) * STEP 2: Try to read the data we just wrote. *---------------------------------------------------------------------- */ - TESTING("nbit compound (read)"); + TESTING(" nbit compound (read)"); #ifdef H5_HAVE_FILTER_NBIT /* Read the dataset back */ - if (H5Dread(dataset, mem_cmpd_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, + if (H5Dread(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data)<0) goto error; - /* Check that the values read are the same as the values written */ - /*printf("\n");*/ + /* Check that the values read are the same as the values written + * Use mask for checking the significant bits, ignoring the padding bits + */ + i_mask = ~(~0 << (precision[0] + offset[0])) & (~0 << offset[0]); + c_mask = ~(~0 << (precision[1] + offset[1])) & (~0 << offset[1]); + s_mask = ~(~0 << (precision[2] + offset[2])) & (~0 << offset[2]); for (i=0; i<size[0]; i++) { for (j=0; j<size[1]; j++) { - if (new_data[i][j].i != orig_data[i][j].i || - new_data[i][j].c != orig_data[i][j].c || - new_data[i][j].s != orig_data[i][j].s) { + if ((new_data[i][j].i & i_mask) != (orig_data[i][j].i & i_mask) || + (new_data[i][j].c & c_mask) != (orig_data[i][j].c & c_mask) || + (new_data[i][j].s & s_mask) != (orig_data[i][j].s & s_mask) || + (orig_data[i][j].f==orig_data[i][j].f && new_data[i][j].f != orig_data[i][j].f)) + { H5_FAILED(); printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", - (unsigned long)i, (unsigned long)j); + printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -2972,9 +3231,12 @@ test_nbit_compound(hid_t file) * Cleanup *---------------------------------------------------------------------- */ - - if (H5Tclose(cmpd_tid1)<0) goto error; - if (H5Tclose(mem_cmpd_tid1)<0) goto error; + if (H5Tclose(i_tid)<0) goto error; + if (H5Tclose(c_tid)<0) goto error; + if (H5Tclose(s_tid)<0) goto error; + if (H5Tclose(f_tid)<0) goto error; + if (H5Tclose(cmpd_tid)<0) goto error; + if (H5Tclose(mem_cmpd_tid)<0) goto error; if (H5Pclose (dc)<0) goto error; if (H5Dclose(dataset)<0) goto error; @@ -3000,7 +3262,7 @@ error: * Failure: -1 * * Programmer: Xiaowen Wu - * Wednesday, , 2004 Dec. 23th + * Tuesday, Jan. 18th, 2005 * * Modifications: * @@ -3014,6 +3276,7 @@ test_nbit_compound_2(hid_t file) int i; char c; short s; + float f; } atomic; typedef struct { /* Struct with complex fields */ @@ -3023,7 +3286,7 @@ test_nbit_compound_2(hid_t file) atomic d[2][2]; } complex; - hid_t i_tid, c_tid, s_tid, v_tid; + hid_t i_tid, c_tid, s_tid, f_tid, v_tid; hid_t cmpd_tid1; /* atomic compound datatype */ hid_t cmpd_tid2; /* complex compound datatype */ hid_t mem_cmpd_tid1; /* memory atomic compound datatype */ @@ -3036,25 +3299,29 @@ test_nbit_compound_2(hid_t file) size_t precision[5] = {31, 8, 10, 23, 8}; size_t offset[5] = {1, 0, 3, 5, 0}; hid_t dataset, space, dc; - const hsize_t size[2] = {2, 3}; - const hsize_t chunk_size[2] = {2, 3}; - complex orig_data[2][3]; - complex new_data[2][3]; + const hsize_t size[2] = {2, 5}; + const hsize_t chunk_size[2] = {2, 5}; + const float float_val[2][5] = {{188384.00, 19.103516, -1.0831790e9, -84.242188, + 5.2045898}, {-49140.000, 2350.2500, -3.2110596e-1, 6.4998865e-5, -0.0000000}}; + complex orig_data[2][5]; + complex new_data[2][5]; + unsigned int i_mask, s_mask, c_mask, v_mask, b_mask; hsize_t i, j, m, n, b_failed, d_failed; #else /* H5_HAVE_FILTER_NBIT */ const char *not_supported= " Nbit is not enabled."; #endif /* H5_HAVE_FILTER_NBIT */ - TESTING("nbit compound complex (setup)"); + TESTING(" nbit compound complex (setup)"); #ifdef H5_HAVE_FILTER_NBIT /* Define datatypes of members of compound datatype */ i_tid=H5Tcopy(H5T_NATIVE_INT); c_tid=H5Tcopy(H5T_NATIVE_CHAR); s_tid=H5Tcopy(H5T_NATIVE_SHORT); v_tid=H5Tcopy(H5T_NATIVE_UINT); + f_tid=H5Tcopy(H5T_IEEE_F32BE); - /* Set precision and offset of atomic compound datatype members */ + /* Set precision and offset etc. of atomic compound datatype members */ if(H5Tset_precision(i_tid,precision[0])<0) goto error; if(H5Tset_offset(i_tid,offset[0])<0) goto error; @@ -3064,11 +3331,18 @@ test_nbit_compound_2(hid_t file) if(H5Tset_precision(s_tid,precision[2])<0) goto error; if(H5Tset_offset(s_tid,offset[2])<0) goto error; + if(H5Tset_fields(f_tid, 26, 20, 6, 7, 13)<0) goto error; + if(H5Tset_offset(f_tid, 7)<0) goto error; + if(H5Tset_precision(f_tid, 20)<0) goto error; + if(H5Tset_size(f_tid, 4)<0) goto error; + if(H5Tset_ebias(f_tid, 31)<0) goto error; + /* Create a memory atomic compound datatype before setting the order */ mem_cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic)); if(H5Tinsert(mem_cmpd_tid1, "i", HOFFSET(atomic, i), i_tid)<0) goto error; if(H5Tinsert(mem_cmpd_tid1, "c", HOFFSET(atomic, c), c_tid)<0) goto error; if(H5Tinsert(mem_cmpd_tid1, "s", HOFFSET(atomic, s), s_tid)<0) goto error; + if(H5Tinsert(mem_cmpd_tid1, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT)<0) goto error; /* Set order of dataset atomic compound member datatype */ if(H5Tset_order(i_tid, H5T_ORDER_BE)<0) goto error; @@ -3080,6 +3354,7 @@ test_nbit_compound_2(hid_t file) if(H5Tinsert(cmpd_tid1, "i", HOFFSET(atomic, i), i_tid)<0) goto error; if(H5Tinsert(cmpd_tid1, "c", HOFFSET(atomic, c), c_tid)<0) goto error; if(H5Tinsert(cmpd_tid1, "s", HOFFSET(atomic, s), s_tid)<0) goto error; + if(H5Tinsert(cmpd_tid1, "f", HOFFSET(atomic, f), f_tid)<0) goto error; /* Set precision and offset of the other data member */ if(H5Tset_precision(v_tid,precision[3])<0) goto error; @@ -3124,14 +3399,16 @@ test_nbit_compound_2(hid_t file) if ((dataset = H5Dcreate(file, DSET_NBIT_COMPOUND_NAME_2, cmpd_tid2, space,dc))<0) goto error; + /* Initialize data, assuming size of long_long >= size of member datatypes */ for (i= 0;i< size[0]; i++) for (j = 0; j < size[1]; j++) { orig_data[i][j].a.i = ((long_long)HDrandom() % - (long_long)HDpow(2, precision[0])) << offset[0]; + (long_long)HDpow(2, precision[0]-1)) << offset[0]; orig_data[i][j].a.c = ((long_long)HDrandom() % - (long_long)HDpow(2, precision[1])) << offset[1]; - orig_data[i][j].a.s = ((long_long)HDrandom() % - (long_long)HDpow(2, precision[2])) << offset[2]; + (long_long)HDpow(2, precision[1]-1)) << offset[1]; + orig_data[i][j].a.s = -((long_long)HDrandom() % + (long_long)HDpow(2, precision[2]-1)) << offset[2]; + orig_data[i][j].a.f = float_val[i][j]; orig_data[i][j].v = ((long_long)HDrandom() % (long_long)HDpow(2, precision[3])) << offset[3]; @@ -3139,49 +3416,20 @@ test_nbit_compound_2(hid_t file) for(m = 0; m < array_dims[0]; m++) for(n = 0; n < array_dims[1]; n++) orig_data[i][j].b[m][n] = ((long_long)HDrandom() % - (long_long)HDpow(2, precision[4])) << offset[4]; + (long_long)HDpow(2, precision[4]-1)) << offset[4]; for(m = 0; m < array_dims[0]; m++) for(n = 0; n < array_dims[1]; n++) { - orig_data[i][j].d[m][n].i = ((long_long)HDrandom() % - (long_long)HDpow(2, precision[0])) << offset[0]; + orig_data[i][j].d[m][n].i = -((long_long)HDrandom() % + (long_long)HDpow(2, precision[0]-1)) << offset[0]; orig_data[i][j].d[m][n].c = ((long_long)HDrandom() % - (long_long)HDpow(2, precision[1])) << offset[1]; + (long_long)HDpow(2, precision[1]-1)) << offset[1]; orig_data[i][j].d[m][n].s = ((long_long)HDrandom() % - (long_long)HDpow(2, precision[2])) << offset[2]; + (long_long)HDpow(2, precision[2]-1)) << offset[2]; + orig_data[i][j].d[m][n].f = float_val[i][j]; } } -/* - printf("\n"); - for (i= 0;i< size[0]; i++) - for (j = 0; j < size[1]; j++) { - printf("orig[%d]", i); printf("[%d]: ", j); - printf("a.i: %08x ", orig_data[i][j].a.i); - printf("a.c: %02x ", (unsigned char)orig_data[i][j].a.c); - printf("a.s: %04x\n", (unsigned short)orig_data[i][j].a.s); - printf(" v: %08x\n", orig_data[i][j].v); - - printf(" "); - for(m = 0; m < array_dims[0]; m++) - for(n = 0; n < array_dims[1]; n++) { - printf("b[%d]", m); printf("[%d]: ", n); - printf("%02x ", (unsigned char)orig_data[i][j].b[m][n]); - } - printf("\n"); - - for(m = 0; m < array_dims[0]; m++) - for(n = 0; n < array_dims[1]; n++){ - printf(" d[%d]", m); printf("[%d].i: ", n); - printf("%08x ", orig_data[i][j].d[m][n].i); - printf("d[%d]", m); printf("[%d].c: ", n); - printf("%02x ", (unsigned char)orig_data[i][j].d[m][n].c); - printf("d[%d]", m); printf("[%d].s: ", n); - printf("%04x\n", (unsigned short)orig_data[i][j].d[m][n].s); - } - } - printf("\n"); -*/ PASSED(); #else SKIPPED(); @@ -3193,7 +3441,7 @@ test_nbit_compound_2(hid_t file) * to it. *---------------------------------------------------------------------- */ - TESTING("nbit compound complex (write)"); + TESTING(" nbit compound complex (write)"); #ifdef H5_HAVE_FILTER_NBIT if (H5Dwrite(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, @@ -3209,7 +3457,7 @@ test_nbit_compound_2(hid_t file) * STEP 2: Try to read the data we just wrote. *---------------------------------------------------------------------- */ - TESTING("nbit compound complex (read)"); + TESTING(" nbit compound complex (read)"); #ifdef H5_HAVE_FILTER_NBIT /* Read the dataset back */ @@ -3217,14 +3465,20 @@ test_nbit_compound_2(hid_t file) new_data)<0) goto error; - /* Check that the values read are the same as the values written */ - /*printf("\n");*/ + /* Check that the values read are the same as the values written + * Use mask for checking the significant bits, ignoring the padding bits + */ + i_mask = ~(~0 << (precision[0] + offset[0])) & (~0 << offset[0]); + c_mask = ~(~0 << (precision[1] + offset[1])) & (~0 << offset[1]); + s_mask = ~(~0 << (precision[2] + offset[2])) & (~0 << offset[2]); + v_mask = ~(~0 << (precision[3] + offset[3])) & (~0 << offset[3]); + b_mask = ~(~0 << (precision[4] + offset[4])) & (~0 << offset[4]); for (i=0; i<size[0]; i++) { for (j=0; j<size[1]; j++) { b_failed = 0; for(m = 0; m < array_dims[0]; m++) for(n = 0; n < array_dims[1]; n++) - if(new_data[i][j].b[m][n] != orig_data[i][j].b[m][n]) { + if((new_data[i][j].b[m][n]&b_mask)!=(orig_data[i][j].b[m][n]&b_mask)) { b_failed = 1; goto out; } @@ -3232,23 +3486,25 @@ test_nbit_compound_2(hid_t file) d_failed = 0; for(m = 0; m < array_dims[0]; m++) for(n = 0; n < array_dims[1]; n++) - if(new_data[i][j].d[m][n].i != orig_data[i][j].d[m][n].i || - new_data[i][j].d[m][n].c != orig_data[i][j].d[m][n].c || - new_data[i][j].d[m][n].s != orig_data[i][j].d[m][n].s) { + if((new_data[i][j].d[m][n].i & i_mask)!=(orig_data[i][j].d[m][n].i & i_mask)|| + (new_data[i][j].d[m][n].c & c_mask)!=(orig_data[i][j].d[m][n].c & c_mask)|| + (new_data[i][j].d[m][n].s & s_mask)!=(orig_data[i][j].d[m][n].s & s_mask)|| + (new_data[i][j].d[m][n].f==new_data[i][j].d[m][n].f && + new_data[i][j].d[m][n].f != new_data[i][j].d[m][n].f)) { d_failed = 1; goto out; } out: - if(new_data[i][j].a.i != orig_data[i][j].a.i || - new_data[i][j].a.c != orig_data[i][j].a.c || - new_data[i][j].a.s != orig_data[i][j].a.s || - new_data[i][j].v != orig_data[i][j].v || - b_failed || d_failed) { + if((new_data[i][j].a.i & i_mask)!=(orig_data[i][j].a.i & i_mask)|| + (new_data[i][j].a.c & c_mask)!=(orig_data[i][j].a.c & c_mask)|| + (new_data[i][j].a.s & s_mask)!=(orig_data[i][j].a.s & s_mask)|| + (new_data[i][j].a.f==new_data[i][j].a.f && + new_data[i][j].a.f != new_data[i][j].a.f)|| + new_data[i][j].v != orig_data[i][j].v || b_failed || d_failed) { H5_FAILED(); printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", - (unsigned long)i, (unsigned long)j); + printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -3258,7 +3514,11 @@ test_nbit_compound_2(hid_t file) * Cleanup *---------------------------------------------------------------------- */ - + if (H5Tclose(i_tid)<0) goto error; + if (H5Tclose(c_tid)<0) goto error; + if (H5Tclose(s_tid)<0) goto error; + if (H5Tclose(f_tid)<0) goto error; + if (H5Tclose(v_tid)<0) goto error; if (H5Tclose(cmpd_tid2)<0) goto error; if (H5Tclose(cmpd_tid1)<0) goto error; if (H5Tclose(mem_cmpd_tid2)<0) goto error; @@ -3283,154 +3543,6 @@ error: /*------------------------------------------------------------------------- - * Function: test_nbit_float - * - * Purpose: Tests the float datatype of nbit filter - * - * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Xiaowen Wu - * Wednesday, , 2004 Dec. 23th - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -test_nbit_float(hid_t file) -{ -/* assume unsigned int and float has the same number of bytes */ -#ifdef H5_HAVE_FILTER_NBIT - hid_t dataset, datatype, mem_datatype, space, dc; - const hsize_t size[2] = {2, 5}; - const hsize_t chunk_size[2] = {2, 5}; - float orig_data[2][5]; - float new_data[2][5]; - int ival; - float *pfval; - size_t precision, offset; - hsize_t i, j; -#else /* H5_HAVE_FILTER_NBIT */ - const char *not_supported= " Nbit is not enabled."; -#endif /* H5_HAVE_FILTER_NBIT */ - - TESTING("nbit float (setup)"); -#ifdef H5_HAVE_FILTER_NBIT - /* Define dataset datatype and set precision, offset, order */ - datatype = H5Tcopy(H5T_NATIVE_FLOAT); -/* if(H5Tset_fields(datatype, 31, 23, 8, 0, 23)<0) goto error; */ - if(H5Tset_fields(datatype, 28, 20, 8, 7, 13)<0) goto error; - offset = /*0*/ 7; - if(H5Tset_offset(datatype,offset)<0) goto error; - precision = /*32*/ 22; - if(H5Tset_precision(datatype,precision)<0) goto error; - if(H5Tset_size(datatype, 4)<0) goto error; - if(H5Tset_ebias(datatype, HDpow(2, 8 - 1) - 1)<0) goto error; - - /* Copy to memory datatype before setting order */ - mem_datatype = H5Tcopy(datatype); - - /* Set order of datatype */ - if(H5Tset_order(datatype, H5T_ORDER_BE)<0) goto error; - - /* Create the data space */ - if ((space = H5Screate_simple(2, size, NULL))<0) goto error; - - /* Use nbit filter */ - if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error; - if (H5Pset_chunk(dc, 2, chunk_size)<0) goto error; - if (H5Pset_nbit(dc)<0) goto error; - - /* Create the dataset */ - if ((dataset = H5Dcreate(file, DSET_NBIT_FLOAT_NAME, datatype, - space,dc))<0) goto error; - - /*printf("\n");*/ - for (i= 0;i< size[0]; i++) - for (j = 0; j < size[1]; j++) { - ival = ((long_long)HDrandom() % - (long_long)HDpow(2, precision-1)) << offset; - pfval = (float *)(&ival); - orig_data[i][j] = *pfval; - - /*printf("orig: %08x ", *((int *)&orig_data[i][j]));*/ - } - PASSED(); -#else - SKIPPED(); - puts(not_supported); -#endif - - /*---------------------------------------------------------------------- - * STEP 1: Test nbit by setting up a chunked dataset and writing - * to it. - *---------------------------------------------------------------------- - */ - TESTING("nbit float (write)"); - -#ifdef H5_HAVE_FILTER_NBIT - if (H5Dwrite(dataset, mem_datatype/*H5T_NATIVE_FLOAT*/, H5S_ALL, H5S_ALL, H5P_DEFAULT, - orig_data)<0) - goto error; - - PASSED(); -#else - SKIPPED(); - puts(not_supported); -#endif - - /*---------------------------------------------------------------------- - * STEP 2: Try to read the data we just wrote. - *---------------------------------------------------------------------- - */ - TESTING("nbit float (read)"); - -#ifdef H5_HAVE_FILTER_NBIT - /* Read the dataset back */ - if (H5Dread(dataset, mem_datatype/*H5T_NATIVE_FLOAT*/, H5S_ALL, H5S_ALL, H5P_DEFAULT, - new_data)<0) - goto error; - - /* Check that the values read are the same as the values written */ - /*printf("\n");*/ - for (i=0; i<size[0]; i++) { - for (j=0; j<size[1]; j++) { - if (*((int *)&new_data[i][j]) != *((int *)&orig_data[i][j])) { - H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", - (unsigned long)i, (unsigned long)j); - goto error; - } - /*printf(" orig: %f new: %f\n", orig_data[i][j], new_data[i][j]);*/ - } - } - - - /*---------------------------------------------------------------------- - * Cleanup - *---------------------------------------------------------------------- - */ - if (H5Tclose(datatype)<0) goto error; - if (H5Pclose (dc)<0) goto error; - if (H5Dclose(dataset)<0) goto error; - - PASSED(); -#else - SKIPPED(); - puts(not_supported); -#endif - - return 0; - -error: - return -1; -} - - -/*------------------------------------------------------------------------- * Function: test_multiopen * * Purpose: Tests that a bug no longer exists. If a dataset is opened @@ -4835,10 +4947,7 @@ int main(void) /* Set the random # seed */ HDsrandom((unsigned long)HDtime(NULL)); - /*unsigned long seed = 1104813331 1106320343 HDtime(NULL); - HDsrandom(seed); - printf("SEED: %d\n", seed);*/ - + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); /* Turn off the chunk cache, so all the chunks are immediately written to disk */ @@ -4864,13 +4973,12 @@ int main(void) nerrors += test_tconv(file)<0 ?1:0; nerrors += test_filters(file)<0 ?1:0; nerrors += test_onebyte_shuffle(file)<0 ?1:0; -/* nerrors += test_nbit_int(file)<0 ?1:0; + nerrors += test_nbit_float(file)<0 ?1:0; + nerrors += test_nbit_double(file)<0 ?1:0; nerrors += test_nbit_array(file)<0 ?1:0; nerrors += test_nbit_compound(file)<0 ?1:0; nerrors += test_nbit_compound_2(file)<0 ?1:0; - nerrors += test_nbit_float(file)<0 ?1:0; -*/ nerrors += test_multiopen (file)<0 ?1:0; nerrors += test_types(file)<0 ?1:0; nerrors += test_userblock_offset(fapl)<0 ?1:0; |