summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CTestConfig.cmake2
-rw-r--r--config/cmake/scripts/HDF5config.cmake2
-rw-r--r--java/test/TestH5P.java2
-rw-r--r--java/test/TestH5Pfapl.java3
-rw-r--r--java/test/TestH5Z.java1
-rw-r--r--test/direct_chunk.c178
-rw-r--r--test/dsets.c245
-rw-r--r--test/dt_arith.c1460
-rw-r--r--test/earray.c4
-rw-r--r--test/th5o.c32
-rw-r--r--test/titerate.c2
11 files changed, 963 insertions, 968 deletions
diff --git a/CTestConfig.cmake b/CTestConfig.cmake
index d80f48f..4868d07 100644
--- a/CTestConfig.cmake
+++ b/CTestConfig.cmake
@@ -50,5 +50,5 @@ set (CTEST_TEST_TIMEOUT 1200 CACHE STRING
set (DART_TESTING_TIMEOUT 1200 CACHE STRING
"Maximum time allowed before CTest will kill the test." FORCE)
-SET(CTEST_SUBMIT_RETRY_DELAY 20 CACHE STRING
+set (CTEST_SUBMIT_RETRY_DELAY 20 CACHE STRING
"How long to wait between timed-out CTest submissions.")
diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake
index e6c9619..3511d05 100644
--- a/config/cmake/scripts/HDF5config.cmake
+++ b/config/cmake/scripts/HDF5config.cmake
@@ -45,7 +45,7 @@ set (CTEST_SOURCE_VERSEXT "")
#CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0
#MODEL - CDash group name
#HPC - run alternate configurations for HPC machines; sbatch, bsub, raybsub, qsub
-#MPI - enable MPI;
+#MPI - enable MPI
if (DEFINED CTEST_SCRIPT_ARG)
# transform ctest script arguments of the form
# script.ctest,var1=value1,var2=value2
diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java
index a85405b..b1c29b2 100644
--- a/java/test/TestH5P.java
+++ b/java/test/TestH5P.java
@@ -209,7 +209,7 @@ public class TestH5P {
@Test(expected = HDF5FunctionArgumentException.class)
public void testH5Pset_libver_bounds_invalidlow() throws Throwable {
- H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_EARLIEST-1, HDF5Constants.H5F_LIBVER_LATEST);
+ H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST+1, HDF5Constants.H5F_LIBVER_LATEST);
}
@Test(expected = HDF5FunctionArgumentException.class)
diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java
index 81a7ecb..7d690cf 100644
--- a/java/test/TestH5Pfapl.java
+++ b/java/test/TestH5Pfapl.java
@@ -29,8 +29,6 @@ import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.exceptions.HDF5PropertyListInterfaceException;
import hdf.hdf5lib.structs.H5AC_cache_config_t;
-import hdf.hdf5lib.structs.H5FD_hdfs_fapl_t;
-import hdf.hdf5lib.structs.H5FD_ros3_fapl_t;
import org.junit.After;
import org.junit.Before;
@@ -1401,5 +1399,4 @@ public class TestH5Pfapl {
fail("H5P_evict_on_close: " + err);
}
}
-
}
diff --git a/java/test/TestH5Z.java b/java/test/TestH5Z.java
index f3049ed..27bda6f 100644
--- a/java/test/TestH5Z.java
+++ b/java/test/TestH5Z.java
@@ -109,4 +109,3 @@ public class TestH5Z {
H5.H5Zunregister(HDF5Constants.H5Z_FILTER_SHUFFLE);
}
}
-
diff --git a/test/direct_chunk.c b/test/direct_chunk.c
index 9ea814c..447e827 100644
--- a/test/direct_chunk.c
+++ b/test/direct_chunk.c
@@ -13,7 +13,7 @@
#include "h5test.h"
-#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER)
+#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER)
# define H5_ZLIB_HEADER "zlib.h"
#endif
#if defined(H5_ZLIB_HEADER)
@@ -46,10 +46,10 @@
#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*H5_DOUBLE(1.001))+H5_DOUBLE(12.0))
/* Temporary filter IDs used for testing */
-#define H5Z_FILTER_BOGUS1 305
-#define H5Z_FILTER_BOGUS2 306
-#define ADD_ON 7
-#define FACTOR 3
+#define H5Z_FILTER_BOGUS1 305
+#define H5Z_FILTER_BOGUS2 306
+#define ADD_ON 7
+#define FACTOR 3
/* Constants for the overwrite test */
#define OVERWRITE_NDIMS 3
@@ -83,33 +83,33 @@ static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts,
/* This message derives from H5Z */
const H5Z_class2_t H5Z_BOGUS1[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_BOGUS1, /* Filter id number */
+ H5Z_FILTER_BOGUS1, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
- "bogus1", /* Filter name for debugging */
+ "bogus1", /* Filter name for debugging */
NULL, /* The "can apply" callback */
NULL, /* The "set local" callback */
- filter_bogus1, /* The actual filter function */
+ filter_bogus1, /* The actual filter function */
}};
const H5Z_class2_t H5Z_BOGUS2[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_BOGUS2, /* Filter id number */
+ H5Z_FILTER_BOGUS2, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
- "bogus2", /* Filter name for debugging */
+ "bogus2", /* Filter name for debugging */
NULL, /* The "can apply" callback */
NULL, /* The "set local" callback */
- filter_bogus2, /* The actual filter function */
+ filter_bogus2, /* The actual filter function */
}};
/*-------------------------------------------------------------------------
- * Function: test_direct_chunk_write
+ * Function: test_direct_chunk_write
*
- * Purpose: Test the basic functionality of H5Dwrite_chunk
+ * Purpose: Test the basic functionality of H5Dwrite_chunk
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 November 2012
*
*-------------------------------------------------------------------------
@@ -121,7 +121,7 @@ test_direct_chunk_write (hid_t file)
hid_t dataspace = -1, dataset = -1;
hid_t mem_space = -1;
hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
+ hsize_t dims[2] = {NX, NY};
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
herr_t status;
@@ -136,11 +136,11 @@ test_direct_chunk_write (hid_t file)
size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
const Bytef *z_src = (const Bytef*)(direct_buf);
- Bytef *z_dst = NULL; /*destination buffer */
- uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
- uLong z_src_nbytes = (uLong)buf_size;
+ Bytef *z_dst = NULL; /*destination buffer */
+ uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
+ uLong z_src_nbytes = (uLong)buf_size;
int aggression = 9; /* Compression aggression setting */
- void *outbuf = NULL; /* Pointer to new buffer */
+ void *outbuf = NULL; /* Pointer to new buffer */
hsize_t start[2]; /* Start of hyperslab */
hsize_t stride[2]; /* Stride of hyperslab */
@@ -175,29 +175,29 @@ test_direct_chunk_write (hid_t file)
* creation properties.
*/
if((dataset = H5Dcreate2(file, DATASETNAME1, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ cparms, H5P_DEFAULT)) < 0)
goto error;
/* Initialize the dataset */
for(i = n = 0; i < NX; i++)
for(j = 0; j < NY; j++)
- data[i][j] = n++;
+ data[i][j] = n++;
if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
/*
* Write the data for the dataset. It should stay in the chunk cache.
- * It will be evicted from the cache by the H5Dwrite_chunk calls.
+ * It will be evicted from the cache by the H5Dwrite_chunk calls.
*/
if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl, data)) < 0)
+ dxpl, data)) < 0)
goto error;
/* Initialize data for one chunk */
for(i = n = 0; i < CHUNK_NX; i++)
for(j = 0; j < CHUNK_NY; j++)
- direct_buf[i][j] = n++;
+ direct_buf[i][j] = n++;
/* Allocate output (compressed) buffer */
outbuf = HDmalloc(z_dst_nbytes);
@@ -218,8 +218,8 @@ test_direct_chunk_write (hid_t file)
goto error;
}
- /* Write the compressed chunk data repeatedly to cover all the chunks in the
- * dataset, using the direct writing function. */
+ /* Write the compressed chunk data repeatedly to cover all the chunks in the
+ * dataset, using the direct writing function. */
for(i=0; i<NX/CHUNK_NX; i++) {
for(j=0; j<NY/CHUNK_NY; j++) {
status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, z_dst_nbytes, outbuf);
@@ -232,7 +232,7 @@ test_direct_chunk_write (hid_t file)
if(outbuf)
HDfree(outbuf);
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
+ if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
goto error;
if(H5Dclose(dataset) < 0)
@@ -261,7 +261,7 @@ test_direct_chunk_write (hid_t file)
if(direct_buf[i][j] != check_chunk[i][j]) {
HDprintf(" 1. Read different values than written.");
HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[i][j], check_chunk[i][j]);
+ HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[i][j], check_chunk[i][j]);
goto error;
}
}
@@ -270,7 +270,7 @@ test_direct_chunk_write (hid_t file)
/* Reinitialize different data for one chunk */
for(i = 0; i < CHUNK_NX; i++)
for(j = 0; j < CHUNK_NY; j++)
- direct_buf[i][j] = i + j;
+ direct_buf[i][j] = i + j;
/* Allocate output (compressed) buffer */
outbuf = HDmalloc(z_dst_nbytes);
@@ -291,8 +291,8 @@ test_direct_chunk_write (hid_t file)
goto error;
}
- /* Rewrite the compressed chunk data repeatedly to cover all the chunks in the
- * dataset, using the direct writing function. */
+ /* Rewrite the compressed chunk data repeatedly to cover all the chunks in the
+ * dataset, using the direct writing function. */
offset[0] = offset[1] = 0;
for(i=0; i<NX/CHUNK_NX; i++) {
for(j=0; j<NY/CHUNK_NY; j++) {
@@ -306,7 +306,7 @@ test_direct_chunk_write (hid_t file)
if(outbuf)
HDfree(outbuf);
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
+ if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
goto error;
if(H5Dclose(dataset) < 0)
@@ -325,7 +325,7 @@ test_direct_chunk_write (hid_t file)
if(direct_buf[i][j] != check_chunk[i][j]) {
HDprintf(" 2. Read different values than written.");
HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[i][j], check_chunk[i][j]);
+ HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[i][j], check_chunk[i][j]);
goto error;
}
}
@@ -339,7 +339,7 @@ test_direct_chunk_write (hid_t file)
H5Sclose(dataspace);
H5Pclose(cparms);
H5Pclose(dxpl);
-
+
PASSED();
return 0;
@@ -467,15 +467,15 @@ error:
} /* end test_direct_chunk_overwrite_data() */
/*-------------------------------------------------------------------------
- * Function: test_skip_compress_write1
+ * Function: test_skip_compress_write1
*
- * Purpose: Test skipping compression filter when it is the only filter
+ * Purpose: Test skipping compression filter when it is the only filter
* for the dataset
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 November 2012
*
*-------------------------------------------------------------------------
@@ -536,7 +536,7 @@ test_skip_compress_write1(hid_t file)
* creation properties.
*/
if((dataset = H5Dcreate2(file, DATASETNAME2, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ cparms, H5P_DEFAULT)) < 0)
goto error;
if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
@@ -644,13 +644,13 @@ error:
} /* test_skip_compress_write1() */
/*-------------------------------------------------------------------------
- * Function: filter_bogus1
+ * Function: filter_bogus1
*
- * Purpose: A bogus filter that adds ADD_ON to the original value
+ * Purpose: A bogus filter that adds ADD_ON to the original value
*
- * Return: Success: Data chunk size
+ * Return: Success: Data chunk size
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 November 2012
*
*-------------------------------------------------------------------------
@@ -682,13 +682,13 @@ filter_bogus1(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
} /* filter_bogus1() */
/*-------------------------------------------------------------------------
- * Function: filter_bogus2
+ * Function: filter_bogus2
*
- * Purpose: A bogus filter that multiplies the original value by FACTOR.
+ * Purpose: A bogus filter that multiplies the original value by FACTOR.
*
- * Return: Success: Data chunk size
+ * Return: Success: Data chunk size
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 November 2012
*-------------------------------------------------------------------------
*/
@@ -719,15 +719,15 @@ filter_bogus2(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
} /* filter_bogus2() */
/*-------------------------------------------------------------------------
- * Function: test_skip_compress_write2
+ * Function: test_skip_compress_write2
*
- * Purpose: Test skipping compression filter when there are three filters
+ * Purpose: Test skipping compression filter when there are three filters
* for the dataset
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 November 2012
*
*-------------------------------------------------------------------------
@@ -805,7 +805,7 @@ test_skip_compress_write2(hid_t file)
* creation properties.
*/
if((dataset = H5Dcreate2(file, DATASETNAME3, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ cparms, H5P_DEFAULT)) < 0)
goto error;
if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
@@ -915,14 +915,14 @@ error:
} /* test_skip_compress_write2() */
/*-------------------------------------------------------------------------
- * Function: test_data_conv
+ * Function: test_data_conv
*
- * Purpose: Test data conversion
+ * Purpose: Test data conversion
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 November 2012
*
*-------------------------------------------------------------------------
@@ -940,13 +940,13 @@ test_data_conv(hid_t file)
hid_t dataspace = -1, dataset = -1;
hid_t mem_space = -1;
hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
+ hsize_t dims[2] = {NX, NY};
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
herr_t status;
int i, j, n;
- const hsize_t four = 4;
- hid_t st=-1, dt=-1;
+ const hsize_t four = 4;
+ hid_t st=-1, dt=-1;
hid_t array_dt;
unsigned filter_mask = 0;
@@ -1010,7 +1010,7 @@ test_data_conv(hid_t file)
* creation properties.
*/
if((dataset = H5Dcreate2(file, DATASETNAME4, st, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ cparms, H5P_DEFAULT)) < 0)
goto error;
if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
@@ -1030,7 +1030,7 @@ test_data_conv(hid_t file)
}
}
- /* write the chunk data to dataset, using the direct writing function.
+ /* write the chunk data to dataset, using the direct writing function.
* There should be no data conversion involved. */
offset[0] = CHUNK_NX;
offset[1] = CHUNK_NY;
@@ -1038,7 +1038,7 @@ test_data_conv(hid_t file)
if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0)
goto error;
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
+ if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
goto error;
if(H5Dclose(dataset) < 0)
@@ -1065,10 +1065,10 @@ test_data_conv(hid_t file)
HDprintf(" 1. Read different values than written.");
HDprintf(" At index %d,%d\n", i, j);
HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1],
+ (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1],
(direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e);
HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- (read_chunk[i][j]).a, (read_chunk[i][j]).b, (read_chunk[i][j]).c[0], (read_chunk[i][j]).c[1],
+ (read_chunk[i][j]).a, (read_chunk[i][j]).b, (read_chunk[i][j]).c[0], (read_chunk[i][j]).c[1],
(read_chunk[i][j]).c[2], (read_chunk[i][j]).c[3], (read_chunk[i][j]).d, (read_chunk[i][j]).e);
goto error;
@@ -1102,10 +1102,10 @@ test_data_conv(hid_t file)
HDprintf(" 1. Read different values than written.");
HDprintf(" At index %d,%d\n", i, j);
HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1],
+ (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1],
(direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e);
HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n",
- (check_chunk[i][j]).a, (check_chunk[i][j]).c[0], (check_chunk[i][j]).c[1], (check_chunk[i][j]).c[2],
+ (check_chunk[i][j]).a, (check_chunk[i][j]).c[0], (check_chunk[i][j]).c[1], (check_chunk[i][j]).c[2],
(check_chunk[i][j]).c[3], (check_chunk[i][j]).e);
goto error;
@@ -1143,14 +1143,14 @@ error:
} /* test_data_conv() */
/*-------------------------------------------------------------------------
- * Function: test_invalid_parameters
+ * Function: test_invalid_parameters
*
* Purpose: Test invalid parameters for H5Dwrite_chunk and H5Dread_chunk
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 November 2012
*
*-------------------------------------------------------------------------
@@ -1161,7 +1161,7 @@ test_invalid_parameters(hid_t file)
hid_t dataspace = -1, dataset = -1;
hid_t mem_space = -1;
hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
+ hsize_t dims[2] = {NX, NY};
hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
herr_t status;
int i, j, n;
@@ -1195,7 +1195,7 @@ test_invalid_parameters(hid_t file)
* Create a new contiguous dataset to verify H5Dwrite_chunk/H5Dread_chunk doesn't work
*/
if((dataset = H5Dcreate2(file, DATASETNAME5, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ cparms, H5P_DEFAULT)) < 0)
goto error;
if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
@@ -1244,10 +1244,10 @@ test_invalid_parameters(hid_t file)
* creation properties.
*/
if((dataset = H5Dcreate2(file, DATASETNAME6, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ cparms, H5P_DEFAULT)) < 0)
goto error;
- /* Check invalid dataset ID for H5Dwrite_chunk and H5Dread_chunk */
+ /* Check invalid dataset ID for H5Dwrite_chunk and H5Dread_chunk */
H5E_BEGIN_TRY {
if((status = H5Dwrite_chunk((hid_t)-1, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
goto error;
@@ -1309,7 +1309,7 @@ test_invalid_parameters(hid_t file)
/* Check invalid buffer size for H5Dwrite_chunk only */
offset[0] = CHUNK_NX;
offset[1] = CHUNK_NY;
- buf_size = 0;
+ buf_size = 0;
H5E_BEGIN_TRY {
if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
goto error;
@@ -1337,7 +1337,7 @@ test_invalid_parameters(hid_t file)
H5Sclose(dataspace);
H5Pclose(cparms);
H5Pclose(dxpl);
-
+
PASSED();
return 0;
@@ -1643,7 +1643,7 @@ test_direct_chunk_read_cache (hid_t file, hbool_t flush)
goto error;
if(read_buf_size == 0)
goto error;
-
+
/* Read the compressed chunk back using the direct read function. */
if((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, outbuf)) < 0)
goto error;
@@ -1994,7 +1994,7 @@ error:
* this jira issue:
* Create a file with the latest format and a chunked dataset
* with one single chunk. The library will use single chunk
- * index for the dataset.
+ * index for the dataset.
* Verify that the data read is the same as the written data.
*
* Since expanded to test multiple combinations of cases
@@ -2139,15 +2139,15 @@ error:
} /* test_single_chunk_latest() */
/*-------------------------------------------------------------------------
- * Function: Main function
+ * Function: Main function
*
- * Purpose: Test direct chunk write function H5Dwrite_chunk and
+ * Purpose: Test direct chunk write function H5Dwrite_chunk and
* chunk direct read function H5Dread_chunk
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 November 2012
*
*-------------------------------------------------------------------------
@@ -2168,7 +2168,7 @@ int main( void )
#ifdef H5_HAVE_FILTER_DEFLATE
nerrors += test_direct_chunk_write(file_id);
#endif /* H5_HAVE_FILTER_DEFLATE */
- nerrors += test_direct_chunk_overwrite_data(file_id);
+ nerrors += test_direct_chunk_overwrite_data(file_id);
nerrors += test_skip_compress_write1(file_id);
nerrors += test_skip_compress_write2(file_id);
nerrors += test_data_conv(file_id);
diff --git a/test/dsets.c b/test/dsets.c
index 603f785..5976df5 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -12899,8 +12899,8 @@ error:
* Purpose: Tests various format versions.
* (Currently, only virtual dataset feature)
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: SUCCEED
+ * Failure: FAIL
* Description:
* This function attempts to create a virtual dataset in all
* valid combinations of low/high library format bounds. Creation
@@ -13090,21 +13090,26 @@ test_object_header_minimization_dcpl(void)
/* default value (not set explicitly)
*/
- if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL) TEST_ERROR
+ if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL)
+ TEST_ERROR
if (FALSE != minimize)
TEST_ERROR
/* FALSE-set value
*/
- if (H5Pset_dset_no_attrs_hint(dcpl_id, FALSE) == FAIL) TEST_ERROR
- if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL) TEST_ERROR
+ if (H5Pset_dset_no_attrs_hint(dcpl_id, FALSE) == FAIL)
+ TEST_ERROR
+ if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL)
+ TEST_ERROR
if (FALSE != minimize)
TEST_ERROR
/* TRUE-set value
*/
- if (H5Pset_dset_no_attrs_hint(dcpl_id, TRUE) == FAIL) TEST_ERROR
- if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL) TEST_ERROR
+ if (H5Pset_dset_no_attrs_hint(dcpl_id, TRUE) == FAIL)
+ TEST_ERROR
+ if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL)
+ TEST_ERROR
if (TRUE != minimize)
TEST_ERROR
@@ -13228,127 +13233,127 @@ main(void)
/* Test with paged aggregation enabled or not */
for(paged = FALSE; paged <= TRUE; paged++) {
- /* Temporary: skip testing for multi/split drivers:
- fail file create when persisting free-space or using paged aggregation strategy */
- if(!contig_addr_vfd && paged)
- continue;
-
- for (minimized_ohdr = FALSE; minimized_ohdr <= TRUE; minimized_ohdr++) {
-
- /* Test with old & new format groups */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
- hid_t my_fapl, my_fcpl;
-
- /* Set the FAPL for the type of format */
- if(new_format) {
- my_fapl = fapl2;
- if(paged) {
- my_fcpl = fcpl2;
- puts("\nTesting with new file format and paged aggregation");
- } else {
- my_fcpl = fcpl;
- puts("\nTesting with new file format and non-paged aggregation");
- }
- } /* end if */
- else {
- my_fapl = fapl;
- if(paged) {
- my_fcpl = fcpl2;
- puts("Testing with old file format and paged aggregation:");
- } else {
- my_fcpl = fcpl;
- puts("Testing with old file format and non-paged aggregation:");
- }
- } /* end else */
+ /* Temporary: skip testing for multi/split drivers:
+ fail file create when persisting free-space or using paged aggregation strategy */
+ if(!contig_addr_vfd && paged)
+ continue;
- /* Create the file for this test */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, my_fcpl, my_fapl)) < 0)
- goto error;
+ for(minimized_ohdr = FALSE; minimized_ohdr <= TRUE; minimized_ohdr++) {
+
+ /* Test with old & new format groups */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ hid_t my_fapl, my_fcpl;
+
+ /* Set the FAPL for the type of format */
+ if(new_format) {
+ my_fapl = fapl2;
+ if(paged) {
+ my_fcpl = fcpl2;
+ puts("\nTesting with new file format and paged aggregation");
+ } else {
+ my_fcpl = fcpl;
+ puts("\nTesting with new file format and non-paged aggregation");
+ }
+ } /* end if */
+ else {
+ my_fapl = fapl;
+ if(paged) {
+ my_fcpl = fcpl2;
+ puts("Testing with old file format and paged aggregation:");
+ } else {
+ my_fcpl = fcpl;
+ puts("Testing with old file format and non-paged aggregation:");
+ }
+ } /* end else */
- if (TRUE == minimized_ohdr) {
- if (0 > H5Fset_dset_no_attrs_hint(file, TRUE))
+ /* Create the file for this test */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, my_fcpl, my_fapl)) < 0)
goto error;
- puts("(minimized dataset object headers with file setting)");
- }
- /* Cause the library to emit initial messages */
- if((grp = H5Gcreate2(file, "emit diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
- if(H5Oset_comment(grp, "Causes diagnostic messages to be emitted") < 0)
- goto error;
- if(H5Gclose(grp) < 0)
- goto error;
+ if (TRUE == minimized_ohdr) {
+ if (0 > H5Fset_dset_no_attrs_hint(file, TRUE))
+ goto error;
+ puts("(minimized dataset object headers with file setting)");
+ }
- nerrors += (test_create(file) < 0 ? 1 : 0);
- nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_compact_open_close_dirty(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_conv_buffer(file) < 0 ? 1 : 0);
- nerrors += (test_tconv(file) < 0 ? 1 : 0);
- nerrors += (test_filters(file, my_fapl) < 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_compound_3(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_int_size(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_flt_size(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0);
- nerrors += (test_multiopen (file) < 0 ? 1 : 0);
- nerrors += (test_types(file) < 0 ? 1 : 0);
- nerrors += (test_userblock_offset(envval, my_fapl, new_format) < 0 ? 1 : 0);
- nerrors += (test_missing_filter(file) < 0 ? 1 : 0);
- nerrors += (test_can_apply(file) < 0 ? 1 : 0);
- nerrors += (test_can_apply2(file) < 0 ? 1 : 0);
- nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0);
- nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0);
- nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_filter_delete(file) < 0 ? 1 : 0);
- nerrors += (test_filters_endianess() < 0 ? 1 : 0);
- nerrors += (test_zero_dims(file) < 0 ? 1 : 0);
- nerrors += (test_missing_chunk(file) < 0 ? 1 : 0);
- nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0);
+ /* Cause the library to emit initial messages */
+ if((grp = H5Gcreate2(file, "emit diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Oset_comment(grp, "Causes diagnostic messages to be emitted") < 0)
+ goto error;
+ if(H5Gclose(grp) < 0)
+ goto error;
+
+ nerrors += (test_create(file) < 0 ? 1 : 0);
+ nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_compact_open_close_dirty(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_conv_buffer(file) < 0 ? 1 : 0);
+ nerrors += (test_tconv(file) < 0 ? 1 : 0);
+ nerrors += (test_filters(file, my_fapl) < 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_compound_3(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_int_size(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_flt_size(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0);
+ nerrors += (test_multiopen (file) < 0 ? 1 : 0);
+ nerrors += (test_types(file) < 0 ? 1 : 0);
+ nerrors += (test_userblock_offset(envval, my_fapl, new_format) < 0 ? 1 : 0);
+ nerrors += (test_missing_filter(file) < 0 ? 1 : 0);
+ nerrors += (test_can_apply(file) < 0 ? 1 : 0);
+ nerrors += (test_can_apply2(file) < 0 ? 1 : 0);
+ nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0);
+ nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0);
+ nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_filter_delete(file) < 0 ? 1 : 0);
+ nerrors += (test_filters_endianess() < 0 ? 1 : 0);
+ nerrors += (test_zero_dims(file) < 0 ? 1 : 0);
+ nerrors += (test_missing_chunk(file) < 0 ? 1 : 0);
+ nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- nerrors += (test_deprec(file) < 0 ? 1 : 0);
+ nerrors += (test_deprec(file) < 0 ? 1 : 0);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_idx_compatible() < 0 ? 1 : 0);
- nerrors += (test_unfiltered_edge_chunks(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_single_chunk(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_storage_size(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_power2up(my_fapl) < 0 ? 1 : 0);
-
- nerrors += (test_swmr_non_latest(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_earray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_farray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_bt2_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
-
- if(H5Fclose(file) < 0)
- goto error;
- } /* end for new_format */
- } /* for minimized dset object headers */
+ nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_idx_compatible() < 0 ? 1 : 0);
+ nerrors += (test_unfiltered_edge_chunks(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_single_chunk(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_storage_size(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_power2up(my_fapl) < 0 ? 1 : 0);
+
+ nerrors += (test_swmr_non_latest(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_earray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_farray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_bt2_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
+
+ if(H5Fclose(file) < 0)
+ goto error;
+ } /* end for new_format */
+ } /* end for minimized_ohdr */
} /* end for paged */
/* Close property lists */
@@ -13363,7 +13368,7 @@ main(void)
nerrors += (test_gather_error() < 0 ? 1 : 0);
/* Tests version bounds using its own file */
- nerrors += (test_versionbounds() < 0 ? 1 : 0);
+ nerrors += (test_versionbounds() < 0 ? 1 : 0);
nerrors += (test_object_header_minimization_dcpl() < 0 ? 1 : 0);
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 645608b..7e1adf5 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -21,7 +21,7 @@
#include "h5test.h"
/* Number of elements in each random test */
-#define NTESTELEM 10000
+#define NTESTELEM 10000
/* Epsilon for floating-point comparisons */
#define FP_EPSILON 0.000001F
@@ -30,7 +30,7 @@
* Offset from alinged memory returned by malloc(). This can be used to test
* that type conversions handle non-aligned buffers correctly.
*/
-#define ALIGNMENT 1
+#define ALIGNMENT 1
/*
* Define if you want to test alignment code on a machine that doesn't
@@ -41,7 +41,7 @@
/* Alignment test stuff */
#ifdef TEST_ALIGNMENT
-#define H5T_FRIEND /*suppress error about including H5Tpkg */
+#define H5T_FRIEND /*suppress error about including H5Tpkg */
#include "H5Tpkg.h"
#endif
#define SET_ALIGNMENT(TYPE,VAL) \
@@ -58,7 +58,7 @@ const char *FILENAME[] = {
* endian. If local variable `endian' is H5T_ORDER_BE then the result will
* be I, otherwise the result will be Z-(I+1).
*/
-#define ENDIAN(Z,I,E) (H5T_ORDER_BE==E?(I):(Z)-((I)+1))
+#define ENDIAN(Z,I,E) (H5T_ORDER_BE==E?(I):(Z)-((I)+1))
typedef enum dtype_t {
INT_SCHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT,
@@ -100,8 +100,8 @@ static int skip_overflow_tests_g = 0;
static int without_hardware_g = 0;
/* Allocates memory aligned on a certain boundary. */
-#define aligned_malloc(Z) ((void*)((char*)HDmalloc(ALIGNMENT+Z)+ALIGNMENT))
-#define aligned_free(M) HDfree((char*)(M)-ALIGNMENT)
+#define aligned_malloc(Z) ((void*)((char*)HDmalloc(ALIGNMENT+Z)+ALIGNMENT))
+#define aligned_free(M) HDfree((char*)(M)-ALIGNMENT)
/* Initialize source buffer of integer for integer->integer and integer->floating-point conversion test.
* This algorithm is mainly to avoid any casting and comparison between source and destination types
@@ -394,13 +394,13 @@ static int my_isinf(int endian, unsigned char *val, size_t size,
size_t mpos, size_t msize, size_t epos, size_t esize);
/*-------------------------------------------------------------------------
- * Function: fpe_handler
+ * Function: fpe_handler
*
- * Purpose: Exit with 255
+ * Purpose: Exit with 255
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, July 6, 1998
*
* Modifications:
@@ -419,16 +419,16 @@ fpe_handler(int H5_ATTR_UNUSED signo)
HDexit(255);
}
-
+
/*-------------------------------------------------------------------------
- * Function: reset_hdf5
+ * Function: reset_hdf5
*
- * Purpose: Reset the hdf5 library. This causes statistics to be printed
- * and counters to be reset.
+ * Purpose: Reset the hdf5 library. This causes statistics to be printed
+ * and counters to be reset.
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, November 16, 1998
*
* Modifications:
@@ -461,19 +461,19 @@ reset_hdf5(void)
}
-
+
/*-------------------------------------------------------------------------
- * Function: except_func
+ * Function: except_func
*
- * Purpose: Gets called for all data type conversion exceptions.
+ * Purpose: Gets called for all data type conversion exceptions.
*
- * Return: H5T_CONV_ABORT: -1
+ * Return: H5T_CONV_ABORT: -1
*
* H5T_CONV_UNHANDLED 0
*
* H5T_CONV_HANDLED 1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* April 19, 2004
*
* Modifications:
@@ -482,7 +482,7 @@ reset_hdf5(void)
*/
static H5T_conv_ret_t
except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id, void H5_ATTR_UNUSED *src_buf,
- void *dst_buf, void *user_data)
+ void *dst_buf, void *user_data)
{
H5T_conv_ret_t ret = H5T_CONV_HANDLED;
@@ -509,19 +509,19 @@ except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5
return ret;
}
-
+
/*-------------------------------------------------------------------------
- * Function: some_dummy_func
+ * Function: some_dummy_func
*
- * Purpose: A dummy function to help check for overflow.
+ * Purpose: A dummy function to help check for overflow.
*
- * Note: DO NOT DECLARE THIS FUNCTION STATIC OR THE COMPILER MIGHT
- * PROMOTE ARGUMENT `x' TO DOUBLE AND DEFEAT THE OVERFLOW
- * CHECKING.
+ * Note: DO NOT DECLARE THIS FUNCTION STATIC OR THE COMPILER MIGHT
+ * PROMOTE ARGUMENT `x' TO DOUBLE AND DEFEAT THE OVERFLOW
+ * CHECKING.
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, July 21, 1998
*
*-------------------------------------------------------------------------
@@ -529,21 +529,21 @@ except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5
void
some_dummy_func(float x)
{
- char s[128];
+ char s[128];
HDsnprintf(s, sizeof(s), "%g", (double)x);
}
-
+
/*-------------------------------------------------------------------------
- * Function: generates_sigfpe
+ * Function: generates_sigfpe
*
- * Purpose: Determines if SIGFPE is generated from overflows. We must be
- * able to fork() and waitpid() in order for this test to work
- * properly. Sets skip_overflow_tests_g to non-zero if they
- * would generate SIGBUS, zero otherwise.
+ * Purpose: Determines if SIGFPE is generated from overflows. We must be
+ * able to fork() and waitpid() in order for this test to work
+ * properly. Sets skip_overflow_tests_g to non-zero if they
+ * would generate SIGBUS, zero otherwise.
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, July 21, 1998
*
* Modifications:
@@ -554,38 +554,38 @@ static void
generates_sigfpe(void)
{
#if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)
- pid_t pid;
- int status;
- size_t i, j;
- double d;
+ pid_t pid;
+ int status;
+ size_t i, j;
+ double d;
unsigned char *dp = (unsigned char*)&d;
- float f;
+ float f;
HDfflush(stdout);
HDfflush(stderr);
if ((pid=fork()) < 0) {
- HDperror("fork");
- HDexit(EXIT_FAILURE);
+ HDperror("fork");
+ HDexit(EXIT_FAILURE);
} else if (0==pid) {
- for (i=0; i<2000; i++) {
- for(j = 0; j < sizeof(double); j++)
+ for (i=0; i<2000; i++) {
+ for(j = 0; j < sizeof(double); j++)
dp[j] = (unsigned char)HDrand();
- f = (float)d;
- some_dummy_func((float)f);
- }
- HDexit(EXIT_SUCCESS);
+ f = (float)d;
+ some_dummy_func((float)f);
+ }
+ HDexit(EXIT_SUCCESS);
}
while (pid!=waitpid(pid, &status, 0))
/*void*/;
if (WIFEXITED(status) && 0==WEXITSTATUS(status)) {
- HDputs("Floating-point overflow cases will be tested.");
- skip_overflow_tests_g = FALSE;
+ HDputs("Floating-point overflow cases will be tested.");
+ skip_overflow_tests_g = FALSE;
} else if (WIFSIGNALED(status) && SIGFPE==WTERMSIG(status)) {
- HDputs("Floating-point overflow cases cannot be safely tested.");
- skip_overflow_tests_g = TRUE;
- /* delete the core dump file that SIGFPE may have created */
- HDunlink("core");
+ HDputs("Floating-point overflow cases cannot be safely tested.");
+ skip_overflow_tests_g = TRUE;
+ /* delete the core dump file that SIGFPE may have created */
+ HDunlink("core");
}
#else
HDputs("Cannot determine if floating-point overflows generate a SIGFPE;");
@@ -595,7 +595,7 @@ generates_sigfpe(void)
#endif
}
-
+
/*-------------------------------------------------------------------------
* Function: test_hard_query
*
@@ -621,7 +621,7 @@ test_hard_query(void)
/* Verify the conversion from int to float is a hard conversion. */
if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != TRUE) {
H5_FAILED();
- printf("Can't query conversion function\n");
+ HDprintf("Can't query conversion function\n");
goto error;
}
@@ -630,7 +630,7 @@ test_hard_query(void)
H5Tunregister(H5T_PERS_HARD, NULL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (H5T_conv_t)((void (*) (void))H5T__conv_int_float));
if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != FALSE) {
H5_FAILED();
- printf("Can't query conversion function\n");
+ HDprintf("Can't query conversion function\n");
goto error;
}
@@ -639,7 +639,7 @@ test_hard_query(void)
H5Tregister(H5T_PERS_HARD, "int_flt", H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (H5T_conv_t)((void (*) (void))H5T__conv_int_float));
if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != TRUE) {
H5_FAILED();
- printf("Can't query conversion function\n");
+ HDprintf("Can't query conversion function\n");
goto error;
}
@@ -660,16 +660,16 @@ error:
return 1;
}
-
+
/*-------------------------------------------------------------------------
- * Function: expt_handle
+ * Function: expt_handle
*
- * Purpose: Gets called from test_particular_fp_integer() for data type
+ * Purpose: Gets called from test_particular_fp_integer() for data type
* conversion exceptions.
*
- * Return: H5T_CONV_HANDLED 1
+ * Return: H5T_CONV_HANDLED 1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Sept 7, 2005
*
* Modifications:
@@ -678,7 +678,7 @@ error:
*/
static H5T_conv_ret_t
expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id, void H5_ATTR_UNUSED *src_buf,
- void *dst_buf, void *user_data)
+ void *dst_buf, void *user_data)
{
signed char fill_value1 = 7;
int fill_value2 = 13;
@@ -694,7 +694,7 @@ expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5
return H5T_CONV_HANDLED;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_particular_fp_integer
*
@@ -714,12 +714,6 @@ expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5
* Return: Success: 0
*
* Failure: number of errors
- *
- * Programmer: Raymond Lu
- * Sept 7, 2005
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int test_particular_fp_integer(void)
@@ -735,7 +729,7 @@ static int test_particular_fp_integer(void)
float src_f = (float)INT_MAX;
int dst_i;
int fill_value = 13;
- int endian; /*endianess */
+ int endian; /*endianess */
unsigned int fails_this_test = 0;
size_t j;
@@ -743,7 +737,7 @@ static int test_particular_fp_integer(void)
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
- printf("Can't create data transfer property list\n");
+ HDprintf("Can't create data transfer property list\n");
goto error;
}
@@ -754,25 +748,25 @@ static int test_particular_fp_integer(void)
buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
saved_buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
- memcpy(buf1, &src_d, src_size1);
- memcpy(saved_buf1, &src_d, src_size1);
+ HDmemcpy(buf1, &src_d, src_size1);
+ HDmemcpy(saved_buf1, &src_d, src_size1);
/* Register exception handling function and signal the destination is "signed char". */
flag = 1;
if(H5Pset_type_conv_cb(dxpl_id, expt_handle, &flag) < 0) {
H5_FAILED();
- printf("Can't register conversion callback\n");
+ HDprintf("Can't register conversion callback\n");
goto error;
}
/* Do conversion */
if(H5Tconvert(H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR, (size_t)1, buf1, NULL, dxpl_id) < 0) {
H5_FAILED();
- printf("Can't convert data\n");
+ HDprintf("Can't convert data\n");
goto error;
}
- memcpy(&dst_c, buf1, dst_size1);
+ HDmemcpy(&dst_c, buf1, dst_size1);
/* Print errors */
if(dst_c != SCHAR_MAX) {
@@ -782,20 +776,20 @@ static int test_particular_fp_integer(void)
if(0 == fails_this_test++)
H5_FAILED();
- printf(" test double to signed char:\n");
- printf(" src = ");
+ HDprintf(" test double to signed char:\n");
+ HDprintf(" src = ");
for (j=0; j<src_size1; j++)
- printf(" %02x", saved_buf1[ENDIAN(src_size1, j, endian)]);
+ HDprintf(" %02x", saved_buf1[ENDIAN(src_size1, j, endian)]);
HDmemcpy(&x, saved_buf1, src_size1);
- printf(" %29.20e\n", x);
+ HDprintf(" %29.20e\n", x);
- printf(" dst = ");
+ HDprintf(" dst = ");
for (j=0; j<dst_size1; j++)
- printf(" %02x", buf1[ENDIAN(dst_size1, j, endian)]);
+ HDprintf(" %02x", buf1[ENDIAN(dst_size1, j, endian)]);
HDmemcpy(&y, buf1, dst_size1);
- printf(" %29d\n", y);
+ HDprintf(" %29d\n", y);
}
/* Test conversion from float (the value is INT_MAX) to int. */
@@ -812,11 +806,11 @@ static int test_particular_fp_integer(void)
/* Do conversion */
if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)1, buf2, NULL, dxpl_id) < 0) {
H5_FAILED();
- printf("Can't convert data\n");
+ HDprintf("Can't convert data\n");
goto error;
}
- memcpy(&dst_i, buf2, dst_size2);
+ HDmemcpy(&dst_i, buf2, dst_size2);
/* Print errors */
if(dst_i != fill_value) {
@@ -826,20 +820,20 @@ static int test_particular_fp_integer(void)
if(0 == fails_this_test++)
H5_FAILED();
- printf(" test float to int:\n");
- printf(" src = ");
+ HDprintf(" test float to int:\n");
+ HDprintf(" src = ");
for (j=0; j<src_size2; j++)
- printf(" %02x", saved_buf2[ENDIAN(src_size2, j, endian)]);
+ HDprintf(" %02x", saved_buf2[ENDIAN(src_size2, j, endian)]);
HDmemcpy(&x, saved_buf2, src_size2);
- printf(" %29.20e\n", (double)x);
+ HDprintf(" %29.20e\n", (double)x);
- printf(" dst = ");
+ HDprintf(" dst = ");
for (j=0; j<dst_size2; j++)
- printf(" %02x", buf2[ENDIAN(dst_size2, j, endian)]);
+ HDprintf(" %02x", buf2[ENDIAN(dst_size2, j, endian)]);
HDmemcpy(&y, buf2, dst_size2);
- printf(" %29d\n", y);
+ HDprintf(" %29d\n", y);
}
if(fails_this_test)
@@ -847,7 +841,7 @@ static int test_particular_fp_integer(void)
if(H5Pclose(dxpl_id) < 0) {
H5_FAILED();
- printf("Can't close property list\n");
+ HDprintf("Can't close property list\n");
goto error;
}
@@ -885,7 +879,7 @@ error:
return MAX((int)fails_this_test, 1);
}
-
+
/*-------------------------------------------------------------------------
* Function: test_derived_flt
*
@@ -912,11 +906,11 @@ test_derived_flt(void)
size_t src_size, dst_size;
unsigned char *buf=NULL, *saved_buf=NULL;
int *aligned=NULL;
- int endian; /*endianess */
+ int endian; /*endianess */
size_t nelmts = NTESTELEM;
unsigned int fails_this_test = 0;
- const size_t max_fails=40; /*max number of failures*/
- char str[256]; /*message string */
+ const size_t max_fails=40; /*max number of failures*/
+ char str[256]; /*message string */
unsigned int i, j;
TESTING("user-define and query functions of floating-point types");
@@ -925,25 +919,25 @@ test_derived_flt(void)
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
- printf("Can't create file\n");
+ HDprintf("Can't create file\n");
goto error;
}
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
- printf("Can't create data transfer property list\n");
+ HDprintf("Can't create data transfer property list\n");
goto error;
}
if((tid1 = H5Tcopy(H5T_IEEE_F64LE)) < 0) {
H5_FAILED();
- printf("Can't copy data type\n");
+ HDprintf("Can't copy data type\n");
goto error;
}
if((tid2 = H5Tcopy(H5T_IEEE_F32LE)) < 0) {
H5_FAILED();
- printf("Can't copy data type\n");
+ HDprintf("Can't copy data type\n");
goto error;
}
@@ -967,44 +961,44 @@ test_derived_flt(void)
*-----------------------------------------------------------------------*/
if(H5Tset_fields(tid1, (size_t)44, (size_t)34, (size_t)10, (size_t)3, (size_t)31) < 0) {
H5_FAILED();
- printf("Can't set fields\n");
+ HDprintf("Can't set fields\n");
goto error;
}
if(H5Tset_offset(tid1, (size_t)3) < 0) {
H5_FAILED();
- printf("Can't set offset\n");
+ HDprintf("Can't set offset\n");
goto error;
}
if(H5Tset_precision(tid1, (size_t)42) < 0) {
H5_FAILED();
- printf("Can't set precision 1\n");
+ HDprintf("Can't set precision 1\n");
goto error;
}
if(H5Tset_size(tid1, (size_t)7) < 0) {
H5_FAILED();
- printf("Can't set size\n");
+ HDprintf("Can't set size\n");
goto error;
}
if(H5Tset_ebias(tid1, (size_t)511) < 0) {
H5_FAILED();
- printf("Can't set exponent bias\n");
+ HDprintf("Can't set exponent bias\n");
goto error;
}
if(H5Tset_pad(tid1, H5T_PAD_ZERO, H5T_PAD_ZERO) < 0) {
H5_FAILED();
- printf("Can't set padding\n");
+ HDprintf("Can't set padding\n");
goto error;
}
if(H5Tcommit2(file, "new float type 1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
- printf("Can't set inpad\n");
+ HDprintf("Can't set inpad\n");
goto error;
}
if(H5Tclose(tid1) < 0) {
H5_FAILED();
- printf("Can't close datatype\n");
+ HDprintf("Can't close datatype\n");
goto error;
}
@@ -1012,33 +1006,33 @@ test_derived_flt(void)
FAIL_PUTS_ERROR("Can't open datatype")
if(H5Tget_fields(tid1, &spos, &epos, &esize, &mpos, &msize) < 0) {
H5_FAILED();
- printf("Can't get fields\n");
+ HDprintf("Can't get fields\n");
goto error;
}
if(spos != 44 || epos != 34 || esize != 10 || mpos != 3 || msize != 31) {
H5_FAILED();
- printf("Wrong field values\n");
+ HDprintf("Wrong field values\n");
goto error;
}
if(H5Tget_precision(tid1) != 42) {
H5_FAILED();
- printf("Can't get precision or wrong precision\n");
+ HDprintf("Can't get precision or wrong precision\n");
goto error;
}
if(H5Tget_offset(tid1)!=3) {
H5_FAILED();
- printf("Can't get offset or wrong offset\n");
+ HDprintf("Can't get offset or wrong offset\n");
goto error;
}
if((size = H5Tget_size(tid1))!=7) {
H5_FAILED();
- printf("Can't get size or wrong size\n");
+ HDprintf("Can't get size or wrong size\n");
goto error;
}
if(H5Tget_ebias(tid1)!=511) {
H5_FAILED();
- printf("Can't get exponent bias or wrong bias\n");
+ HDprintf("Can't get exponent bias or wrong bias\n");
goto error;
}
@@ -1061,13 +1055,13 @@ test_derived_flt(void)
* The mantissa is big enough to retain the integer's precision. */
if(H5Tconvert(H5T_NATIVE_INT, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
- printf("Can't convert data\n");
+ HDprintf("Can't convert data\n");
goto error;
}
/* Convert data from the derived floating-point type back to native integer. */
if(H5Tconvert(tid1, H5T_NATIVE_INT, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
- printf("Can't convert data\n");
+ HDprintf("Can't convert data\n");
goto error;
}
@@ -1081,26 +1075,26 @@ test_derived_flt(void)
/* Print errors */
if (0==fails_this_test++) {
- HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions");
- printf("%-70s", str);
- HDfflush(stdout);
+ HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions");
+ HDprintf("%-70s", str);
+ HDfflush(stdout);
H5_FAILED();
}
- printf(" test %u elmt %u: \n", 1, (unsigned)i);
+ HDprintf(" test %u elmt %u: \n", 1, (unsigned)i);
- printf(" src = ");
+ HDprintf(" src = ");
for (j=0; j<src_size; j++)
- printf(" %02x", saved_buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ HDprintf(" %02x", saved_buf[i*src_size+ENDIAN(src_size, j, endian)]);
HDmemcpy(aligned, saved_buf+i*sizeof(int), sizeof(int));
- printf(" %29d\n", *aligned);
+ HDprintf(" %29d\n", *aligned);
- printf(" dst = ");
+ HDprintf(" dst = ");
for (j=0; j<src_size; j++)
- printf(" %02x", buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ HDprintf(" %02x", buf[i*src_size+ENDIAN(src_size, j, endian)]);
HDmemcpy(aligned, buf+i*sizeof(int), sizeof(int));
- printf(" %29d\n", *aligned);
+ HDprintf(" %29d\n", *aligned);
if (fails_this_test>=max_fails) {
HDputs(" maximum failures reached, aborting test...");
@@ -1127,43 +1121,43 @@ test_derived_flt(void)
*--------------------------------------------------------------------------*/
if(H5Tset_fields(tid2, (size_t)23, (size_t)16, (size_t)7, (size_t)0, (size_t)16) < 0) {
H5_FAILED();
- printf("Can't set fields\n");
+ HDprintf("Can't set fields\n");
goto error;
}
if(H5Tset_offset(tid2, (size_t)0) < 0) {
H5_FAILED();
- printf("Can't set offset\n");
+ HDprintf("Can't set offset\n");
goto error;
}
if(H5Tset_precision(tid2, (size_t)24) < 0) {
H5_FAILED();
- printf("Can't set precision 2\n");
+ HDprintf("Can't set precision 2\n");
goto error;
}
if(H5Tset_size(tid2, (size_t)3) < 0) {
H5_FAILED();
- printf("Can't set size\n");
+ HDprintf("Can't set size\n");
goto error;
}
if(H5Tset_ebias(tid2, (size_t)63) < 0) {
H5_FAILED();
- printf("Can't set size\n");
+ HDprintf("Can't set size\n");
goto error;
}
if(H5Tset_pad(tid2, H5T_PAD_ZERO, H5T_PAD_ZERO) < 0) {
H5_FAILED();
- printf("Can't set padding\n");
+ HDprintf("Can't set padding\n");
goto error;
}
if(H5Tcommit2(file, "new float type 2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
- printf("Can't set inpad\n");
+ HDprintf("Can't set inpad\n");
goto error;
}
if(H5Tclose(tid2) < 0) {
H5_FAILED();
- printf("Can't close datatype\n");
+ HDprintf("Can't close datatype\n");
goto error;
}
@@ -1171,33 +1165,33 @@ test_derived_flt(void)
FAIL_PUTS_ERROR("Can't open datatype")
if(H5Tget_fields(tid2, &spos, &epos, &esize, &mpos, &msize) < 0) {
H5_FAILED();
- printf("Can't get fields\n");
+ HDprintf("Can't get fields\n");
goto error;
}
if(spos != 23 || epos != 16 || esize != 7 || mpos != 0 || msize != 16) {
H5_FAILED();
- printf("Wrong field values\n");
+ HDprintf("Wrong field values\n");
goto error;
}
if(H5Tget_precision(tid2) != 24) {
H5_FAILED();
- printf("Can't get precision or wrong precision\n");
+ HDprintf("Can't get precision or wrong precision\n");
goto error;
}
if(H5Tget_offset(tid2)!=0) {
H5_FAILED();
- printf("Can't get offset or wrong offset\n");
+ HDprintf("Can't get offset or wrong offset\n");
goto error;
}
if((size = H5Tget_size(tid2))!=3) {
H5_FAILED();
- printf("Can't get size or wrong size\n");
+ HDprintf("Can't get size or wrong size\n");
goto error;
}
if(H5Tget_ebias(tid2)!=63) {
H5_FAILED();
- printf("Can't get exponent bias or wrong bias\n");
+ HDprintf("Can't get exponent bias or wrong bias\n");
goto error;
}
@@ -1221,13 +1215,13 @@ test_derived_flt(void)
* the precision and exponent power. */
if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
- printf("Can't convert data\n");
+ HDprintf("Can't convert data\n");
goto error;
}
/* Convert data from the 1st back to the 2nd derived floating-point type. */
if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
- printf("Can't convert data\n");
+ HDprintf("Can't convert data\n");
goto error;
}
@@ -1249,22 +1243,22 @@ test_derived_flt(void)
/* Print errors */
if (0==fails_this_test++) {
- HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions");
- printf("%-70s", str);
- HDfflush(stdout);
+ HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions");
+ HDprintf("%-70s", str);
+ HDfflush(stdout);
H5_FAILED();
}
- printf(" test %u elmt %u: \n", 1, (unsigned)i);
+ HDprintf(" test %u elmt %u: \n", 1, (unsigned)i);
- printf(" src = ");
+ HDprintf(" src = ");
for (j=0; j<src_size; j++)
- printf(" %02x", saved_buf[i*src_size+ENDIAN(src_size, j, endian)]);
- printf("\n");
+ HDprintf(" %02x", saved_buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ HDprintf("\n");
- printf(" dst = ");
+ HDprintf(" dst = ");
for (j=0; j<src_size; j++)
- printf(" %02x", buf[i*src_size+ENDIAN(src_size, j, endian)]);
- printf("\n");
+ HDprintf(" %02x", buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ HDprintf("\n");
if (fails_this_test>=max_fails) {
HDputs(" maximum failures reached, aborting test...");
@@ -1277,25 +1271,25 @@ test_derived_flt(void)
if(H5Tclose(tid1) < 0) {
H5_FAILED();
- printf("Can't close datatype\n");
+ HDprintf("Can't close datatype\n");
goto error;
}
if(H5Tclose(tid2) < 0) {
H5_FAILED();
- printf("Can't close datatype\n");
+ HDprintf("Can't close datatype\n");
goto error;
}
if(H5Pclose(dxpl_id) < 0) {
H5_FAILED();
- printf("Can't close property list\n");
+ HDprintf("Can't close property list\n");
goto error;
}
if(H5Fclose(file) < 0) {
H5_FAILED();
- printf("Can't close file\n");
+ HDprintf("Can't close file\n");
goto error;
} /* end if */
@@ -1304,7 +1298,7 @@ test_derived_flt(void)
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
return 0;
@@ -1328,7 +1322,7 @@ test_derived_flt(void)
return MAX((int)fails_this_test, 1);
}
-
+
/*-------------------------------------------------------------------------
* Function: test_derived_integer
*
@@ -1353,11 +1347,11 @@ test_derived_integer(void)
char filename[1024];
size_t src_size, dst_size;
unsigned char *buf=NULL, *saved_buf=NULL;
- int endian; /*endianess */
+ int endian; /*endianess */
size_t nelmts = NTESTELEM;
unsigned int fails_this_test = 0;
- const size_t max_fails=40; /*max number of failures*/
- char str[256]; /*message string */
+ const size_t max_fails=40; /*max number of failures*/
+ char str[256]; /*message string */
unsigned int i, j;
TESTING("user-define and query functions of integer types");
@@ -1366,25 +1360,25 @@ test_derived_integer(void)
h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof filename);
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
H5_FAILED();
- printf("Can't create file\n");
+ HDprintf("Can't create file\n");
goto error;
}
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
H5_FAILED();
- printf("Can't create data transfer property list\n");
+ HDprintf("Can't create data transfer property list\n");
goto error;
}
if((tid1 = H5Tcopy(H5T_STD_I32LE)) < 0) {
H5_FAILED();
- printf("Can't copy data type\n");
+ HDprintf("Can't copy data type\n");
goto error;
}
if((tid2 = H5Tcopy(H5T_STD_U64LE)) < 0) {
H5_FAILED();
- printf("Can't copy data type\n");
+ HDprintf("Can't copy data type\n");
goto error;
}
@@ -1402,37 +1396,37 @@ test_derived_integer(void)
*--------------------------------------------------------------------------*/
if(H5Tset_offset(tid1, (size_t)0) < 0) {
H5_FAILED();
- printf("Can't set offset\n");
+ HDprintf("Can't set offset\n");
goto error;
}
if(H5Tset_size(tid1, (size_t)3) < 0) {
H5_FAILED();
- printf("Can't set size\n");
+ HDprintf("Can't set size\n");
goto error;
}
if(H5Tset_precision(tid1, (size_t)24) < 0) {
H5_FAILED();
- printf("Can't set precision\n");
+ HDprintf("Can't set precision\n");
goto error;
}
if(H5Tset_order(tid1, H5T_ORDER_BE) < 0) {
H5_FAILED();
- printf("Can't set order\n");
+ HDprintf("Can't set order\n");
goto error;
}
if(H5Tcommit2(file, "new integer type 1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
- printf("Can't commit data type\n");
+ HDprintf("Can't commit data type\n");
goto error;
}
if(H5Tclose(tid1) < 0) {
H5_FAILED();
- printf("Can't close datatype\n");
+ HDprintf("Can't close datatype\n");
goto error;
}
@@ -1440,22 +1434,22 @@ test_derived_integer(void)
FAIL_PUTS_ERROR("Can't open datatype")
if(H5Tget_precision(tid1) != 24) {
H5_FAILED();
- printf("Can't get precision or wrong precision\n");
+ HDprintf("Can't get precision or wrong precision\n");
goto error;
}
if(H5Tget_offset(tid1) != 0) {
H5_FAILED();
- printf("Can't get offset or wrong offset\n");
+ HDprintf("Can't get offset or wrong offset\n");
goto error;
}
if(H5Tget_size(tid1) != 3) {
H5_FAILED();
- printf("Can't get size or wrong size\n");
+ HDprintf("Can't get size or wrong size\n");
goto error;
}
if(H5Tget_order(tid1)!=H5T_ORDER_BE) {
H5_FAILED();
- printf("Can't get order or wrong order\n");
+ HDprintf("Can't get order or wrong order\n");
goto error;
}
@@ -1469,31 +1463,31 @@ test_derived_integer(void)
*--------------------------------------------------------------------------*/
if(H5Tset_precision(tid2, (size_t)48) < 0) {
H5_FAILED();
- printf("Can't set precision\n");
+ HDprintf("Can't set precision\n");
goto error;
}
if(H5Tset_offset(tid2, (size_t)10) < 0) {
H5_FAILED();
- printf("Can't set offset\n");
+ HDprintf("Can't set offset\n");
goto error;
}
if(H5Tset_sign(tid2, H5T_SGN_2) < 0) {
H5_FAILED();
- printf("Can't set offset\n");
+ HDprintf("Can't set offset\n");
goto error;
}
if(H5Tcommit2(file, "new integer type 2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
H5_FAILED();
- printf("Can't commit data type\n");
+ HDprintf("Can't commit data type\n");
goto error;
}
if(H5Tclose(tid2) < 0) {
H5_FAILED();
- printf("Can't close datatype\n");
+ HDprintf("Can't close datatype\n");
goto error;
}
@@ -1501,22 +1495,22 @@ test_derived_integer(void)
FAIL_PUTS_ERROR("Can't open datatype")
if(H5Tget_precision(tid2) != 48) {
H5_FAILED();
- printf("Can't get precision or wrong precision\n");
+ HDprintf("Can't get precision or wrong precision\n");
goto error;
}
if(H5Tget_offset(tid2) != 10) {
H5_FAILED();
- printf("Can't get offset or wrong offset\n");
+ HDprintf("Can't get offset or wrong offset\n");
goto error;
}
if(H5Tget_size(tid2) != 8) {
H5_FAILED();
- printf("Can't get size or wrong size\n");
+ HDprintf("Can't get size or wrong size\n");
goto error;
}
if(H5Tget_sign(tid2)!=H5T_SGN_2) {
H5_FAILED();
- printf("Can't get sign or wrong sign\n");
+ HDprintf("Can't get sign or wrong sign\n");
goto error;
}
@@ -1540,13 +1534,13 @@ test_derived_integer(void)
* the 1st type's precision. */
if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
- printf("Can't convert data\n");
+ HDprintf("Can't convert data\n");
goto error;
}
/* Convert data from the 2nd back to the 1st derived integer type. */
if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) {
H5_FAILED();
- printf("Can't convert data\n");
+ HDprintf("Can't convert data\n");
goto error;
}
@@ -1560,22 +1554,22 @@ test_derived_integer(void)
/* Print errors */
if (0==fails_this_test++) {
- HDsnprintf(str, sizeof(str), "\nTesting random sw derived integer -> derived integer conversions");
- printf("%-70s", str);
- HDfflush(stdout);
+ HDsnprintf(str, sizeof(str), "\nTesting random sw derived integer -> derived integer conversions");
+ HDprintf("%-70s", str);
+ HDfflush(stdout);
H5_FAILED();
}
- printf(" test %u elmt %u: \n", 1, (unsigned)i);
+ HDprintf(" test %u elmt %u: \n", 1, (unsigned)i);
- printf(" src = ");
+ HDprintf(" src = ");
for (j=0; j<src_size; j++)
- printf(" %02x", saved_buf[i*src_size+ENDIAN(src_size, j, endian)]);
- printf("\n");
+ HDprintf(" %02x", saved_buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ HDprintf("\n");
- printf(" dst = ");
+ HDprintf(" dst = ");
for (j=0; j<src_size; j++)
- printf(" %02x", buf[i*src_size+ENDIAN(src_size, j, endian)]);
- printf("\n");
+ HDprintf(" %02x", buf[i*src_size+ENDIAN(src_size, j, endian)]);
+ HDprintf("\n");
if (fails_this_test>=max_fails) {
HDputs(" maximum failures reached, aborting test...");
@@ -1585,25 +1579,25 @@ test_derived_integer(void)
if(H5Tclose(tid1) < 0) {
H5_FAILED();
- printf("Can't close datatype\n");
+ HDprintf("Can't close datatype\n");
goto error;
}
if(H5Tclose(tid2) < 0) {
H5_FAILED();
- printf("Can't close datatype\n");
+ HDprintf("Can't close datatype\n");
goto error;
}
if(H5Pclose(dxpl_id) < 0) {
H5_FAILED();
- printf("Can't close property list\n");
+ HDprintf("Can't close property list\n");
goto error;
}
if(H5Fclose(file) < 0) {
H5_FAILED();
- printf("Can't close file\n");
+ HDprintf("Can't close file\n");
goto error;
} /* end if */
@@ -1615,7 +1609,7 @@ test_derived_integer(void)
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
return 0;
@@ -1638,24 +1632,24 @@ test_derived_integer(void)
return MAX((int)fails_this_test, 1);
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_conv_int_1
+ * Function: test_conv_int_1
*
- * Purpose: Test conversion of integer values from SRC to DST.
- * These types should be any combination of:
+ * Purpose: Test conversion of integer values from SRC to DST.
+ * These types should be any combination of:
*
- * H5T_NATIVE_SCHAR H5T_NATIVE_UCHAR
- * H5T_NATIVE_SHORT H5T_NATIVE_USHORT
- * H5T_NATIVE_INT H5T_NATIVE_UINT
- * H5T_NATIVE_LONG H5T_NATIVE_ULONG
- * H5T_NATIVE_LLONG H5T_NATIVE_ULLONG
+ * H5T_NATIVE_SCHAR H5T_NATIVE_UCHAR
+ * H5T_NATIVE_SHORT H5T_NATIVE_USHORT
+ * H5T_NATIVE_INT H5T_NATIVE_UINT
+ * H5T_NATIVE_LONG H5T_NATIVE_ULONG
+ * H5T_NATIVE_LLONG H5T_NATIVE_ULLONG
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, November 16, 1998
*
* Modifications:
@@ -1665,121 +1659,121 @@ test_derived_integer(void)
static int
test_conv_int_1(const char *name, hid_t src, hid_t dst)
{
- size_t nelmts=0; /*num values per test */
- const size_t max_fails=8; /*max number of failures*/
- size_t fails_all_tests=0; /*number of failures */
- size_t fails_this_test; /*fails for this test */
- char str[256]; /*hello string */
- dtype_t src_type, dst_type; /*data types */
- const char *src_type_name=NULL; /*source type name */
- const char *dst_type_name=NULL; /*destination type name */
- int endian; /*machine endianess */
- size_t src_size, dst_size; /*type sizes */
- unsigned char *buf=NULL; /*buffer for conversion */
- unsigned char *saved=NULL; /*original values */
- size_t j, k; /*counters */
- unsigned char *hw=NULL; /*hardware conv result */
- unsigned char src_bits[32]; /*src value in LE order */
- unsigned char dst_bits[32]; /*dest value in LE order*/
- size_t src_nbits; /*source length in bits */
- size_t dst_nbits; /*dst length in bits */
+ size_t nelmts=0; /*num values per test */
+ const size_t max_fails=8; /*max number of failures*/
+ size_t fails_all_tests=0; /*number of failures */
+ size_t fails_this_test; /*fails for this test */
+ char str[256]; /*hello string */
+ dtype_t src_type, dst_type; /*data types */
+ const char *src_type_name=NULL; /*source type name */
+ const char *dst_type_name=NULL; /*destination type name */
+ int endian; /*machine endianess */
+ size_t src_size, dst_size; /*type sizes */
+ unsigned char *buf=NULL; /*buffer for conversion */
+ unsigned char *saved=NULL; /*original values */
+ size_t j, k; /*counters */
+ unsigned char *hw=NULL; /*hardware conv result */
+ unsigned char src_bits[32]; /*src value in LE order */
+ unsigned char dst_bits[32]; /*dest value in LE order*/
+ size_t src_nbits; /*source length in bits */
+ size_t dst_nbits; /*dst length in bits */
H5T_sign_t src_sign; /*source sign type */
H5T_sign_t dst_sign; /*dst sign type */
- void *aligned=NULL; /*aligned temp buffer */
- signed char hw_char;
- unsigned char hw_uchar;
- short hw_short;
- unsigned short hw_ushort;
- int hw_int;
- unsigned hw_uint;
- long hw_long;
- unsigned long hw_ulong;
- long long hw_llong;
- unsigned long long hw_ullong;
+ void *aligned=NULL; /*aligned temp buffer */
+ signed char hw_char;
+ unsigned char hw_uchar;
+ short hw_short;
+ unsigned short hw_ushort;
+ int hw_int;
+ unsigned hw_uint;
+ long hw_long;
+ unsigned long hw_ulong;
+ long long hw_llong;
+ unsigned long long hw_ullong;
/* What are the names of the source and destination types */
if (H5Tequal(src, H5T_NATIVE_SCHAR)) {
- src_type_name = "signed char";
- src_type = INT_SCHAR;
+ src_type_name = "signed char";
+ src_type = INT_SCHAR;
} else if (H5Tequal(src, H5T_NATIVE_UCHAR)) {
- src_type_name = "unsigned char";
- src_type = INT_UCHAR;
+ src_type_name = "unsigned char";
+ src_type = INT_UCHAR;
} else if (H5Tequal(src, H5T_NATIVE_SHORT)) {
- src_type_name = "short";
- src_type = INT_SHORT;
+ src_type_name = "short";
+ src_type = INT_SHORT;
} else if (H5Tequal(src, H5T_NATIVE_USHORT)) {
- src_type_name = "unsigned short";
- src_type = INT_USHORT;
+ src_type_name = "unsigned short";
+ src_type = INT_USHORT;
} else if (H5Tequal(src, H5T_NATIVE_INT)) {
- src_type_name = "int";
- src_type = INT_INT;
+ src_type_name = "int";
+ src_type = INT_INT;
} else if (H5Tequal(src, H5T_NATIVE_UINT)) {
- src_type_name = "unsigned int";
- src_type = INT_UINT;
+ src_type_name = "unsigned int";
+ src_type = INT_UINT;
} else if (H5Tequal(src, H5T_NATIVE_LONG)) {
- src_type_name = "long";
- src_type = INT_LONG;
+ src_type_name = "long";
+ src_type = INT_LONG;
} else if (H5Tequal(src, H5T_NATIVE_ULONG)) {
- src_type_name = "unsigned long";
- src_type = INT_ULONG;
+ src_type_name = "unsigned long";
+ src_type = INT_ULONG;
} else if (H5Tequal(src, H5T_NATIVE_LLONG)) {
- src_type_name = "long long";
- src_type = INT_LLONG;
+ src_type_name = "long long";
+ src_type = INT_LLONG;
} else if (H5Tequal(src, H5T_NATIVE_ULLONG)) {
- src_type_name = "unsigned long long";
- src_type = INT_ULLONG;
+ src_type_name = "unsigned long long";
+ src_type = INT_ULLONG;
} else {
- src_type_name = "UNKNOWN";
- src_type = OTHER;
+ src_type_name = "UNKNOWN";
+ src_type = OTHER;
}
if (H5Tequal(dst, H5T_NATIVE_SCHAR)) {
- dst_type_name = "signed char";
- dst_type = INT_SCHAR;
+ dst_type_name = "signed char";
+ dst_type = INT_SCHAR;
} else if (H5Tequal(dst, H5T_NATIVE_UCHAR)) {
- dst_type_name = "unsigned char";
- dst_type = INT_UCHAR;
+ dst_type_name = "unsigned char";
+ dst_type = INT_UCHAR;
} else if (H5Tequal(dst, H5T_NATIVE_SHORT)) {
- dst_type_name = "short";
- dst_type = INT_SHORT;
+ dst_type_name = "short";
+ dst_type = INT_SHORT;
} else if (H5Tequal(dst, H5T_NATIVE_USHORT)) {
- dst_type_name = "unsigned short";
- dst_type = INT_USHORT;
+ dst_type_name = "unsigned short";
+ dst_type = INT_USHORT;
} else if (H5Tequal(dst, H5T_NATIVE_INT)) {
- dst_type_name = "int";
- dst_type = INT_INT;
+ dst_type_name = "int";
+ dst_type = INT_INT;
} else if (H5Tequal(dst, H5T_NATIVE_UINT)) {
- dst_type_name = "unsigned int";
- dst_type = INT_UINT;
+ dst_type_name = "unsigned int";
+ dst_type = INT_UINT;
} else if (H5Tequal(dst, H5T_NATIVE_LONG)) {
- dst_type_name = "long";
- dst_type = INT_LONG;
+ dst_type_name = "long";
+ dst_type = INT_LONG;
} else if (H5Tequal(dst, H5T_NATIVE_ULONG)) {
- dst_type_name = "unsigned long";
- dst_type = INT_ULONG;
+ dst_type_name = "unsigned long";
+ dst_type = INT_ULONG;
} else if (H5Tequal(dst, H5T_NATIVE_LLONG)) {
- dst_type_name = "long long";
- dst_type = INT_LLONG;
+ dst_type_name = "long long";
+ dst_type = INT_LLONG;
} else if (H5Tequal(dst, H5T_NATIVE_ULLONG)) {
- dst_type_name = "unsigned long long";
- dst_type = INT_ULLONG;
+ dst_type_name = "unsigned long long";
+ dst_type = INT_ULLONG;
} else {
- dst_type_name = "UNKNOWN";
- dst_type = OTHER;
+ dst_type_name = "UNKNOWN";
+ dst_type = OTHER;
}
/* Sanity checks */
if (OTHER==src_type || OTHER==dst_type) {
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
- printf("%-70s", str);
- H5_FAILED();
- HDputs(" Unknown data type.");
- goto error;
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
+ name, src_type_name, dst_type_name);
+ HDprintf("%-70s", str);
+ H5_FAILED();
+ HDputs(" Unknown data type.");
+ goto error;
} else {
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, src_type_name, dst_type_name);
- printf("%-70s", str);
+ HDprintf("%-70s", str);
HDfflush(stdout);
fails_this_test=0;
}
@@ -2462,44 +2456,44 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
/* Print errors */
if (0==fails_this_test++)
H5_FAILED();
- printf(" elmt %u\n", (unsigned)j);
+ HDprintf(" elmt %u\n", (unsigned)j);
- printf(" src = ");
+ HDprintf(" src = ");
for (k=0; k<src_size; k++)
- printf(" %02x", saved[j*src_size+ENDIAN(src_size, k, endian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
+ HDprintf(" %02x", saved[j*src_size+ENDIAN(src_size, k, endian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
switch (src_type) {
case INT_SCHAR:
HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- printf(" %29d\n", (int)*((signed char*)aligned));
+ HDprintf(" %29d\n", (int)*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- printf(" %29u\n", (unsigned)*((unsigned char*)aligned));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char*)aligned));
break;
case INT_SHORT:
HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- printf(" %29hd\n", *((short*)aligned));
+ HDprintf(" %29hd\n", *((short*)aligned));
break;
case INT_USHORT:
HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- printf(" %29hu\n", *((unsigned short*)aligned));
+ HDprintf(" %29hu\n", *((unsigned short*)aligned));
break;
case INT_INT:
HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- printf(" %29d\n", *((int*)aligned));
+ HDprintf(" %29d\n", *((int*)aligned));
break;
case INT_UINT:
HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- printf(" %29u\n", *((unsigned*)aligned));
+ HDprintf(" %29u\n", *((unsigned*)aligned));
break;
case INT_LONG:
HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- printf(" %29ld\n", *((long*)aligned));
+ HDprintf(" %29ld\n", *((long*)aligned));
break;
case INT_ULONG:
HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- printf(" %29lu\n", *((unsigned long*)aligned));
+ HDprintf(" %29lu\n", *((unsigned long*)aligned));
break;
case INT_LLONG:
HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
@@ -2518,42 +2512,42 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
break;
}
- printf(" dst = ");
+ HDprintf(" dst = ");
for (k=0; k<dst_size; k++)
- printf(" %02x", buf[j*dst_size+ENDIAN(dst_size, k, endian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ HDprintf(" %02x", buf[j*dst_size+ENDIAN(dst_size, k, endian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
switch (dst_type) {
case INT_SCHAR:
HDmemcpy(aligned, buf+j*sizeof(signed char), sizeof(signed char));
- printf(" %29d\n", (int)*((signed char*)aligned));
+ HDprintf(" %29d\n", (int)*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, buf+j*sizeof(unsigned char), sizeof(unsigned char));
- printf(" %29u\n", (unsigned)*((unsigned char*)aligned));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char*)aligned));
break;
case INT_SHORT:
HDmemcpy(aligned, buf+j*sizeof(short), sizeof(short));
- printf(" %29hd\n", *((short*)aligned));
+ HDprintf(" %29hd\n", *((short*)aligned));
break;
case INT_USHORT:
HDmemcpy(aligned, buf+j*sizeof(unsigned short), sizeof(unsigned short));
- printf(" %29hu\n", *((unsigned short*)aligned));
+ HDprintf(" %29hu\n", *((unsigned short*)aligned));
break;
case INT_INT:
HDmemcpy(aligned, buf+j*sizeof(int), sizeof(int));
- printf(" %29d\n", *((int*)aligned));
+ HDprintf(" %29d\n", *((int*)aligned));
break;
case INT_UINT:
HDmemcpy(aligned, buf+j*sizeof(unsigned), sizeof(unsigned));
- printf(" %29u\n", *((unsigned*)aligned));
+ HDprintf(" %29u\n", *((unsigned*)aligned));
break;
case INT_LONG:
HDmemcpy(aligned, buf+j*sizeof(long), sizeof(long));
- printf(" %29ld\n", *((long*)aligned));
+ HDprintf(" %29ld\n", *((long*)aligned));
break;
case INT_ULONG:
HDmemcpy(aligned, buf+j*sizeof(unsigned long), sizeof(unsigned long));
- printf(" %29lu\n", *((unsigned long*)aligned));
+ HDprintf(" %29lu\n", *((unsigned long*)aligned));
break;
case INT_LLONG:
HDmemcpy(aligned, buf+j*sizeof(long long), sizeof(long long));
@@ -2572,34 +2566,34 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
break;
}
- printf(" ans = ");
+ HDprintf(" ans = ");
for (k=0; k<dst_size; k++)
- printf(" %02x", hw[ENDIAN(dst_size, k, endian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ HDprintf(" %02x", hw[ENDIAN(dst_size, k, endian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
switch (dst_type) {
case INT_SCHAR:
- printf(" %29d\n", (int)*((signed char*)((void *)hw)));
+ HDprintf(" %29d\n", (int)*((signed char*)((void *)hw)));
break;
case INT_UCHAR:
- printf(" %29u\n", (unsigned)*((unsigned char*)((void *)hw)));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char*)((void *)hw)));
break;
case INT_SHORT:
- printf(" %29hd\n", *((short*)((void *)hw)));
+ HDprintf(" %29hd\n", *((short*)((void *)hw)));
break;
case INT_USHORT:
- printf(" %29hu\n", *((unsigned short*)((void *)hw)));
+ HDprintf(" %29hu\n", *((unsigned short*)((void *)hw)));
break;
case INT_INT:
- printf(" %29d\n", *((int*)((void *)hw)));
+ HDprintf(" %29d\n", *((int*)((void *)hw)));
break;
case INT_UINT:
- printf(" %29u\n", *((unsigned*)((void *)hw)));
+ HDprintf(" %29u\n", *((unsigned*)((void *)hw)));
break;
case INT_LONG:
- printf(" %29ld\n", *((long*)((void *)hw)));
+ HDprintf(" %29ld\n", *((long*)((void *)hw)));
break;
case INT_ULONG:
- printf(" %29lu\n", *((unsigned long*)((void *)hw)));
+ HDprintf(" %29lu\n", *((unsigned long*)((void *)hw)));
break;
case INT_LLONG:
HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)((void *)hw)));
@@ -2633,7 +2627,7 @@ done:
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
return (int)fails_all_tests;
@@ -2646,23 +2640,23 @@ error:
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
return MAX((int)fails_all_tests, 1);
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_conv_int_2
+ * Function: test_conv_int_2
*
- * Purpose: Tests overlap calculates in H5T__conv_i_i(), which should be
- * the same as for H5T__conv_f_f() and H5T__conv_s_s().
+ * Purpose: Tests overlap calculates in H5T__conv_i_i(), which should be
+ * the same as for H5T__conv_f_f() and H5T__conv_s_s().
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, April 30, 1999
*
* Modifications:
@@ -2672,50 +2666,50 @@ error:
static int
test_conv_int_2(void)
{
- int i, j;
- hid_t src_type, dst_type;
- char *buf;
+ int i, j;
+ hid_t src_type, dst_type;
+ char *buf;
- printf("%-70s", "Testing overlap calculations");
+ HDprintf("%-70s", "Testing overlap calculations");
HDfflush(stdout);
buf = (char *)HDcalloc(TMP_BUF_DIM1, TMP_BUF_DIM2);
HDassert(buf);
for(i = 1; i <= TMP_BUF_DIM1; i++) {
- for(j = 1; j <= TMP_BUF_DIM1; j++) {
-
- /* Source type */
- src_type = H5Tcopy(H5T_NATIVE_CHAR);
- H5Tset_size(src_type, (size_t)i);
-
- /* Destination type */
- dst_type = H5Tcopy(H5T_NATIVE_CHAR);
- H5Tset_size(dst_type, (size_t)j);
-
- /*
- * Conversion. If overlap calculations aren't right then an
- * assertion will fail in H5T__conv_i_i()
- */
- H5Tconvert(src_type, dst_type, (size_t)TMP_BUF_DIM2, buf, NULL, H5P_DEFAULT);
- H5Tclose(src_type);
- H5Tclose(dst_type);
- }
+ for(j = 1; j <= TMP_BUF_DIM1; j++) {
+
+ /* Source type */
+ src_type = H5Tcopy(H5T_NATIVE_CHAR);
+ H5Tset_size(src_type, (size_t)i);
+
+ /* Destination type */
+ dst_type = H5Tcopy(H5T_NATIVE_CHAR);
+ H5Tset_size(dst_type, (size_t)j);
+
+ /*
+ * Conversion. If overlap calculations aren't right then an
+ * assertion will fail in H5T__conv_i_i()
+ */
+ H5Tconvert(src_type, dst_type, (size_t)TMP_BUF_DIM2, buf, NULL, H5P_DEFAULT);
+ H5Tclose(src_type);
+ H5Tclose(dst_type);
+ }
}
PASSED();
HDfree(buf);
return 0;
}
-
+
/*-------------------------------------------------------------------------
- * Function: my_isnan
+ * Function: my_isnan
*
- * Purpose: Determines whether VAL points to NaN.
+ * Purpose: Determines whether VAL points to NaN.
*
- * Return: TRUE or FALSE
+ * Return: TRUE or FALSE
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, July 6, 1998
*
* Modifications:
@@ -2729,21 +2723,21 @@ my_isnan(dtype_t type, void *val)
char s[256];
if (FLT_FLOAT==type) {
- float x;
- HDmemcpy(&x, val, sizeof(float));
- retval = (x!=x);
+ float x;
+ HDmemcpy(&x, val, sizeof(float));
+ retval = (x!=x);
} else if (FLT_DOUBLE==type) {
- double x;
- HDmemcpy(&x, val, sizeof(double));
- retval = (x!=x);
+ double x;
+ HDmemcpy(&x, val, sizeof(double));
+ retval = (x!=x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (FLT_LDOUBLE==type) {
- long double x;
- HDmemcpy(&x, val, sizeof(long double));
- retval = (x!=x);
+ long double x;
+ HDmemcpy(&x, val, sizeof(long double));
+ retval = (x!=x);
#endif
} else {
- return 0;
+ return 0;
}
/*
@@ -2751,42 +2745,42 @@ my_isnan(dtype_t type, void *val)
* the result contains a NaN string.
*/
if (!retval) {
- if (FLT_FLOAT==type) {
- float x;
+ if (FLT_FLOAT==type) {
+ float x;
- HDmemcpy(&x, val, sizeof(float));
- HDsnprintf(s, sizeof(s), "%g", (double)x);
- } else if (FLT_DOUBLE==type) {
- double x;
+ HDmemcpy(&x, val, sizeof(float));
+ HDsnprintf(s, sizeof(s), "%g", (double)x);
+ } else if (FLT_DOUBLE==type) {
+ double x;
- HDmemcpy(&x, val, sizeof(double));
- HDsnprintf(s, sizeof(s), "%g", x);
+ HDmemcpy(&x, val, sizeof(double));
+ HDsnprintf(s, sizeof(s), "%g", x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
- } else if (FLT_LDOUBLE==type) {
- long double x;
+ } else if (FLT_LDOUBLE==type) {
+ long double x;
- HDmemcpy(&x, val, sizeof(long double));
- HDsnprintf(s, sizeof(s), "%Lg", x);
+ HDmemcpy(&x, val, sizeof(long double));
+ HDsnprintf(s, sizeof(s), "%Lg", x);
#endif
- } else {
- return 0;
- }
- if (HDstrstr(s, "NaN") || HDstrstr(s, "NAN") || HDstrstr(s, "nan"))
- retval = 1;
+ } else {
+ return 0;
+ }
+ if (HDstrstr(s, "NaN") || HDstrstr(s, "NAN") || HDstrstr(s, "nan"))
+ retval = 1;
}
return retval;
}
-
+
/*-------------------------------------------------------------------------
- * Function: my_isinf
+ * Function: my_isinf
*
- * Purpose: Determines whether VAL points to +/-infinity.
+ * Purpose: Determines whether VAL points to +/-infinity.
*
- * Return: TRUE or FALSE
+ * Return: TRUE or FALSE
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Monday, June 20, 2005
*
* Modifications:
@@ -2815,70 +2809,70 @@ my_isinf(int endian, unsigned char *val, size_t size,
return retval;
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_conv_flt_1
+ * Function: test_conv_flt_1
*
- * Purpose: Test conversion of floating point values from SRC to
- * DST. These types should be H5T_NATIVE_FLOAT,
- * H5T_NATIVE_DOUBLE, or H5T_NATIVE_LDOUBLE.
+ * Purpose: Test conversion of floating point values from SRC to
+ * DST. These types should be H5T_NATIVE_FLOAT,
+ * H5T_NATIVE_DOUBLE, or H5T_NATIVE_LDOUBLE.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, June 23, 1998
*
* Modifications:
- * Albert Cheng, Apr 16, 2004
- * Check for underflow condition. If the src number is
- * smaller than the dst MIN float number, consider it okay
- * if the converted sw and hw dst are both less than or
- * equal to the dst MIN float number.
+ * Albert Cheng, Apr 16, 2004
+ * Check for underflow condition. If the src number is
+ * smaller than the dst MIN float number, consider it okay
+ * if the converted sw and hw dst are both less than or
+ * equal to the dst MIN float number.
*
*-------------------------------------------------------------------------
*/
static int
test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
{
- dtype_t src_type, dst_type; /*data types */
- size_t nelmts=0; /*num values per test */
- const size_t max_fails=8; /*max number of failures*/
- size_t fails_all_tests=0; /*number of failures */
- size_t fails_this_test; /*fails for this test */
- const char *src_type_name = NULL; /*source type name */
- const char *dst_type_name = NULL; /*destination type name */
- size_t src_size, dst_size; /*type sizes */
- unsigned char *buf = NULL; /*buffer for conversion */
- unsigned char *saved = NULL; /*original values */
- char str[256]; /*hello string */
- void *aligned=NULL; /*aligned buffer */
- float hw_f; /*hardware-converted */
- double hw_d; /*hardware-converted */
+ dtype_t src_type, dst_type; /*data types */
+ size_t nelmts=0; /*num values per test */
+ const size_t max_fails=8; /*max number of failures*/
+ size_t fails_all_tests=0; /*number of failures */
+ size_t fails_this_test; /*fails for this test */
+ const char *src_type_name = NULL; /*source type name */
+ const char *dst_type_name = NULL; /*destination type name */
+ size_t src_size, dst_size; /*type sizes */
+ unsigned char *buf = NULL; /*buffer for conversion */
+ unsigned char *saved = NULL; /*original values */
+ char str[256]; /*hello string */
+ void *aligned=NULL; /*aligned buffer */
+ float hw_f; /*hardware-converted */
+ double hw_d; /*hardware-converted */
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- long double hw_ld; /*hardware-converted */
+ long double hw_ld; /*hardware-converted */
#endif
- unsigned char *hw=NULL; /*ptr to hardware-conv'd*/
- int underflow; /*underflow occurred */
- int overflow = 0; /*overflow occurred */
- int uflow=0; /*underflow debug counters*/
- size_t j, k; /*counters */
- int sendian; /* source type endianess */
- int dendian; /* Destination type endianess */
- size_t dst_ebias; /* Destination type's exponent bias */
- size_t src_epos; /* Source type's exponent position */
- size_t src_esize; /* Source type's exponent size */
- size_t dst_epos; /* Destination type's exponent position */
- size_t dst_esize; /* Destination type's exponent size */
- size_t dst_mpos; /* Destination type's mantissa position */
- size_t dst_msize; /* Destination type's mantissa size */
- size_t src_nbits; /* source length in bits */
- size_t dst_nbits; /* dst length in bits */
+ unsigned char *hw=NULL; /*ptr to hardware-conv'd*/
+ int underflow; /*underflow occurred */
+ int overflow = 0; /*overflow occurred */
+ int uflow=0; /*underflow debug counters*/
+ size_t j, k; /*counters */
+ int sendian; /* source type endianess */
+ int dendian; /* Destination type endianess */
+ size_t dst_ebias; /* Destination type's exponent bias */
+ size_t src_epos; /* Source type's exponent position */
+ size_t src_esize; /* Source type's exponent size */
+ size_t dst_epos; /* Destination type's exponent position */
+ size_t dst_esize; /* Destination type's exponent size */
+ size_t dst_mpos; /* Destination type's mantissa position */
+ size_t dst_msize; /* Destination type's mantissa size */
+ size_t src_nbits; /* source length in bits */
+ size_t dst_nbits; /* dst length in bits */
#ifdef HANDLE_SIGFPE
- pid_t child_pid; /*process ID of child */
- int status; /*child exit status */
+ pid_t child_pid; /*process ID of child */
+ int status; /*child exit status */
/*
* Some systems generage SIGFPE during floating point overflow and we
@@ -2889,22 +2883,22 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
HDfflush(stdout);
HDfflush(stderr);
if ((child_pid=fork()) < 0) {
- HDperror("fork");
- return 1;
+ HDperror("fork");
+ return 1;
} else if (child_pid>0) {
- while (child_pid!=waitpid(child_pid, &status, 0)) /*void*/;
- if (WIFEXITED(status) && 255==WEXITSTATUS(status)) {
- return 0; /*child exit after catching SIGFPE*/
- } else if (WIFEXITED(status)) {
- return WEXITSTATUS(status);
- } else if (WIFSIGNALED(status)) {
- HDsnprintf(str, sizeof(str), " Child caught signal %d.", WTERMSIG(status));
- HDputs(str);
- return 1; /*child exit after catching non-SIGFPE signal */
- } else {
- HDputs(" Child didn't exit normally.");
- return 1;
- }
+ while (child_pid!=waitpid(child_pid, &status, 0)) /*void*/;
+ if (WIFEXITED(status) && 255==WEXITSTATUS(status)) {
+ return 0; /*child exit after catching SIGFPE*/
+ } else if (WIFEXITED(status)) {
+ return WEXITSTATUS(status);
+ } else if (WIFSIGNALED(status)) {
+ HDsnprintf(str, sizeof(str), " Child caught signal %d.", WTERMSIG(status));
+ HDputs(str);
+ return 1; /*child exit after catching non-SIGFPE signal */
+ } else {
+ HDputs(" Child didn't exit normally.");
+ return 1;
+ }
}
#endif
@@ -2916,35 +2910,35 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
/* What are the names of the source and destination types */
if (H5Tequal(src, H5T_NATIVE_FLOAT)) {
- src_type_name = "float";
- src_type = FLT_FLOAT;
+ src_type_name = "float";
+ src_type = FLT_FLOAT;
} else if (H5Tequal(src, H5T_NATIVE_DOUBLE)) {
- src_type_name = "double";
- src_type = FLT_DOUBLE;
+ src_type_name = "double";
+ src_type = FLT_DOUBLE;
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (H5Tequal(src, H5T_NATIVE_LDOUBLE)) {
- src_type_name = "long double";
- src_type = FLT_LDOUBLE;
+ src_type_name = "long double";
+ src_type = FLT_LDOUBLE;
#endif
} else {
- src_type_name = "UNKNOWN";
- src_type = OTHER;
+ src_type_name = "UNKNOWN";
+ src_type = OTHER;
}
if (H5Tequal(dst, H5T_NATIVE_FLOAT)) {
- dst_type_name = "float";
- dst_type = FLT_FLOAT;
+ dst_type_name = "float";
+ dst_type = FLT_FLOAT;
} else if (H5Tequal(dst, H5T_NATIVE_DOUBLE)) {
- dst_type_name = "double";
- dst_type = FLT_DOUBLE;
+ dst_type_name = "double";
+ dst_type = FLT_DOUBLE;
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (H5Tequal(dst, H5T_NATIVE_LDOUBLE)) {
- dst_type_name = "long double";
- dst_type = FLT_LDOUBLE;
+ dst_type_name = "long double";
+ dst_type = FLT_LDOUBLE;
#endif
} else {
- dst_type_name = "UNKNOWN";
- dst_type = OTHER;
+ dst_type_name = "UNKNOWN";
+ dst_type = OTHER;
}
/* Sanity checks */
@@ -2952,22 +2946,22 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
HDputs("Sizeof(float)==sizeof(double) - some tests may not be sensible.");
if (OTHER==src_type || OTHER==dst_type) {
if(!strcmp(name, "noop"))
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
+ name, src_type_name, dst_type_name);
else if(run_test==TEST_SPECIAL)
- HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
- name, src_type_name, dst_type_name);
+ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
+ name, src_type_name, dst_type_name);
else if(run_test==TEST_NORMAL)
- HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions",
- name, src_type_name, dst_type_name);
+ HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions",
+ name, src_type_name, dst_type_name);
else if(run_test==TEST_DENORM)
- HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions",
- name, src_type_name, dst_type_name);
+ HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions",
+ name, src_type_name, dst_type_name);
- printf("%-70s", str);
- H5_FAILED();
- HDputs(" Unknown data type.");
- goto error;
+ HDprintf("%-70s", str);
+ H5_FAILED();
+ HDputs(" Unknown data type.");
+ goto error;
} else {
if(!strcmp(name, "noop"))
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
@@ -2982,7 +2976,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions",
name, src_type_name, dst_type_name);
- printf("%-70s", str);
+ HDprintf("%-70s", str);
HDfflush(stdout);
fails_this_test = 0;
}
@@ -3199,18 +3193,18 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
* the SGI compiler assigns the dst's maximal value.
*/
{
- double check_mant[2];
- int check_expo[2];
+ double check_mant[2];
+ int check_expo[2];
if (FLT_FLOAT==dst_type) {
float x;
HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
if (underflow &&
HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN)
- continue; /* all underflowed, no error */
+ continue; /* all underflowed, no error */
if (overflow && my_isinf(dendian, buf+j*sizeof(float),
dst_size, dst_mpos, dst_msize, dst_epos, dst_esize))
- continue; /* all overflowed, no error */
+ continue; /* all overflowed, no error */
check_mant[0] = HDfrexpf(x, check_expo+0);
check_mant[1] = HDfrexpf(hw_f, check_expo+1);
} else if (FLT_DOUBLE==dst_type) {
@@ -3218,10 +3212,10 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
if (underflow &&
HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN)
- continue; /* all underflowed, no error */
+ continue; /* all underflowed, no error */
if (overflow && my_isinf(dendian, buf+j*sizeof(double),
dst_size, dst_mpos, dst_msize, dst_epos, dst_esize))
- continue; /* all overflowed, no error */
+ continue; /* all overflowed, no error */
check_mant[0] = HDfrexp(x, check_expo+0);
check_mant[1] = HDfrexp(hw_d, check_expo+1);
#if H5_SIZEOF_LONG_DOUBLE !=0 && (H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE)
@@ -3264,20 +3258,20 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
H5_WARNING();
}
}
- printf(" elmt %u\n", (unsigned)j);
+ HDprintf(" elmt %u\n", (unsigned)j);
- printf(" src =");
+ HDprintf(" src =");
for (k=0; k<src_size; k++)
- printf(" %02x", saved[j*src_size+ENDIAN(src_size,k,sendian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
+ HDprintf(" %02x", saved[j*src_size+ENDIAN(src_size,k,sendian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
if (FLT_FLOAT==src_type) {
float x;
HDmemcpy(&x, &saved[j*src_size], sizeof(float));
- printf(" %29.20e\n", (double)x);
+ HDprintf(" %29.20e\n", (double)x);
} else if (FLT_DOUBLE==src_type) {
double x;
HDmemcpy(&x, &saved[j*src_size], sizeof(double));
- printf(" %29.20e\n", x);
+ HDprintf(" %29.20e\n", x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
} else {
long double x;
@@ -3286,18 +3280,18 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
#endif
}
- printf(" dst =");
+ HDprintf(" dst =");
for (k=0; k<dst_size; k++)
- printf(" %02x", buf[j*dst_size+ENDIAN(dst_size,k,dendian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ HDprintf(" %02x", buf[j*dst_size+ENDIAN(dst_size,k,dendian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
if (FLT_FLOAT==dst_type) {
float x;
HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
- printf(" %29.20e\n", (double)x);
+ HDprintf(" %29.20e\n", (double)x);
} else if (FLT_DOUBLE==dst_type) {
double x;
HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
- printf(" %29.20e\n", x);
+ HDprintf(" %29.20e\n", x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
} else {
long double x;
@@ -3306,14 +3300,14 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
#endif
}
- printf(" ans =");
+ HDprintf(" ans =");
for (k=0; k<dst_size; k++)
- printf(" %02x", hw[ENDIAN(dst_size,k,dendian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ HDprintf(" %02x", hw[ENDIAN(dst_size,k,dendian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
if (FLT_FLOAT==dst_type)
- printf(" %29.20e\n", (double)hw_f);
+ HDprintf(" %29.20e\n", (double)hw_f);
else if (FLT_DOUBLE==dst_type)
- printf(" %29.20e\n", hw_d);
+ HDprintf(" %29.20e\n", hw_d);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
else
HDfprintf(stdout," %29.20Le\n", hw_ld);
@@ -3386,24 +3380,24 @@ error:
#endif
}
-
+
/*-------------------------------------------------------------------------
- * Function: test_conv_int_fp
+ * Function: test_conv_int_fp
*
- * Purpose: Test conversion between integer and float values
+ * Purpose: Test conversion between integer and float values
* from SRC to DST. These types should be any combination of:
*
- * H5T_NATIVE_SCHAR H5T_NATIVE_FLOAT
- * H5T_NATIVE_SHORT H5T_NATIVE_DOUBLE
- * H5T_NATIVE_INT H5T_NATIVE_LDOUBLE
- * H5T_NATIVE_LONG
- * H5T_NATIVE_LLONG
+ * H5T_NATIVE_SCHAR H5T_NATIVE_FLOAT
+ * H5T_NATIVE_SHORT H5T_NATIVE_DOUBLE
+ * H5T_NATIVE_INT H5T_NATIVE_LDOUBLE
+ * H5T_NATIVE_LONG
+ * H5T_NATIVE_LLONG
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Thursday, November 6, 2003
*
* Modifications:
@@ -3418,143 +3412,143 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
H5T_conv_except_func_t op; /*returned callback function for conversion exception*/
void *user_data; /*returned pointer to user data passed in to the callback*/
hbool_t except_set = FALSE; /*whether user's exception handling is set*/
- size_t nelmts=0; /*num values per test */
- const size_t max_fails=40; /*max number of failures*/
- size_t fails_all_tests=0; /*number of failures */
- size_t fails_this_test; /*fails for this test */
- char str[256]; /*hello string */
- dtype_t src_type; /*data types */
- dtype_t dst_type; /*data types */
- const char *src_type_name=NULL; /*source type name */
- const char *dst_type_name=NULL; /*destination type name */
- int sendian; /*source endianess */
- int dendian; /*destination endianess */
- size_t src_size, dst_size; /*type sizes */
- unsigned char *buf=NULL; /*buffer for conversion */
- unsigned char *saved=NULL; /*original values */
- size_t j, k; /*counters */
- unsigned char *hw=NULL; /*hardware conv result */
- unsigned char src_bits[32]; /*src value in LE order */
- unsigned char dst_bits[32]; /*dest value in LE order*/
- size_t src_nbits; /*source length in bits */
- size_t dst_nbits; /*dst length in bits */
- void *aligned=NULL; /*aligned temp buffer */
- float hw_float=0;
- double hw_double=0;
- long double hw_ldouble=0;
- signed char hw_schar=0;
- unsigned char hw_uchar=0;
- short hw_short=0;
- unsigned short hw_ushort=0;
- int hw_int=0;
- unsigned hw_uint=0;
- long hw_long=0;
- unsigned long hw_ulong=0;
- long long hw_llong=0;
- unsigned long long hw_ullong=0;
+ size_t nelmts=0; /*num values per test */
+ const size_t max_fails=40; /*max number of failures*/
+ size_t fails_all_tests=0; /*number of failures */
+ size_t fails_this_test; /*fails for this test */
+ char str[256]; /*hello string */
+ dtype_t src_type; /*data types */
+ dtype_t dst_type; /*data types */
+ const char *src_type_name=NULL; /*source type name */
+ const char *dst_type_name=NULL; /*destination type name */
+ int sendian; /*source endianess */
+ int dendian; /*destination endianess */
+ size_t src_size, dst_size; /*type sizes */
+ unsigned char *buf=NULL; /*buffer for conversion */
+ unsigned char *saved=NULL; /*original values */
+ size_t j, k; /*counters */
+ unsigned char *hw=NULL; /*hardware conv result */
+ unsigned char src_bits[32]; /*src value in LE order */
+ unsigned char dst_bits[32]; /*dest value in LE order*/
+ size_t src_nbits; /*source length in bits */
+ size_t dst_nbits; /*dst length in bits */
+ void *aligned=NULL; /*aligned temp buffer */
+ float hw_float=0;
+ double hw_double=0;
+ long double hw_ldouble=0;
+ signed char hw_schar=0;
+ unsigned char hw_uchar=0;
+ short hw_short=0;
+ unsigned short hw_ushort=0;
+ int hw_int=0;
+ unsigned hw_uint=0;
+ long hw_long=0;
+ unsigned long hw_ulong=0;
+ long long hw_llong=0;
+ unsigned long long hw_ullong=0;
/* What is the name of the source type */
if (H5Tequal(src, H5T_NATIVE_SCHAR)) {
- src_type_name = "signed char";
- src_type = INT_SCHAR;
+ src_type_name = "signed char";
+ src_type = INT_SCHAR;
} else if (H5Tequal(src, H5T_NATIVE_UCHAR)) {
- src_type_name = "unsigned char";
- src_type = INT_UCHAR;
+ src_type_name = "unsigned char";
+ src_type = INT_UCHAR;
} else if (H5Tequal(src, H5T_NATIVE_SHORT)) {
- src_type_name = "short";
- src_type = INT_SHORT;
+ src_type_name = "short";
+ src_type = INT_SHORT;
} else if (H5Tequal(src, H5T_NATIVE_USHORT)) {
- src_type_name = "unsigned short";
- src_type = INT_USHORT;
+ src_type_name = "unsigned short";
+ src_type = INT_USHORT;
} else if (H5Tequal(src, H5T_NATIVE_INT)) {
- src_type_name = "int";
- src_type = INT_INT;
+ src_type_name = "int";
+ src_type = INT_INT;
} else if (H5Tequal(src, H5T_NATIVE_UINT)) {
- src_type_name = "unsigned int";
- src_type = INT_UINT;
+ src_type_name = "unsigned int";
+ src_type = INT_UINT;
} else if (H5Tequal(src, H5T_NATIVE_LONG)) {
- src_type_name = "long";
- src_type = INT_LONG;
+ src_type_name = "long";
+ src_type = INT_LONG;
} else if (H5Tequal(src, H5T_NATIVE_ULONG)) {
- src_type_name = "unsigned long";
- src_type = INT_ULONG;
+ src_type_name = "unsigned long";
+ src_type = INT_ULONG;
} else if (H5Tequal(src, H5T_NATIVE_LLONG)) {
- src_type_name = "long long";
- src_type = INT_LLONG;
+ src_type_name = "long long";
+ src_type = INT_LLONG;
} else if (H5Tequal(src, H5T_NATIVE_ULLONG)) {
- src_type_name = "unsigned long long";
- src_type = INT_ULLONG;
+ src_type_name = "unsigned long long";
+ src_type = INT_ULLONG;
} else if (H5Tequal(src, H5T_NATIVE_FLOAT)) {
- src_type_name = "float";
- src_type = FLT_FLOAT;
+ src_type_name = "float";
+ src_type = FLT_FLOAT;
} else if (H5Tequal(src, H5T_NATIVE_DOUBLE)) {
- src_type_name = "double";
- src_type = FLT_DOUBLE;
+ src_type_name = "double";
+ src_type = FLT_DOUBLE;
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (H5Tequal(src, H5T_NATIVE_LDOUBLE)) {
- src_type_name = "long double";
- src_type = FLT_LDOUBLE;
+ src_type_name = "long double";
+ src_type = FLT_LDOUBLE;
#endif
} else {
- src_type_name = "UNKNOWN";
- src_type = OTHER;
+ src_type_name = "UNKNOWN";
+ src_type = OTHER;
}
/* What is the name of the destination type */
if (H5Tequal(dst, H5T_NATIVE_SCHAR)) {
- dst_type_name = "signed char";
- dst_type = INT_SCHAR;
+ dst_type_name = "signed char";
+ dst_type = INT_SCHAR;
} else if (H5Tequal(dst, H5T_NATIVE_UCHAR)) {
- dst_type_name = "unsigned char";
- dst_type = INT_UCHAR;
+ dst_type_name = "unsigned char";
+ dst_type = INT_UCHAR;
} else if (H5Tequal(dst, H5T_NATIVE_SHORT)) {
- dst_type_name = "short";
- dst_type = INT_SHORT;
+ dst_type_name = "short";
+ dst_type = INT_SHORT;
} else if (H5Tequal(dst, H5T_NATIVE_USHORT)) {
- dst_type_name = "unsigned short";
- dst_type = INT_USHORT;
+ dst_type_name = "unsigned short";
+ dst_type = INT_USHORT;
} else if (H5Tequal(dst, H5T_NATIVE_INT)) {
- dst_type_name = "int";
- dst_type = INT_INT;
+ dst_type_name = "int";
+ dst_type = INT_INT;
} else if (H5Tequal(dst, H5T_NATIVE_UINT)) {
- dst_type_name = "unsigned int";
- dst_type = INT_UINT;
+ dst_type_name = "unsigned int";
+ dst_type = INT_UINT;
} else if (H5Tequal(dst, H5T_NATIVE_LONG)) {
- dst_type_name = "long";
- dst_type = INT_LONG;
+ dst_type_name = "long";
+ dst_type = INT_LONG;
} else if (H5Tequal(dst, H5T_NATIVE_ULONG)) {
- dst_type_name = "unsigned long";
- dst_type = INT_ULONG;
+ dst_type_name = "unsigned long";
+ dst_type = INT_ULONG;
} else if (H5Tequal(dst, H5T_NATIVE_LLONG)) {
- dst_type_name = "long long";
- dst_type = INT_LLONG;
+ dst_type_name = "long long";
+ dst_type = INT_LLONG;
} else if (H5Tequal(dst, H5T_NATIVE_ULLONG)) {
- dst_type_name = "unsigned long long";
- dst_type = INT_ULLONG;
+ dst_type_name = "unsigned long long";
+ dst_type = INT_ULLONG;
} else if (H5Tequal(dst, H5T_NATIVE_FLOAT)) {
- dst_type_name = "float";
- dst_type = FLT_FLOAT;
+ dst_type_name = "float";
+ dst_type = FLT_FLOAT;
} else if (H5Tequal(dst, H5T_NATIVE_DOUBLE)) {
- dst_type_name = "double";
- dst_type = FLT_DOUBLE;
+ dst_type_name = "double";
+ dst_type = FLT_DOUBLE;
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (H5Tequal(dst, H5T_NATIVE_LDOUBLE)) {
- dst_type_name = "long double";
- dst_type = FLT_LDOUBLE;
+ dst_type_name = "long double";
+ dst_type = FLT_LDOUBLE;
#endif
} else {
- dst_type_name = "UNKNOWN";
- dst_type = OTHER;
+ dst_type_name = "UNKNOWN";
+ dst_type = OTHER;
}
/* Sanity checks */
if (OTHER==src_type || OTHER==dst_type) {
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
- printf("%-70s", str);
- H5_FAILED();
- HDputs(" Unknown data type.");
- goto error;
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
+ name, src_type_name, dst_type_name);
+ HDprintf("%-70s", str);
+ H5_FAILED();
+ HDputs(" Unknown data type.");
+ goto error;
}
if ((INT_SCHAR==src_type || INT_UCHAR==src_type || INT_SHORT==src_type ||
@@ -3566,12 +3560,12 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
&& FLT_LDOUBLE!=dst_type
#endif
)) {
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
- printf("%-70s", str);
- H5_FAILED();
- HDputs(" 1. Not an integer-float conversion.");
- goto error;
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
+ name, src_type_name, dst_type_name);
+ HDprintf("%-70s", str);
+ H5_FAILED();
+ HDputs(" 1. Not an integer-float conversion.");
+ goto error;
}
if ((FLT_FLOAT==src_type || FLT_DOUBLE==src_type
@@ -3583,12 +3577,12 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
&& INT_USHORT!=dst_type && INT_INT!=dst_type && INT_UINT!=dst_type
&& INT_LONG!=dst_type && INT_ULONG!=dst_type && INT_LLONG!=dst_type
&& INT_ULLONG!=dst_type)) {
- HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
- name, src_type_name, dst_type_name);
- printf("%-70s", str);
- H5_FAILED();
- HDputs(" 2. Not a float-integer conversion.");
- goto error;
+ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
+ name, src_type_name, dst_type_name);
+ HDprintf("%-70s", str);
+ H5_FAILED();
+ HDputs(" 2. Not a float-integer conversion.");
+ goto error;
}
if (INT_SCHAR==src_type || INT_UCHAR==src_type || INT_SHORT==src_type ||
@@ -3597,7 +3591,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
INT_ULLONG==src_type) {
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, src_type_name, dst_type_name);
- printf("%-70s", str);
+ HDprintf("%-70s", str);
HDfflush(stdout);
fails_this_test=0;
} else {
@@ -3610,7 +3604,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
else
HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
name, src_type_name, dst_type_name);
- printf("%-70s", str);
+ HDprintf("%-70s", str);
HDfflush(stdout);
fails_this_test=0;
}
@@ -4347,44 +4341,44 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
H5_WARNING();
}
}
- printf(" elmt %u: \n", (unsigned)j);
+ HDprintf(" elmt %u: \n", (unsigned)j);
- printf(" src = ");
+ HDprintf(" src = ");
for (k=0; k<src_size; k++)
- printf(" %02x", saved[j*src_size+ENDIAN(src_size, k, sendian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
+ HDprintf(" %02x", saved[j*src_size+ENDIAN(src_size, k, sendian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
switch (src_type) {
case INT_SCHAR:
HDmemcpy(aligned, saved+j*sizeof(signed char), sizeof(signed char));
- printf(" %29d\n", (int)*((signed char*)aligned));
+ HDprintf(" %29d\n", (int)*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- printf(" %29u\n", (unsigned)*((unsigned char*)aligned));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char*)aligned));
break;
case INT_SHORT:
HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- printf(" %29hd\n", *((short*)aligned));
+ HDprintf(" %29hd\n", *((short*)aligned));
break;
case INT_USHORT:
HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- printf(" %29hu\n", *((unsigned short*)aligned));
+ HDprintf(" %29hu\n", *((unsigned short*)aligned));
break;
case INT_INT:
HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- printf(" %29d\n", *((int*)aligned));
+ HDprintf(" %29d\n", *((int*)aligned));
break;
case INT_UINT:
HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- printf(" %29u\n", *((unsigned*)aligned));
+ HDprintf(" %29u\n", *((unsigned*)aligned));
break;
case INT_LONG:
HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- printf(" %29ld\n", *((long*)aligned));
+ HDprintf(" %29ld\n", *((long*)aligned));
break;
case INT_ULONG:
HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- printf(" %29lu\n", *((unsigned long*)aligned));
+ HDprintf(" %29lu\n", *((unsigned long*)aligned));
break;
case INT_LLONG:
HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
@@ -4396,16 +4390,16 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
break;
case FLT_FLOAT:
HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- printf(" %29f\n", (double)*((float*)aligned));
+ HDprintf(" %29f\n", (double)*((float*)aligned));
break;
case FLT_DOUBLE:
HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- printf(" %29f\n", *((double*)aligned));
+ HDprintf(" %29f\n", *((double*)aligned));
break;
#if H5_SIZEOF_LONG_DOUBLE !=0
case FLT_LDOUBLE:
HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
- printf(" %29Lf\n", *((long double*)aligned));
+ HDprintf(" %29Lf\n", *((long double*)aligned));
break;
#endif
case OTHER:
@@ -4414,42 +4408,42 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
break;
}
- printf(" dst = ");
+ HDprintf(" dst = ");
for (k=0; k<dst_size; k++)
- printf(" %02x", buf[j*dst_size+ENDIAN(dst_size, k, dendian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ HDprintf(" %02x", buf[j*dst_size+ENDIAN(dst_size, k, dendian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
switch (dst_type) {
case INT_SCHAR:
HDmemcpy(aligned, buf+j*sizeof(signed char), sizeof(signed char));
- printf(" %29d\n", (int)*((signed char*)aligned));
+ HDprintf(" %29d\n", (int)*((signed char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, buf+j*sizeof(unsigned char), sizeof(unsigned char));
- printf(" %29u\n", (unsigned)*((unsigned char*)aligned));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char*)aligned));
break;
case INT_SHORT:
HDmemcpy(aligned, buf+j*sizeof(short), sizeof(short));
- printf(" %29hd\n", *((short*)aligned));
+ HDprintf(" %29hd\n", *((short*)aligned));
break;
case INT_USHORT:
HDmemcpy(aligned, buf+j*sizeof(unsigned short), sizeof(unsigned short));
- printf(" %29hu\n", *((unsigned short*)aligned));
+ HDprintf(" %29hu\n", *((unsigned short*)aligned));
break;
case INT_INT:
HDmemcpy(aligned, buf+j*sizeof(int), sizeof(int));
- printf(" %29d\n", *((int*)aligned));
+ HDprintf(" %29d\n", *((int*)aligned));
break;
case INT_UINT:
HDmemcpy(aligned, buf+j*sizeof(unsigned), sizeof(unsigned));
- printf(" %29u\n", *((unsigned*)aligned));
+ HDprintf(" %29u\n", *((unsigned*)aligned));
break;
case INT_LONG:
HDmemcpy(aligned, buf+j*sizeof(long), sizeof(long));
- printf(" %29ld\n", *((long*)aligned));
+ HDprintf(" %29ld\n", *((long*)aligned));
break;
case INT_ULONG:
HDmemcpy(aligned, buf+j*sizeof(unsigned long), sizeof(unsigned long));
- printf(" %29lu\n", *((unsigned long*)aligned));
+ HDprintf(" %29lu\n", *((unsigned long*)aligned));
break;
case INT_LLONG:
HDmemcpy(aligned, buf+j*sizeof(long long), sizeof(long long));
@@ -4461,16 +4455,16 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
break;
case FLT_FLOAT:
HDmemcpy(aligned, buf+j*sizeof(float), sizeof(float));
- printf(" %29f\n", (double)*((float*)aligned));
+ HDprintf(" %29f\n", (double)*((float*)aligned));
break;
case FLT_DOUBLE:
HDmemcpy(aligned, buf+j*sizeof(double), sizeof(double));
- printf(" %29f\n", *((double*)aligned));
+ HDprintf(" %29f\n", *((double*)aligned));
break;
#if H5_SIZEOF_LONG_DOUBLE !=0
case FLT_LDOUBLE:
HDmemcpy(aligned, buf+j*sizeof(long double), sizeof(long double));
- printf(" %29Lf\n", *((long double*)aligned));
+ HDprintf(" %29Lf\n", *((long double*)aligned));
break;
#endif
case OTHER:
@@ -4479,34 +4473,34 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
break;
}
- printf(" ans = ");
+ HDprintf(" ans = ");
for (k=0; k<dst_size; k++)
- printf(" %02x", hw[ENDIAN(dst_size, k, dendian)]);
- printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
+ HDprintf(" %02x", hw[ENDIAN(dst_size, k, dendian)]);
+ HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
switch (dst_type) {
case INT_SCHAR:
- printf(" %29d\n", (int)*((signed char*)((void *)hw)));
+ HDprintf(" %29d\n", (int)*((signed char*)((void *)hw)));
break;
case INT_UCHAR:
- printf(" %29u\n", (unsigned)*((unsigned char*)((void *)hw)));
+ HDprintf(" %29u\n", (unsigned)*((unsigned char*)((void *)hw)));
break;
case INT_SHORT:
- printf(" %29hd\n", *((short*)((void *)hw)));
+ HDprintf(" %29hd\n", *((short*)((void *)hw)));
break;
case INT_USHORT:
- printf(" %29hu\n", *((unsigned short*)((void *)hw)));
+ HDprintf(" %29hu\n", *((unsigned short*)((void *)hw)));
break;
case INT_INT:
- printf(" %29d\n", *((int*)((void *)hw)));
+ HDprintf(" %29d\n", *((int*)((void *)hw)));
break;
case INT_UINT:
- printf(" %29u\n", *((unsigned int*)((void *)hw)));
+ HDprintf(" %29u\n", *((unsigned int*)((void *)hw)));
break;
case INT_LONG:
- printf(" %29ld\n", *((long*)((void *)hw)));
+ HDprintf(" %29ld\n", *((long*)((void *)hw)));
break;
case INT_ULONG:
- printf(" %29lu\n", *((unsigned long*)((void *)hw)));
+ HDprintf(" %29lu\n", *((unsigned long*)((void *)hw)));
break;
case INT_LLONG:
HDfprintf(stdout, " %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)((void *)hw)));
@@ -4515,14 +4509,14 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
HDfprintf(stdout, " %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)((void *)hw)));
break;
case FLT_FLOAT:
- printf(" %29f\n", (double)*((float*)((void *)hw)));
+ HDprintf(" %29f\n", (double)*((float*)((void *)hw)));
break;
case FLT_DOUBLE:
- printf(" %29f\n", *((double*)((void *)hw)));
+ HDprintf(" %29f\n", *((double*)((void *)hw)));
break;
#if H5_SIZEOF_LONG_DOUBLE !=0
case FLT_LDOUBLE:
- printf(" %29Lf\n", *((long double*)((void *)hw)));
+ HDprintf(" %29Lf\n", *((long double*)((void *)hw)));
break;
#endif
case OTHER:
@@ -4555,7 +4549,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
/* If the source is normalized floating values, treat the failures as error;
* if it is denormalized or special floating values, treat the failure as warning.*/
@@ -4573,7 +4567,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- reset_hdf5(); /*print statistics*/
+ reset_hdf5(); /*print statistics*/
if(run_test==TEST_NORMAL)
return MAX((int)fails_all_tests, 1);
@@ -4583,19 +4577,19 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
}
}
-
+
/*-------------------------------------------------------------------------
- * Function: overflows
+ * Function: overflows
*
- * Purpose: When convert from float or double to any integer type,
+ * Purpose: When convert from float or double to any integer type,
* check if overflow occurs.
*
*
- * Return: TRUE: overflow happens
+ * Return: TRUE: overflow happens
*
* FALSE: no overflow
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Monday, Nov 17, 2003
*
* Modifications:
@@ -4675,15 +4669,15 @@ done:
return ret_value;
}
-
+
/*-------------------------------------------------------------------------
- * Function: run_integer_tests
+ * Function: run_integer_tests
*
- * Purpose: Runs all integer tests.
+ * Purpose: Runs all integer tests.
*
- * Return: Number of errors
+ * Return: Number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, November 24, 1998
*
* Modifications:
@@ -4693,7 +4687,7 @@ done:
static int
run_integer_tests(const char *name)
{
- int nerrors = 0;
+ int nerrors = 0;
nerrors += test_conv_int_1(name, H5T_NATIVE_SCHAR, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_SCHAR, H5T_NATIVE_SHORT);
@@ -4838,15 +4832,15 @@ run_integer_tests(const char *name)
return nerrors;
}
-
+
/*-------------------------------------------------------------------------
- * Function: run_fp_tests
+ * Function: run_fp_tests
*
- * Purpose: Runs all floating-point tests.
+ * Purpose: Runs all floating-point tests.
*
- * Return: Number of errors
+ * Return: Number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Tuesday, March 22, 2005
*
* Modifications:
@@ -4856,7 +4850,7 @@ run_integer_tests(const char *name)
static int
run_fp_tests(const char *name)
{
- int nerrors = 0;
+ int nerrors = 0;
if(!strcmp(name, "noop")) {
nerrors += test_conv_flt_1("noop", TEST_NOOP, H5T_NATIVE_FLOAT, H5T_NATIVE_FLOAT);
@@ -4887,11 +4881,11 @@ run_fp_tests(const char *name)
nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT);
#else
{
- char str[256]; /*string */
+ char str[256]; /*string */
HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions",
name, "long double", "float");
- printf("%-70s", str);
+ HDprintf("%-70s", str);
SKIPPED();
#if H5_SIZEOF_LONG_DOUBLE!=0
HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu.");
@@ -4915,11 +4909,11 @@ run_fp_tests(const char *name)
nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE);
#else
{
- char str[256]; /*string */
+ char str[256]; /*string */
HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
name, "long double", "float or double");
- printf("%-70s", str);
+ HDprintf("%-70s", str);
SKIPPED();
#if H5_SIZEOF_LONG_DOUBLE!=0
HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu.");
@@ -4934,15 +4928,15 @@ done:
return nerrors;
}
-
+
/*-------------------------------------------------------------------------
- * Function: run_int_fp_conv
+ * Function: run_int_fp_conv
*
- * Purpose: Runs all integer-float tests.
+ * Purpose: Runs all integer-float tests.
*
- * Return: Number of errors
+ * Return: Number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Monday, November 10, 2003
*
* Modifications:
@@ -4952,7 +4946,7 @@ done:
static int
run_int_fp_conv(const char *name)
{
- int nerrors = 0;
+ int nerrors = 0;
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_FLOAT);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_DOUBLE);
@@ -5001,11 +4995,11 @@ run_int_fp_conv(const char *name)
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_LDOUBLE);
#else
{
- char str[256]; /*string */
+ char str[256]; /*string */
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "(unsigned) long", "long double");
- printf("%-70s", str);
+ HDprintf("%-70s", str);
SKIPPED();
#if H5_SIZEOF_LONG_DOUBLE!=0
HDputs(" Test skipped due to the special algorithm of hardware conversion.");
@@ -5020,11 +5014,11 @@ run_int_fp_conv(const char *name)
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LLONG, H5T_NATIVE_LDOUBLE);
#else /* H5_LLONG_TO_LDOUBLE_CORRECT */
{
- char str[256]; /*hello string */
+ char str[256]; /*hello string */
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "long long", "long double");
- printf("%-70s", str);
+ HDprintf("%-70s", str);
SKIPPED();
HDputs(" Test skipped due to compiler error in handling conversion.");
}
@@ -5033,11 +5027,11 @@ run_int_fp_conv(const char *name)
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULLONG, H5T_NATIVE_LDOUBLE);
#else /* H5_LLONG_TO_LDOUBLE_CORRECT */
{
- char str[256]; /*hello string */
+ char str[256]; /*hello string */
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "unsigned long long", "long double");
- printf("%-70s", str);
+ HDprintf("%-70s", str);
SKIPPED();
HDputs(" Test skipped due to compiler not handling conversion.");
}
@@ -5048,15 +5042,15 @@ run_int_fp_conv(const char *name)
return nerrors;
}
-
+
/*-------------------------------------------------------------------------
- * Function: run_fp_int_conv
+ * Function: run_fp_int_conv
*
- * Purpose: Runs all float-integer tests.
+ * Purpose: Runs all float-integer tests.
*
- * Return: Number of errors
+ * Return: Number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Monday, November 10, 2003
*
* Modifications:
@@ -5066,7 +5060,7 @@ run_int_fp_conv(const char *name)
static int
run_fp_int_conv(const char *name)
{
- int nerrors = 0;
+ int nerrors = 0;
int test_values;
for(test_values = TEST_NORMAL; test_values <= TEST_SPECIAL; test_values++) {
@@ -5111,7 +5105,7 @@ run_fp_int_conv(const char *name)
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
if(test_values != TEST_SPECIAL) {
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT);
@@ -5119,18 +5113,18 @@ run_fp_int_conv(const char *name)
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT);
} else {
#ifndef H5_DISABLE_SOME_LDOUBLE_CONV
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT);
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT);
#else
- char str[256]; /*string */
+ char str[256]; /*string */
HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
name, "long double", "signed and unsigned char, short, int, long");
- printf("%-70s", str);
+ HDprintf("%-70s", str);
SKIPPED();
#if H5_SIZEOF_LONG_DOUBLE!=0
HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu.");
@@ -5152,11 +5146,11 @@ run_fp_int_conv(const char *name)
}
#else
{
- char str[256]; /*string */
+ char str[256]; /*string */
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "long double", "(unsigned) long");
- printf("%-70s", str);
+ HDprintf("%-70s", str);
SKIPPED();
#if H5_SIZEOF_LONG_DOUBLE!=0
HDputs(" Test skipped due to the special algorithm of hardware conversion.");
@@ -5172,11 +5166,11 @@ run_fp_int_conv(const char *name)
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LLONG);
#else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/
{
- char str[256]; /*string */
+ char str[256]; /*string */
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "long double", "long long");
- printf("%-70s", str);
+ HDprintf("%-70s", str);
SKIPPED();
#if H5_SIZEOF_LONG_DOUBLE!=0
HDputs(" Test skipped due to hardware conversion error.");
@@ -5189,11 +5183,11 @@ run_fp_int_conv(const char *name)
nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULLONG);
#else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/
{
- char str[256]; /*string */
+ char str[256]; /*string */
HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions",
name, "long double", "unsigned long long");
- printf("%-70s", str);
+ HDprintf("%-70s", str);
SKIPPED();
#if H5_SIZEOF_LONG_DOUBLE!=0
HDputs(" Test skipped due to hardware conversion error.");
@@ -5209,7 +5203,7 @@ run_fp_int_conv(const char *name)
return nerrors;
}
-
+
/*-------------------------------------------------------------------------
* Function: main
*
@@ -5233,7 +5227,7 @@ run_fp_int_conv(const char *name)
int
main(void)
{
- unsigned long nerrors = 0;
+ unsigned long nerrors = 0;
/* Set the random # seed */
HDsrandom((unsigned)HDtime(NULL));
@@ -5241,7 +5235,7 @@ main(void)
reset_hdf5();
if (ALIGNMENT)
- printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
+ HDprintf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
/* Do the tests */
@@ -5310,11 +5304,11 @@ main(void)
h5_restore_err();
if (nerrors) {
- printf("***** %lu FAILURE%s! *****\n",
+ HDprintf("***** %lu FAILURE%s! *****\n",
nerrors, 1==nerrors?"":"S");
HDexit(EXIT_FAILURE);
}
- printf("All data type tests passed.\n");
+ HDprintf("All data type tests passed.\n");
return 0;
}
diff --git a/test/earray.c b/test/earray.c
index bb258c7..57df4d5 100644
--- a/test/earray.c
+++ b/test/earray.c
@@ -530,10 +530,10 @@ verify_cparam(const H5EA_t *ea, const H5EA_create_t *cparam)
TEST_ERROR
/* Success */
- return 0;
+ return SUCCEED;
error:
- return -1;
+ return FAIL;
} /* verify_cparam() */
diff --git a/test/th5o.c b/test/th5o.c
index 0aa589f..099bb92 100644
--- a/test/th5o.c
+++ b/test/th5o.c
@@ -378,7 +378,7 @@ test_h5o_refcount(void)
{
hid_t fid; /* HDF5 File ID */
hid_t grp, dset, dtype, dspace; /* Object identifiers */
- H5O_info_t oinfo; /* Object info struct */
+ H5O_info_t oinfo; /* Object info struct */
hsize_t dims[RANK];
herr_t ret; /* Value returned from API calls */
@@ -850,7 +850,7 @@ test_h5o_link(void)
/* Verify the data */
for(i = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++)
VERIFY(wdata[i], rdata[i], "H5Dread");
-
+
/* Create a group with no name*/
group_id = H5Gcreate_anon(file_id, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group_id, FAIL, "H5Gcreate_anon");
@@ -1254,7 +1254,7 @@ test_h5o_getinfo_same_file(void)
{
hid_t fid1, fid2; /* HDF5 File ID */
hid_t gid1, gid2; /* Group IDs */
- H5O_info_t oinfo1, oinfo2; /* Object info structs */
+ H5O_info_t oinfo1, oinfo2; /* Object info structs */
herr_t ret; /* Value returned from API calls */
/* Create a new HDF5 file */
@@ -1491,29 +1491,29 @@ test_h5o(void)
/* Output message about test being performed */
MESSAGE(5, ("Testing Objects\n"));
- test_h5o_open(); /* Test generic open function */
- test_h5o_open_by_addr(); /* Test opening objects by address */
- test_h5o_close(); /* Test generic close function */
- test_h5o_refcount(); /* Test incrementing and decrementing reference count */
- test_h5o_plist(); /* Test object creation properties */
- test_h5o_link(); /* Test object link routine */
- test_h5o_comment(); /* Test routines for comment */
- test_h5o_comment_by_name(); /* Test routines for comment by name */
+ test_h5o_open(); /* Test generic open function */
+ test_h5o_open_by_addr(); /* Test opening objects by address */
+ test_h5o_close(); /* Test generic close function */
+ test_h5o_refcount(); /* Test incrementing and decrementing reference count */
+ test_h5o_plist(); /* Test object creation properties */
+ test_h5o_link(); /* Test object link routine */
+ test_h5o_comment(); /* Test routines for comment */
+ test_h5o_comment_by_name(); /* Test routines for comment by name */
test_h5o_getinfo_same_file(); /* Test info for objects in the same file */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- test_h5o_getinfo_visit(); /* Test object info for H5Oget_info1/2 and H5Ovisit1 */
+ test_h5o_getinfo_visit(); /* Test object info for H5Oget_info1/2 and H5Ovisit1 */
#endif
} /* test_h5o() */
/*-------------------------------------------------------------------------
- * Function: cleanup_h5o
+ * Function: cleanup_h5o
*
- * Purpose: Cleanup temporary test files
+ * Purpose: Cleanup temporary test files
*
- * Return: none
+ * Return: none
*
- * Programmer: James Laird
+ * Programmer: James Laird
* June 3, 2006
*
*-------------------------------------------------------------------------
diff --git a/test/titerate.c b/test/titerate.c
index 716654d..7bc3bf7 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -946,7 +946,7 @@ find_err_msg_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *_
if (searched_err == NULL)
return H5_ITER_ERROR;
-
+
/* If the searched error message is found, stop the iteration */
if (err_desc->desc != NULL && strcmp(err_desc->desc, searched_err->message) == 0)
{