2003-02-25 04:20:31 +08:00
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-07 22:56:24 +08:00
|
|
|
|
* Copyright by The HDF Group. *
|
2003-02-25 04:20:31 +08:00
|
|
|
|
* Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
|
* All rights reserved. *
|
|
|
|
|
* *
|
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
|
|
|
|
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
|
|
|
|
* of the source code distribution tree; Copyright.html can be found at the *
|
|
|
|
|
* root level of an installed copy of the electronic HDF5 document set and *
|
|
|
|
|
* is linked from the top-level documents page. It can also be found at *
|
2007-02-07 22:56:24 +08:00
|
|
|
|
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
|
* access to either file, you may request a copy from help@hdfgroup.org. *
|
2003-02-25 04:20:31 +08:00
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
|
|
|
|
|
/* Programmer: Robb Matzke <matzke@llnl.gov>
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Friday, October 10, 1997
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Purpose: Hyperslab operations are rather complex, so this file
|
|
|
|
|
* attempts to test them extensively so we can be relatively
|
|
|
|
|
* sure they really work. We only test 1d, 2d, and 3d cases
|
|
|
|
|
* because testing general dimensionalities would require us to
|
|
|
|
|
* rewrite much of the hyperslab stuff.
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*/
|
2003-05-08 05:52:24 +08:00
|
|
|
|
#include "h5test.h"
|
2001-04-04 02:09:16 +08:00
|
|
|
|
#include "H5private.h"
|
2002-05-29 02:18:01 +08:00
|
|
|
|
#include "H5Eprivate.h"
|
2001-04-04 02:09:16 +08:00
|
|
|
|
#include "H5Vprivate.h"
|
1997-10-21 07:22:19 +08:00
|
|
|
|
|
1998-03-05 00:20:23 +08:00
|
|
|
|
#define TEST_SMALL 0x0001
|
|
|
|
|
#define TEST_MEDIUM 0x0002
|
1997-10-21 07:22:19 +08:00
|
|
|
|
|
1998-03-05 00:20:23 +08:00
|
|
|
|
#define VARIABLE_SRC 0
|
|
|
|
|
#define VARIABLE_DST 1
|
|
|
|
|
#define VARIABLE_BOTH 2
|
2003-05-08 05:52:24 +08:00
|
|
|
|
|
|
|
|
|
#define ARRAY_FILL_SIZE 4
|
|
|
|
|
#define ARRAY_OFFSET_NDIMS 3
|
|
|
|
|
|
1997-10-21 07:22:19 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Function: init_full
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Purpose: Initialize full array.
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Return: void
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Friday, October 10, 1997
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
2001-08-15 06:09:56 +08:00
|
|
|
|
static unsigned
|
1998-11-19 02:40:09 +08:00
|
|
|
|
init_full(uint8_t *array, size_t nx, size_t ny, size_t nz)
|
1997-10-21 07:22:19 +08:00
|
|
|
|
{
|
1998-04-07 23:34:16 +08:00
|
|
|
|
size_t i, j, k;
|
1998-11-19 02:40:09 +08:00
|
|
|
|
uint8_t acc = 128;
|
2001-08-15 06:09:56 +08:00
|
|
|
|
unsigned total = 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
1998-04-07 23:34:16 +08:00
|
|
|
|
for (i=0; i<nx; i++) {
|
|
|
|
|
for (j=0; j<ny; j++) {
|
|
|
|
|
for (k=0; k<nz; k++) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
total += acc;
|
2006-04-22 03:21:24 +08:00
|
|
|
|
*array = acc;
|
|
|
|
|
acc++;
|
|
|
|
|
array++;
|
1998-03-05 00:20:23 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
return total;
|
1997-10-21 07:22:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Function: print_array
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Purpose: Prints the values in an array
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Return: void
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Friday, October 10, 1997
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static void
|
1998-11-19 02:40:09 +08:00
|
|
|
|
print_array(uint8_t *array, size_t nx, size_t ny, size_t nz)
|
1997-10-21 07:22:19 +08:00
|
|
|
|
{
|
1998-04-07 23:34:16 +08:00
|
|
|
|
size_t i, j, k;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
1998-04-07 23:34:16 +08:00
|
|
|
|
for (i=0; i<nx; i++) {
|
|
|
|
|
if (nz>1) {
|
1999-03-02 03:44:32 +08:00
|
|
|
|
printf("i=%lu:\n", (unsigned long)i);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
} else {
|
1999-03-02 03:44:32 +08:00
|
|
|
|
printf("%03lu:", (unsigned long)i);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
1998-04-07 23:34:16 +08:00
|
|
|
|
for (j=0; j<ny; j++) {
|
|
|
|
|
if (nz>1)
|
1999-03-02 03:44:32 +08:00
|
|
|
|
printf("%03lu:", (unsigned long)j);
|
1998-04-07 23:34:16 +08:00
|
|
|
|
for (k=0; k<nz; k++) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
printf(" %3d", *array++);
|
|
|
|
|
}
|
1998-04-07 23:34:16 +08:00
|
|
|
|
if (nz>1)
|
1998-03-05 00:20:23 +08:00
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
1997-10-21 07:22:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Function: print_ref
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Purpose: Prints the reference value
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Return: Success: 0
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
2005-08-14 04:53:35 +08:00
|
|
|
|
* Failure:
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Friday, October 10, 1997
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static void
|
1998-01-17 06:23:43 +08:00
|
|
|
|
print_ref(size_t nx, size_t ny, size_t nz)
|
1997-10-21 07:22:19 +08:00
|
|
|
|
{
|
1998-11-19 02:40:09 +08:00
|
|
|
|
uint8_t *array;
|
1997-10-21 07:22:19 +08:00
|
|
|
|
|
2003-11-08 23:32:53 +08:00
|
|
|
|
array = HDcalloc(nx*ny*nz,sizeof(uint8_t));
|
1997-10-21 07:22:19 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
printf("Reference array:\n");
|
|
|
|
|
init_full(array, nx, ny, nz);
|
|
|
|
|
print_array(array, nx, ny, nz);
|
1997-10-21 07:22:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Function: test_fill
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Purpose: Tests the H5V_hyper_fill() function.
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Return: Success: SUCCEED
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Failure: FAIL
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Saturday, October 11, 1997
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
1998-01-17 06:23:43 +08:00
|
|
|
|
test_fill(size_t nx, size_t ny, size_t nz,
|
1998-03-05 00:20:23 +08:00
|
|
|
|
size_t di, size_t dj, size_t dk,
|
|
|
|
|
size_t ddx, size_t ddy, size_t ddz)
|
1997-10-21 07:22:19 +08:00
|
|
|
|
{
|
1998-11-19 02:40:09 +08:00
|
|
|
|
uint8_t *dst = NULL; /*destination array */
|
1998-04-09 05:43:02 +08:00
|
|
|
|
hsize_t hs_size[3]; /*hyperslab size */
|
|
|
|
|
hsize_t dst_size[3]; /*destination total size */
|
2004-12-29 22:26:20 +08:00
|
|
|
|
hsize_t dst_offset[3]; /*offset of hyperslab in dest */
|
2001-08-15 06:09:56 +08:00
|
|
|
|
unsigned ref_value; /*reference value */
|
|
|
|
|
unsigned acc; /*accumulator */
|
1998-04-07 23:34:16 +08:00
|
|
|
|
size_t i, j, k, dx, dy, dz; /*counters */
|
1998-03-05 00:20:23 +08:00
|
|
|
|
size_t u, v, w;
|
2001-08-15 06:09:56 +08:00
|
|
|
|
unsigned ndims; /*hyperslab dimensionality */
|
1998-03-05 00:20:23 +08:00
|
|
|
|
char dim[64], s[256]; /*temp string */
|
2001-08-15 06:09:56 +08:00
|
|
|
|
unsigned fill_value; /*fill value */
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Dimensionality.
|
|
|
|
|
*/
|
|
|
|
|
if (0 == nz) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
if (0 == ny) {
|
|
|
|
|
ndims = 1;
|
|
|
|
|
ny = nz = 1;
|
|
|
|
|
sprintf(dim, "%lu", (unsigned long) nx);
|
|
|
|
|
} else {
|
|
|
|
|
ndims = 2;
|
|
|
|
|
nz = 1;
|
|
|
|
|
sprintf(dim, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
|
|
|
|
|
}
|
1998-01-17 06:23:43 +08:00
|
|
|
|
} else {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
ndims = 3;
|
|
|
|
|
sprintf(dim, "%lux%lux%lu",
|
|
|
|
|
(unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
1998-03-05 00:20:23 +08:00
|
|
|
|
sprintf(s, "Testing hyperslab fill %-11s variable hyperslab", dim);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
printf("%-70s", s);
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
|
|
/* Allocate array */
|
2006-10-31 08:13:27 +08:00
|
|
|
|
dst = HDcalloc((size_t)1, nx * ny * nz);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
init_full(dst, nx, ny, nz);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < nx; i += di) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
for (j = 0; j < ny; j += dj) {
|
|
|
|
|
for (k = 0; k < nz; k += dk) {
|
|
|
|
|
for (dx = 1; dx <= nx - i; dx += ddx) {
|
|
|
|
|
for (dy = 1; dy <= ny - j; dy += ddy) {
|
|
|
|
|
for (dz = 1; dz <= nz - k; dz += ddz) {
|
|
|
|
|
|
|
|
|
|
/* Describe the hyperslab */
|
|
|
|
|
dst_size[0] = nx;
|
|
|
|
|
dst_size[1] = ny;
|
|
|
|
|
dst_size[2] = nz;
|
2004-12-29 22:26:20 +08:00
|
|
|
|
dst_offset[0] = i;
|
|
|
|
|
dst_offset[1] = j;
|
|
|
|
|
dst_offset[2] = k;
|
1998-03-05 00:20:23 +08:00
|
|
|
|
hs_size[0] = dx;
|
|
|
|
|
hs_size[1] = dy;
|
|
|
|
|
hs_size[2] = dz;
|
|
|
|
|
|
|
|
|
|
for (fill_value=0;
|
|
|
|
|
fill_value<256;
|
|
|
|
|
fill_value+=64) {
|
|
|
|
|
/*
|
|
|
|
|
* Initialize the full array, then subtract the
|
|
|
|
|
* original * fill values and add the new ones.
|
|
|
|
|
*/
|
|
|
|
|
ref_value = init_full(dst, nx, ny, nz);
|
2005-04-19 05:21:35 +08:00
|
|
|
|
for (u=(size_t)dst_offset[0];
|
1998-03-05 00:20:23 +08:00
|
|
|
|
u<dst_offset[0]+dx;
|
|
|
|
|
u++) {
|
2005-04-19 05:21:35 +08:00
|
|
|
|
for (v = (size_t)dst_offset[1];
|
1998-03-05 00:20:23 +08:00
|
|
|
|
v < dst_offset[1] + dy;
|
|
|
|
|
v++) {
|
2005-04-19 05:21:35 +08:00
|
|
|
|
for (w = (size_t)dst_offset[2];
|
1998-03-05 00:20:23 +08:00
|
|
|
|
w < dst_offset[2] + dz;
|
|
|
|
|
w++) {
|
|
|
|
|
ref_value -= dst[u*ny*nz+v*nz+w];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ref_value += fill_value * dx * dy * dz;
|
|
|
|
|
|
|
|
|
|
/* Fill the hyperslab with some value */
|
|
|
|
|
H5V_hyper_fill(ndims, hs_size, dst_size,
|
|
|
|
|
dst_offset, dst, fill_value);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Sum the array and compare it to the
|
|
|
|
|
* reference value.
|
|
|
|
|
*/
|
|
|
|
|
acc = 0;
|
|
|
|
|
for (u = 0; u < nx; u++) {
|
|
|
|
|
for (v = 0; v < ny; v++) {
|
|
|
|
|
for (w = 0; w < nz; w++) {
|
|
|
|
|
acc += dst[u*ny*nz + v*nz + w];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (acc != ref_value) {
|
|
|
|
|
puts("*FAILED*");
|
[svn-r15150] Purpose: Separate Windows function macro definitions to win32defs.h
Description:
In library code, we try not to use system calls directly, but instead use the HD{function} macro instead. This way, we can map special versions of the call on particular systems. Previously, it was all done in H5private.h. However, in an effort to clean up platform-specific definitions, we move all of the Windows macros into a separate file, win32defs.h. This way, we can use the non-Posix versions that Visual Studio sends warnings about.
Some macros are set specifically in the platform-specific header files. Then, any macros left unset will be set by the "default" implementation in H5private.h.
This checkin also cleans up various source files to use the HD* macros when possible.
Tested:
VS2005 on WinXP
VS.NET on WinXP
h5committest (kagiso, linew, smirom)
2008-06-06 02:52:19 +08:00
|
|
|
|
if (!HDisatty(1)) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
/*
|
|
|
|
|
* Print debugging info unless output
|
|
|
|
|
* is going directly to a terminal.
|
|
|
|
|
*/
|
|
|
|
|
AT();
|
|
|
|
|
printf(" acc != ref_value\n");
|
1999-03-02 03:44:32 +08:00
|
|
|
|
printf(" i=%lu, j=%lu, k=%lu, "
|
|
|
|
|
"dx=%lu, dy=%lu, dz=%lu, "
|
|
|
|
|
"fill=%d\n",
|
|
|
|
|
(unsigned long)i,
|
|
|
|
|
(unsigned long)j,
|
|
|
|
|
(unsigned long)k,
|
|
|
|
|
(unsigned long)dx,
|
|
|
|
|
(unsigned long)dy,
|
|
|
|
|
(unsigned long)dz,
|
|
|
|
|
fill_value);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
print_ref(nx, ny, nz);
|
|
|
|
|
printf("\n Result is:\n");
|
|
|
|
|
print_array(dst, nx, ny, nz);
|
|
|
|
|
}
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
puts(" PASSED");
|
2003-11-08 23:32:53 +08:00
|
|
|
|
HDfree(dst);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
return SUCCEED;
|
|
|
|
|
|
|
|
|
|
error:
|
2003-11-08 23:32:53 +08:00
|
|
|
|
HDfree(dst);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
return FAIL;
|
1997-10-21 07:22:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Function: test_copy
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Purpose: Tests H5V_hyper_copy().
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* The NX, NY, and NZ arguments are the size for the source and
|
1999-02-27 03:58:14 +08:00
|
|
|
|
* destination arrays. You may pass zero for NZ or for NY and
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* NZ to test the 2-d and 1-d cases respectively.
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* A hyperslab is copied from/to (depending on MODE) various
|
|
|
|
|
* places in SRC and DST beginning at 0,0,0 and increasing
|
|
|
|
|
* location by DI,DJ,DK in the x, y, and z directions.
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* For each hyperslab location, various sizes of hyperslabs are
|
|
|
|
|
* tried beginning with 1x1x1 and increasing the size in each
|
|
|
|
|
* dimension by DDX,DDY,DDZ.
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Return: Success: SUCCEED
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Failure: FAIL
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Friday, October 10, 1997
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
1998-01-17 06:23:43 +08:00
|
|
|
|
test_copy(int mode,
|
1998-03-05 00:20:23 +08:00
|
|
|
|
size_t nx, size_t ny, size_t nz,
|
|
|
|
|
size_t di, size_t dj, size_t dk,
|
|
|
|
|
size_t ddx, size_t ddy, size_t ddz)
|
1997-10-21 07:22:19 +08:00
|
|
|
|
{
|
1998-11-19 02:40:09 +08:00
|
|
|
|
uint8_t *src = NULL; /*source array */
|
|
|
|
|
uint8_t *dst = NULL; /*destination array */
|
1998-04-09 05:43:02 +08:00
|
|
|
|
hsize_t hs_size[3]; /*hyperslab size */
|
|
|
|
|
hsize_t dst_size[3]; /*destination total size */
|
|
|
|
|
hsize_t src_size[3]; /*source total size */
|
2004-12-29 22:26:20 +08:00
|
|
|
|
hsize_t dst_offset[3]; /*offset of hyperslab in dest */
|
|
|
|
|
hsize_t src_offset[3]; /*offset of hyperslab in source */
|
2001-08-15 06:09:56 +08:00
|
|
|
|
unsigned ref_value; /*reference value */
|
|
|
|
|
unsigned acc; /*accumulator */
|
1998-04-09 05:43:02 +08:00
|
|
|
|
hsize_t i, j, k, dx, dy, dz; /*counters */
|
|
|
|
|
hsize_t u, v, w;
|
2001-08-15 06:09:56 +08:00
|
|
|
|
unsigned ndims; /*hyperslab dimensionality */
|
1998-03-05 00:20:23 +08:00
|
|
|
|
char dim[64], s[256]; /*temp string */
|
|
|
|
|
const char *sub;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Dimensionality.
|
|
|
|
|
*/
|
|
|
|
|
if (0 == nz) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
if (0 == ny) {
|
|
|
|
|
ndims = 1;
|
|
|
|
|
ny = nz = 1;
|
|
|
|
|
sprintf(dim, "%lu", (unsigned long) nx);
|
|
|
|
|
} else {
|
|
|
|
|
ndims = 2;
|
|
|
|
|
nz = 1;
|
|
|
|
|
sprintf(dim, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
|
|
|
|
|
}
|
1998-01-17 06:23:43 +08:00
|
|
|
|
} else {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
ndims = 3;
|
|
|
|
|
sprintf(dim, "%lux%lux%lu",
|
|
|
|
|
(unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case VARIABLE_SRC:
|
1998-03-05 00:20:23 +08:00
|
|
|
|
/*
|
|
|
|
|
* The hyperslab "travels" through the source array but the
|
|
|
|
|
* destination hyperslab is always at the origin of the destination
|
|
|
|
|
* array.
|
|
|
|
|
*/
|
|
|
|
|
sub = "variable source";
|
|
|
|
|
break;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
case VARIABLE_DST:
|
1998-03-05 00:20:23 +08:00
|
|
|
|
/*
|
|
|
|
|
* We always read a hyperslab from the origin of the source and copy it
|
|
|
|
|
* to a hyperslab at various locations in the destination.
|
|
|
|
|
*/
|
|
|
|
|
sub = "variable destination";
|
|
|
|
|
break;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
case VARIABLE_BOTH:
|
1998-03-05 00:20:23 +08:00
|
|
|
|
/*
|
|
|
|
|
* We read the hyperslab from various locations in the source and copy
|
|
|
|
|
* it to the same location in the destination.
|
|
|
|
|
*/
|
|
|
|
|
sub = "sync source & dest ";
|
|
|
|
|
break;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
default:
|
1998-03-05 00:20:23 +08:00
|
|
|
|
abort();
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(s, "Testing hyperslab copy %-11s %s", dim, sub);
|
|
|
|
|
printf("%-70s", s);
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Allocate arrays
|
|
|
|
|
*/
|
2006-10-31 08:13:27 +08:00
|
|
|
|
src = HDcalloc((size_t)1, nx * ny * nz);
|
|
|
|
|
dst = HDcalloc((size_t)1, nx * ny * nz);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
init_full(src, nx, ny, nz);
|
|
|
|
|
|
1999-02-27 03:58:14 +08:00
|
|
|
|
for (i=0; i<nx; i+=di) {
|
|
|
|
|
for (j=0; j<ny; j+=dj) {
|
|
|
|
|
for (k=0; k<nz; k+=dk) {
|
|
|
|
|
for (dx=1; dx<=nx-i; dx+=ddx) {
|
|
|
|
|
for (dy=1; dy<=ny-j; dy+=ddy) {
|
|
|
|
|
for (dz=1; dz<=nz-k; dz+=ddz) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Describe the source and destination hyperslabs
|
|
|
|
|
* and the arrays to which they belong.
|
|
|
|
|
*/
|
|
|
|
|
hs_size[0] = dx;
|
|
|
|
|
hs_size[1] = dy;
|
|
|
|
|
hs_size[2] = dz;
|
|
|
|
|
dst_size[0] = src_size[0] = nx;
|
|
|
|
|
dst_size[1] = src_size[1] = ny;
|
|
|
|
|
dst_size[2] = src_size[2] = nz;
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case VARIABLE_SRC:
|
|
|
|
|
dst_offset[0] = 0;
|
|
|
|
|
dst_offset[1] = 0;
|
|
|
|
|
dst_offset[2] = 0;
|
2004-12-29 22:26:20 +08:00
|
|
|
|
src_offset[0] = i;
|
|
|
|
|
src_offset[1] = j;
|
|
|
|
|
src_offset[2] = k;
|
1998-03-05 00:20:23 +08:00
|
|
|
|
break;
|
|
|
|
|
case VARIABLE_DST:
|
2004-12-29 22:26:20 +08:00
|
|
|
|
dst_offset[0] = i;
|
|
|
|
|
dst_offset[1] = j;
|
|
|
|
|
dst_offset[2] = k;
|
1998-03-05 00:20:23 +08:00
|
|
|
|
src_offset[0] = 0;
|
|
|
|
|
src_offset[1] = 0;
|
|
|
|
|
src_offset[2] = 0;
|
|
|
|
|
break;
|
|
|
|
|
case VARIABLE_BOTH:
|
2004-12-29 22:26:20 +08:00
|
|
|
|
dst_offset[0] = i;
|
|
|
|
|
dst_offset[1] = j;
|
|
|
|
|
dst_offset[2] = k;
|
|
|
|
|
src_offset[0] = i;
|
|
|
|
|
src_offset[1] = j;
|
|
|
|
|
src_offset[2] = k;
|
1998-03-05 00:20:23 +08:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
abort();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Sum the main array directly to get a reference
|
|
|
|
|
* value to compare against later.
|
|
|
|
|
*/
|
|
|
|
|
ref_value = 0;
|
|
|
|
|
for (u=src_offset[0]; u<src_offset[0]+dx; u++) {
|
|
|
|
|
for (v=src_offset[1];
|
|
|
|
|
v<src_offset[1]+dy;
|
|
|
|
|
v++) {
|
|
|
|
|
for (w=src_offset[2];
|
|
|
|
|
w<src_offset[2]+dz;
|
|
|
|
|
w++) {
|
|
|
|
|
ref_value += src[u*ny*nz + v*nz + w];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Set all loc values to 1 so we can detect writing
|
|
|
|
|
* outside the hyperslab.
|
|
|
|
|
*/
|
1999-02-27 03:58:14 +08:00
|
|
|
|
for (u=0; u<nx; u++) {
|
|
|
|
|
for (v=0; v<ny; v++) {
|
|
|
|
|
for (w=0; w<nz; w++) {
|
|
|
|
|
dst[u*ny*nz + v*nz + w] = 1;
|
1998-03-05 00:20:23 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Copy a hyperslab from the global array to the
|
|
|
|
|
* local array.
|
|
|
|
|
*/
|
|
|
|
|
H5V_hyper_copy(ndims, hs_size,
|
|
|
|
|
dst_size, dst_offset, dst,
|
|
|
|
|
src_size, src_offset, src);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Sum the destination hyperslab. It should be
|
|
|
|
|
* the same as the reference value.
|
|
|
|
|
*/
|
|
|
|
|
acc = 0;
|
|
|
|
|
for (u=dst_offset[0]; u<dst_offset[0]+dx; u++) {
|
|
|
|
|
for (v=dst_offset[1];
|
|
|
|
|
v<dst_offset[1]+dy;
|
|
|
|
|
v++) {
|
1999-02-27 03:58:14 +08:00
|
|
|
|
for (w=dst_offset[2];
|
|
|
|
|
w<dst_offset[2]+dz;
|
1998-03-05 00:20:23 +08:00
|
|
|
|
w++) {
|
1999-02-27 03:58:14 +08:00
|
|
|
|
acc += dst[u*ny*nz + v*nz + w];
|
1998-03-05 00:20:23 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (acc != ref_value) {
|
|
|
|
|
puts("*FAILED*");
|
[svn-r15150] Purpose: Separate Windows function macro definitions to win32defs.h
Description:
In library code, we try not to use system calls directly, but instead use the HD{function} macro instead. This way, we can map special versions of the call on particular systems. Previously, it was all done in H5private.h. However, in an effort to clean up platform-specific definitions, we move all of the Windows macros into a separate file, win32defs.h. This way, we can use the non-Posix versions that Visual Studio sends warnings about.
Some macros are set specifically in the platform-specific header files. Then, any macros left unset will be set by the "default" implementation in H5private.h.
This checkin also cleans up various source files to use the HD* macros when possible.
Tested:
VS2005 on WinXP
VS.NET on WinXP
h5committest (kagiso, linew, smirom)
2008-06-06 02:52:19 +08:00
|
|
|
|
if (!HDisatty(1)) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
/*
|
|
|
|
|
* Print debugging info unless output is
|
|
|
|
|
* going directly to a terminal.
|
|
|
|
|
*/
|
|
|
|
|
AT();
|
|
|
|
|
printf(" acc != ref_value\n");
|
1998-04-09 05:43:02 +08:00
|
|
|
|
printf(" i=%lu, j=%lu, k=%lu, "
|
|
|
|
|
"dx=%lu, dy=%lu, dz=%lu\n",
|
|
|
|
|
(unsigned long)i,
|
|
|
|
|
(unsigned long)j,
|
|
|
|
|
(unsigned long)k,
|
|
|
|
|
(unsigned long)dx,
|
|
|
|
|
(unsigned long)dy,
|
|
|
|
|
(unsigned long)dz);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
print_ref(nx, ny, nz);
|
|
|
|
|
printf("\n Destination array is:\n");
|
|
|
|
|
print_array(dst, nx, ny, nz);
|
|
|
|
|
}
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* Sum the entire array. It should be a fixed
|
|
|
|
|
* amount larger than the reference value since
|
|
|
|
|
* we added the border of 1's to the hyperslab.
|
|
|
|
|
*/
|
|
|
|
|
acc = 0;
|
1999-02-27 03:58:14 +08:00
|
|
|
|
for (u=0; u<nx; u++) {
|
|
|
|
|
for (v=0; v<ny; v++) {
|
|
|
|
|
for (w=0; w<nz; w++) {
|
|
|
|
|
acc += dst[u*ny*nz + v*nz + w];
|
1998-03-05 00:20:23 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-02-27 03:58:14 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* The following casts are to work around an
|
|
|
|
|
* optimization bug in the Mongoose 7.20 Irix64
|
|
|
|
|
* compiler.
|
|
|
|
|
*/
|
|
|
|
|
if (acc+(unsigned)dx*(unsigned)dy*(unsigned)dz !=
|
|
|
|
|
ref_value + nx*ny*nz) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
puts("*FAILED*");
|
[svn-r15150] Purpose: Separate Windows function macro definitions to win32defs.h
Description:
In library code, we try not to use system calls directly, but instead use the HD{function} macro instead. This way, we can map special versions of the call on particular systems. Previously, it was all done in H5private.h. However, in an effort to clean up platform-specific definitions, we move all of the Windows macros into a separate file, win32defs.h. This way, we can use the non-Posix versions that Visual Studio sends warnings about.
Some macros are set specifically in the platform-specific header files. Then, any macros left unset will be set by the "default" implementation in H5private.h.
This checkin also cleans up various source files to use the HD* macros when possible.
Tested:
VS2005 on WinXP
VS.NET on WinXP
h5committest (kagiso, linew, smirom)
2008-06-06 02:52:19 +08:00
|
|
|
|
if (!HDisatty(1)) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
/*
|
|
|
|
|
* Print debugging info unless output is
|
|
|
|
|
* going directly to a terminal.
|
|
|
|
|
*/
|
|
|
|
|
AT();
|
|
|
|
|
printf(" acc != ref_value + nx*ny*nz - "
|
|
|
|
|
"dx*dy*dz\n");
|
1998-04-09 05:43:02 +08:00
|
|
|
|
printf(" i=%lu, j=%lu, k=%lu, "
|
|
|
|
|
"dx=%lu, dy=%lu, dz=%lu\n",
|
|
|
|
|
(unsigned long)i,
|
|
|
|
|
(unsigned long)j,
|
|
|
|
|
(unsigned long)k,
|
|
|
|
|
(unsigned long)dx,
|
|
|
|
|
(unsigned long)dy,
|
|
|
|
|
(unsigned long)dz);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
print_ref(nx, ny, nz);
|
|
|
|
|
printf("\n Destination array is:\n");
|
|
|
|
|
print_array(dst, nx, ny, nz);
|
|
|
|
|
}
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
puts(" PASSED");
|
1999-04-30 01:41:42 +08:00
|
|
|
|
HDfree(src);
|
|
|
|
|
HDfree(dst);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
return SUCCEED;
|
|
|
|
|
|
|
|
|
|
error:
|
2003-11-08 23:32:53 +08:00
|
|
|
|
HDfree(src);
|
|
|
|
|
HDfree(dst);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
return FAIL;
|
1997-10-21 07:22:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Function: test_multifill
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Purpose: Tests the H5V_stride_copy() function by using it to fill a
|
|
|
|
|
* hyperslab by replicating a multi-byte sequence. This might
|
|
|
|
|
* be useful to initialize an array of structs with a default
|
|
|
|
|
* struct value, or to initialize an array of floating-point
|
|
|
|
|
* values with a default bit-pattern.
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Return: Success: SUCCEED
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Failure: FAIL
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Saturday, October 11, 1997
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
1998-04-07 23:34:16 +08:00
|
|
|
|
test_multifill(size_t nx)
|
1997-10-21 07:22:19 +08:00
|
|
|
|
{
|
1998-04-09 05:43:02 +08:00
|
|
|
|
hsize_t i, j;
|
|
|
|
|
hsize_t size;
|
2004-12-29 22:26:20 +08:00
|
|
|
|
hsize_t src_stride;
|
|
|
|
|
hsize_t dst_stride;
|
1998-03-05 00:20:23 +08:00
|
|
|
|
char s[64];
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
struct a_struct {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
int left;
|
|
|
|
|
double mid;
|
|
|
|
|
int right;
|
|
|
|
|
} fill , *src = NULL, *dst = NULL;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
printf("%-70s", "Testing multi-byte fill value");
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
|
|
/* Initialize the source and destination */
|
2003-11-08 23:32:53 +08:00
|
|
|
|
src = HDmalloc(nx * sizeof(*src));
|
|
|
|
|
dst = HDmalloc(nx * sizeof(*dst));
|
1998-01-17 06:23:43 +08:00
|
|
|
|
for (i = 0; i < nx; i++) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
src[i].left = 1111111;
|
|
|
|
|
src[i].mid = 12345.6789;
|
|
|
|
|
src[i].right = 2222222;
|
|
|
|
|
dst[i].left = 3333333;
|
|
|
|
|
dst[i].mid = 98765.4321;
|
|
|
|
|
dst[i].right = 4444444;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Describe the fill value. The zero stride says to read the same thing
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* over and over again.
|
|
|
|
|
*/
|
|
|
|
|
fill.left = 55555555;
|
|
|
|
|
fill.mid = 3.1415927;
|
|
|
|
|
fill.right = 66666666;
|
|
|
|
|
src_stride = 0;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* The destination stride says to fill in one value per array element
|
|
|
|
|
*/
|
|
|
|
|
dst_stride = sizeof(fill);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Copy the fill value into each element
|
|
|
|
|
*/
|
|
|
|
|
size = nx;
|
1998-04-09 05:43:02 +08:00
|
|
|
|
H5V_stride_copy(1, (hsize_t)sizeof(double), &size,
|
1998-03-05 00:20:23 +08:00
|
|
|
|
&dst_stride, &(dst[0].mid), &src_stride, &(fill.mid));
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check
|
|
|
|
|
*/
|
|
|
|
|
s[0] = '\0';
|
|
|
|
|
for (i = 0; i < nx; i++) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
if (dst[i].left != 3333333) {
|
1998-04-09 05:43:02 +08:00
|
|
|
|
sprintf(s, "bad dst[%lu].left", (unsigned long)i);
|
2007-02-06 03:22:26 +08:00
|
|
|
|
} else if (!DBL_ABS_EQUAL(dst[i].mid, fill.mid)) {
|
|
|
|
|
/* Check if two DOUBLE values are equal. If their difference
|
|
|
|
|
* is smaller than the EPSILON value for double, they are
|
|
|
|
|
* considered equal. See the definition in h5test.h.
|
|
|
|
|
*/
|
1998-04-09 05:43:02 +08:00
|
|
|
|
sprintf(s, "bad dst[%lu].mid", (unsigned long)i);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
} else if (dst[i].right != 4444444) {
|
1998-04-09 05:43:02 +08:00
|
|
|
|
sprintf(s, "bad dst[%lu].right", (unsigned long)i);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
}
|
|
|
|
|
if (s[0]) {
|
|
|
|
|
puts("*FAILED*");
|
[svn-r15150] Purpose: Separate Windows function macro definitions to win32defs.h
Description:
In library code, we try not to use system calls directly, but instead use the HD{function} macro instead. This way, we can map special versions of the call on particular systems. Previously, it was all done in H5private.h. However, in an effort to clean up platform-specific definitions, we move all of the Windows macros into a separate file, win32defs.h. This way, we can use the non-Posix versions that Visual Studio sends warnings about.
Some macros are set specifically in the platform-specific header files. Then, any macros left unset will be set by the "default" implementation in H5private.h.
This checkin also cleans up various source files to use the HD* macros when possible.
Tested:
VS2005 on WinXP
VS.NET on WinXP
h5committest (kagiso, linew, smirom)
2008-06-06 02:52:19 +08:00
|
|
|
|
if (!HDisatty(1)) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
AT();
|
|
|
|
|
printf(" fill={%d,%g,%d}\n ",
|
|
|
|
|
fill.left, fill.mid, fill.right);
|
|
|
|
|
for (j = 0; j < sizeof(fill); j++) {
|
1998-11-19 02:40:09 +08:00
|
|
|
|
printf(" %02x", ((uint8_t *) &fill)[j]);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
}
|
1998-04-09 05:43:02 +08:00
|
|
|
|
printf("\n dst[%lu]={%d,%g,%d}\n ",
|
|
|
|
|
(unsigned long)i,
|
|
|
|
|
dst[i].left, dst[i].mid, dst[i].right);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
for (j = 0; j < sizeof(dst[i]); j++) {
|
1998-11-19 02:40:09 +08:00
|
|
|
|
printf(" %02x", ((uint8_t *) (dst + i))[j]);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
puts(" PASSED");
|
2003-11-08 23:32:53 +08:00
|
|
|
|
HDfree(src);
|
|
|
|
|
HDfree(dst);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
return SUCCEED;
|
|
|
|
|
|
|
|
|
|
error:
|
2003-11-08 23:32:53 +08:00
|
|
|
|
HDfree(src);
|
|
|
|
|
HDfree(dst);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
return FAIL;
|
1997-10-21 07:22:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Function: test_endian
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Purpose: Tests the H5V_stride_copy() function by using it to copy an
|
|
|
|
|
* array of integers and swap the byte ordering from little
|
|
|
|
|
* endian to big endian or vice versa depending on the hardware.
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Return: Success: SUCCEED
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Failure: FAIL
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Saturday, October 11, 1997
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
1998-01-17 06:23:43 +08:00
|
|
|
|
test_endian(size_t nx)
|
1997-10-21 07:22:19 +08:00
|
|
|
|
{
|
1998-11-19 02:40:09 +08:00
|
|
|
|
uint8_t *src = NULL; /*source array */
|
|
|
|
|
uint8_t *dst = NULL; /*destination array */
|
1998-04-09 05:43:02 +08:00
|
|
|
|
hssize_t src_stride[2]; /*source strides */
|
|
|
|
|
hssize_t dst_stride[2]; /*destination strides */
|
|
|
|
|
hsize_t size[2]; /*size vector */
|
|
|
|
|
hsize_t i, j;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
printf("%-70s", "Testing endian conversion by stride");
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
|
|
/* Initialize arrays */
|
2003-11-08 23:32:53 +08:00
|
|
|
|
src = HDmalloc(nx * 4);
|
2006-10-31 08:13:27 +08:00
|
|
|
|
init_full(src, nx, (size_t)4, (size_t)1);
|
|
|
|
|
dst = HDcalloc(nx , (size_t)4);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/* Initialize strides */
|
|
|
|
|
src_stride[0] = 0;
|
|
|
|
|
src_stride[1] = 1;
|
|
|
|
|
dst_stride[0] = 8;
|
|
|
|
|
dst_stride[1] = -1;
|
|
|
|
|
size[0] = nx;
|
|
|
|
|
size[1] = 4;
|
|
|
|
|
|
|
|
|
|
/* Copy the array */
|
2004-12-29 22:26:20 +08:00
|
|
|
|
H5V_stride_copy_s(2, (hsize_t)1, size, dst_stride, dst + 3, src_stride, src);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/* Compare */
|
|
|
|
|
for (i = 0; i < nx; i++) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
for (j = 0; j < 4; j++) {
|
|
|
|
|
if (src[i * 4 + j] != dst[i * 4 + 3 - j]) {
|
|
|
|
|
puts("*FAILED*");
|
[svn-r15150] Purpose: Separate Windows function macro definitions to win32defs.h
Description:
In library code, we try not to use system calls directly, but instead use the HD{function} macro instead. This way, we can map special versions of the call on particular systems. Previously, it was all done in H5private.h. However, in an effort to clean up platform-specific definitions, we move all of the Windows macros into a separate file, win32defs.h. This way, we can use the non-Posix versions that Visual Studio sends warnings about.
Some macros are set specifically in the platform-specific header files. Then, any macros left unset will be set by the "default" implementation in H5private.h.
This checkin also cleans up various source files to use the HD* macros when possible.
Tested:
VS2005 on WinXP
VS.NET on WinXP
h5committest (kagiso, linew, smirom)
2008-06-06 02:52:19 +08:00
|
|
|
|
if (!HDisatty(1)) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
/*
|
|
|
|
|
* Print debugging info unless output is going directly
|
|
|
|
|
* to a terminal.
|
|
|
|
|
*/
|
|
|
|
|
AT();
|
1998-04-09 05:43:02 +08:00
|
|
|
|
printf(" i=%lu, j=%lu\n",
|
|
|
|
|
(unsigned long)i, (unsigned long)j);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
printf(" Source array is:\n");
|
2006-10-31 08:13:27 +08:00
|
|
|
|
print_array(src, nx, (size_t)4, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
printf("\n Result is:\n");
|
2006-10-31 08:13:27 +08:00
|
|
|
|
print_array(dst, nx, (size_t)4, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
}
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
}
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
puts(" PASSED");
|
2003-11-08 23:32:53 +08:00
|
|
|
|
HDfree(src);
|
|
|
|
|
HDfree(dst);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
return SUCCEED;
|
|
|
|
|
|
|
|
|
|
error:
|
2003-11-08 23:32:53 +08:00
|
|
|
|
HDfree(src);
|
|
|
|
|
HDfree(dst);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
return FAIL;
|
1997-10-21 07:22:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Function: test_transpose
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Purpose: Copy a 2d array from here to there and transpose the elements
|
|
|
|
|
* as it's copied.
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Return: Success: SUCCEED
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Failure: FAIL
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Saturday, October 11, 1997
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
1998-01-17 06:23:43 +08:00
|
|
|
|
test_transpose(size_t nx, size_t ny)
|
1997-10-21 07:22:19 +08:00
|
|
|
|
{
|
2001-08-15 06:09:56 +08:00
|
|
|
|
int *src = NULL;
|
|
|
|
|
int *dst = NULL;
|
1998-04-09 05:43:02 +08:00
|
|
|
|
hsize_t i, j;
|
2004-12-29 22:26:20 +08:00
|
|
|
|
hsize_t src_stride[2], dst_stride[2];
|
1998-04-09 05:43:02 +08:00
|
|
|
|
hsize_t size[2];
|
1998-03-05 00:20:23 +08:00
|
|
|
|
char s[256];
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
sprintf(s, "Testing 2d transpose by stride %4lux%-lud",
|
1998-03-05 00:20:23 +08:00
|
|
|
|
(unsigned long) nx, (unsigned long) ny);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
printf("%-70s", s);
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
|
|
/* Initialize */
|
2003-11-08 23:32:53 +08:00
|
|
|
|
src = HDmalloc(nx * ny * sizeof(*src));
|
1998-01-17 06:23:43 +08:00
|
|
|
|
for (i = 0; i < nx; i++) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
for (j = 0; j < ny; j++) {
|
2001-08-15 06:09:56 +08:00
|
|
|
|
src[i * ny + j] = (int)(i * ny + j);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
}
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
2003-11-08 23:32:53 +08:00
|
|
|
|
dst = HDcalloc(nx*ny,sizeof(*dst));
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/* Build stride info */
|
|
|
|
|
size[0] = nx;
|
|
|
|
|
size[1] = ny;
|
|
|
|
|
src_stride[0] = 0;
|
|
|
|
|
src_stride[1] = sizeof(*src);
|
1998-03-05 00:30:56 +08:00
|
|
|
|
dst_stride[0] = (ssize_t)((1 - nx * ny) * sizeof(*src));
|
|
|
|
|
dst_stride[1] = (ssize_t)(nx * sizeof(*src));
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/* Copy and transpose */
|
|
|
|
|
if (nx == ny) {
|
1998-04-09 05:43:02 +08:00
|
|
|
|
H5V_stride_copy(2, (hsize_t)sizeof(*src), size,
|
1998-03-05 00:20:23 +08:00
|
|
|
|
dst_stride, dst,
|
|
|
|
|
src_stride, src);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
} else {
|
1998-04-09 05:43:02 +08:00
|
|
|
|
H5V_stride_copy(2, (hsize_t)sizeof(*src), size,
|
1998-03-05 00:20:23 +08:00
|
|
|
|
dst_stride, dst,
|
|
|
|
|
src_stride, src);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check */
|
|
|
|
|
for (i = 0; i < nx; i++) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
for (j = 0; j < ny; j++) {
|
|
|
|
|
if (src[i * ny + j] != dst[j * nx + i]) {
|
|
|
|
|
puts("*FAILED*");
|
[svn-r15150] Purpose: Separate Windows function macro definitions to win32defs.h
Description:
In library code, we try not to use system calls directly, but instead use the HD{function} macro instead. This way, we can map special versions of the call on particular systems. Previously, it was all done in H5private.h. However, in an effort to clean up platform-specific definitions, we move all of the Windows macros into a separate file, win32defs.h. This way, we can use the non-Posix versions that Visual Studio sends warnings about.
Some macros are set specifically in the platform-specific header files. Then, any macros left unset will be set by the "default" implementation in H5private.h.
This checkin also cleans up various source files to use the HD* macros when possible.
Tested:
VS2005 on WinXP
VS.NET on WinXP
h5committest (kagiso, linew, smirom)
2008-06-06 02:52:19 +08:00
|
|
|
|
if (!HDisatty(1)) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
AT();
|
1998-04-09 05:43:02 +08:00
|
|
|
|
printf(" diff at i=%lu, j=%lu\n",
|
|
|
|
|
(unsigned long)i, (unsigned long)j);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
printf(" Source is:\n");
|
|
|
|
|
for (i = 0; i < nx; i++) {
|
1998-04-09 05:43:02 +08:00
|
|
|
|
printf("%3lu:", (unsigned long)i);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
for (j = 0; j < ny; j++) {
|
|
|
|
|
printf(" %6d", src[i * ny + j]);
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
printf("\n Destination is:\n");
|
|
|
|
|
for (i = 0; i < ny; i++) {
|
1998-04-09 05:43:02 +08:00
|
|
|
|
printf("%3lu:", (unsigned long)i);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
for (j = 0; j < nx; j++) {
|
|
|
|
|
printf(" %6d", dst[i * nx + j]);
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
}
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
puts(" PASSED");
|
1999-04-30 01:41:42 +08:00
|
|
|
|
HDfree(src);
|
|
|
|
|
HDfree(dst);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
return SUCCEED;
|
|
|
|
|
|
|
|
|
|
error:
|
2003-11-08 23:32:53 +08:00
|
|
|
|
HDfree(src);
|
|
|
|
|
HDfree(dst);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
return FAIL;
|
1997-10-21 07:22:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Function: test_sub_super
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Purpose: Tests H5V_stride_copy() to reduce the resolution of an image
|
|
|
|
|
* by copying half the pixels in the X and Y directions. Then
|
|
|
|
|
* we use the small image and duplicate every pixel to result in
|
|
|
|
|
* a 2x2 square.
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Return: Success: SUCCEED
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Failure: FAIL
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Monday, October 13, 1997
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
1998-01-17 06:23:43 +08:00
|
|
|
|
test_sub_super(size_t nx, size_t ny)
|
1997-10-21 07:22:19 +08:00
|
|
|
|
{
|
1998-11-19 02:40:09 +08:00
|
|
|
|
uint8_t *full = NULL; /*original image */
|
|
|
|
|
uint8_t *half = NULL; /*image at 1/2 resolution */
|
|
|
|
|
uint8_t *twice = NULL; /*2x2 pixels */
|
2004-12-29 22:26:20 +08:00
|
|
|
|
hsize_t src_stride[4]; /*source stride info */
|
|
|
|
|
hsize_t dst_stride[4]; /*destination stride info */
|
1998-04-09 05:43:02 +08:00
|
|
|
|
hsize_t size[4]; /*number of sample points */
|
|
|
|
|
hsize_t i, j;
|
1998-03-05 00:20:23 +08:00
|
|
|
|
char s[256];
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
sprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ",
|
1998-03-05 00:20:23 +08:00
|
|
|
|
(unsigned long) (2 * nx), (unsigned long) (2 * ny),
|
|
|
|
|
(unsigned long) nx, (unsigned long) ny);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
printf("%-70s", s);
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
|
|
/* Initialize */
|
2003-11-08 23:32:53 +08:00
|
|
|
|
full = HDmalloc(4 * nx * ny);
|
2006-10-31 08:13:27 +08:00
|
|
|
|
init_full(full, 2 * nx, 2 * ny, (size_t)1);
|
|
|
|
|
half = HDcalloc((size_t)1, nx * ny);
|
|
|
|
|
twice = HDcalloc((size_t)4, nx * ny);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/* Setup */
|
|
|
|
|
size[0] = nx;
|
|
|
|
|
size[1] = ny;
|
1998-03-05 00:30:56 +08:00
|
|
|
|
src_stride[0] = (ssize_t)(2 * ny);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
src_stride[1] = 2;
|
|
|
|
|
dst_stride[0] = 0;
|
|
|
|
|
dst_stride[1] = 1;
|
|
|
|
|
|
|
|
|
|
/* Copy */
|
1998-11-19 02:40:09 +08:00
|
|
|
|
H5V_stride_copy(2, (hsize_t)sizeof(uint8_t), size,
|
1998-03-05 00:20:23 +08:00
|
|
|
|
dst_stride, half, src_stride, full);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/* Check */
|
|
|
|
|
for (i = 0; i < nx; i++) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
for (j = 0; j < ny; j++) {
|
|
|
|
|
if (full[4 * i * ny + 2 * j] != half[i * ny + j]) {
|
|
|
|
|
puts("*FAILED*");
|
[svn-r15150] Purpose: Separate Windows function macro definitions to win32defs.h
Description:
In library code, we try not to use system calls directly, but instead use the HD{function} macro instead. This way, we can map special versions of the call on particular systems. Previously, it was all done in H5private.h. However, in an effort to clean up platform-specific definitions, we move all of the Windows macros into a separate file, win32defs.h. This way, we can use the non-Posix versions that Visual Studio sends warnings about.
Some macros are set specifically in the platform-specific header files. Then, any macros left unset will be set by the "default" implementation in H5private.h.
This checkin also cleans up various source files to use the HD* macros when possible.
Tested:
VS2005 on WinXP
VS.NET on WinXP
h5committest (kagiso, linew, smirom)
2008-06-06 02:52:19 +08:00
|
|
|
|
if (!HDisatty(1)) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
AT();
|
1998-04-09 05:43:02 +08:00
|
|
|
|
printf(" full[%lu][%lu] != half[%lu][%lu]\n",
|
|
|
|
|
(unsigned long)i*2,
|
|
|
|
|
(unsigned long)j*2,
|
|
|
|
|
(unsigned long)i,
|
|
|
|
|
(unsigned long)j);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
printf(" full is:\n");
|
2006-10-31 08:13:27 +08:00
|
|
|
|
print_array(full, 2 * nx, 2 * ny, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
printf("\n half is:\n");
|
2006-10-31 08:13:27 +08:00
|
|
|
|
print_array(half, nx, ny, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
}
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
}
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
puts(" PASSED");
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Test replicating pixels to produce an image twice as large in each
|
|
|
|
|
* dimension.
|
|
|
|
|
*/
|
|
|
|
|
sprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ",
|
1998-03-05 00:20:23 +08:00
|
|
|
|
(unsigned long) nx, (unsigned long) ny,
|
|
|
|
|
(unsigned long) (2 * nx), (unsigned long) (2 * ny));
|
1998-01-17 06:23:43 +08:00
|
|
|
|
printf("%-70s", s);
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
|
|
/* Setup stride */
|
|
|
|
|
size[0] = nx;
|
|
|
|
|
size[1] = ny;
|
|
|
|
|
size[2] = 2;
|
|
|
|
|
size[3] = 2;
|
|
|
|
|
src_stride[0] = 0;
|
|
|
|
|
src_stride[1] = 1;
|
|
|
|
|
src_stride[2] = 0;
|
|
|
|
|
src_stride[3] = 0;
|
1998-03-05 00:30:56 +08:00
|
|
|
|
dst_stride[0] = (ssize_t)(2 * ny);
|
1998-11-19 02:40:09 +08:00
|
|
|
|
dst_stride[1] = (ssize_t)(2 * sizeof(uint8_t) - 4 * ny);
|
|
|
|
|
dst_stride[2] = (ssize_t)(2 * ny - 2 * sizeof(uint8_t));
|
|
|
|
|
dst_stride[3] = sizeof(uint8_t);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/* Copy */
|
1998-11-19 02:40:09 +08:00
|
|
|
|
H5V_stride_copy(4, (hsize_t)sizeof(uint8_t), size,
|
1998-03-05 00:20:23 +08:00
|
|
|
|
dst_stride, twice, src_stride, half);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/* Check */
|
|
|
|
|
s[0] = '\0';
|
|
|
|
|
for (i = 0; i < nx; i++) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
for (j = 0; j < ny; j++) {
|
|
|
|
|
if (half[i*ny+j] != twice[4*i*ny + 2*j]) {
|
1998-04-09 05:43:02 +08:00
|
|
|
|
sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
|
|
|
|
|
(unsigned long)i,
|
|
|
|
|
(unsigned long)j,
|
|
|
|
|
(unsigned long)i*2,
|
|
|
|
|
(unsigned long)j*2);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
} else if (half[i*ny + j] != twice[4*i*ny + 2*j + 1]) {
|
1998-04-09 05:43:02 +08:00
|
|
|
|
sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
|
|
|
|
|
(unsigned long)i,
|
|
|
|
|
(unsigned long)j,
|
|
|
|
|
(unsigned long)i*2,
|
|
|
|
|
(unsigned long)j*2+1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
} else if (half[i*ny + j] != twice[(2*i +1)*2*ny + 2*j]) {
|
1998-04-09 05:43:02 +08:00
|
|
|
|
sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
|
|
|
|
|
(unsigned long)i,
|
|
|
|
|
(unsigned long)j,
|
|
|
|
|
(unsigned long)i*2+1,
|
|
|
|
|
(unsigned long)j*2);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
} else if (half[i*ny + j] != twice[(2*i+1)*2*ny + 2*j+1]) {
|
1998-04-09 05:43:02 +08:00
|
|
|
|
sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
|
|
|
|
|
(unsigned long)i,
|
|
|
|
|
(unsigned long)j,
|
|
|
|
|
(unsigned long)i*2+1,
|
|
|
|
|
(unsigned long)j*2+1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
}
|
|
|
|
|
if (s[0]) {
|
|
|
|
|
puts("*FAILED*");
|
[svn-r15150] Purpose: Separate Windows function macro definitions to win32defs.h
Description:
In library code, we try not to use system calls directly, but instead use the HD{function} macro instead. This way, we can map special versions of the call on particular systems. Previously, it was all done in H5private.h. However, in an effort to clean up platform-specific definitions, we move all of the Windows macros into a separate file, win32defs.h. This way, we can use the non-Posix versions that Visual Studio sends warnings about.
Some macros are set specifically in the platform-specific header files. Then, any macros left unset will be set by the "default" implementation in H5private.h.
This checkin also cleans up various source files to use the HD* macros when possible.
Tested:
VS2005 on WinXP
VS.NET on WinXP
h5committest (kagiso, linew, smirom)
2008-06-06 02:52:19 +08:00
|
|
|
|
if (!HDisatty(1)) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
AT();
|
|
|
|
|
printf(" %s\n Half is:\n", s);
|
2006-10-31 08:13:27 +08:00
|
|
|
|
print_array(half, nx, ny, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
printf("\n Twice is:\n");
|
2006-10-31 08:13:27 +08:00
|
|
|
|
print_array(twice, 2 * nx, 2 * ny, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
}
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
}
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
puts(" PASSED");
|
|
|
|
|
|
2003-11-08 23:32:53 +08:00
|
|
|
|
HDfree(full);
|
|
|
|
|
HDfree(half);
|
|
|
|
|
HDfree(twice);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
return SUCCEED;
|
|
|
|
|
|
|
|
|
|
error:
|
2003-11-08 23:32:53 +08:00
|
|
|
|
HDfree(full);
|
|
|
|
|
HDfree(half);
|
|
|
|
|
HDfree(twice);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
return FAIL;
|
1997-10-21 07:22:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
2003-05-08 05:52:24 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: test_array_fill
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Tests H5V_array_fill routine by copying a multibyte value
|
|
|
|
|
* (an array of ints, in our case) into all the elements of an
|
|
|
|
|
* array.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: SUCCEED
|
|
|
|
|
*
|
|
|
|
|
* Failure: FAIL
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* Monday, April 21, 2003
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
|
|
|
|
test_array_fill(size_t lo, size_t hi)
|
|
|
|
|
{
|
|
|
|
|
int *dst; /* Destination */
|
|
|
|
|
int src[ARRAY_FILL_SIZE]; /* Source to duplicate */
|
|
|
|
|
size_t u, v, w; /* Local index variables */
|
|
|
|
|
char s[256];
|
|
|
|
|
|
|
|
|
|
sprintf(s, "array filling %4lu-%-4lu elements", (unsigned long)lo,(unsigned long)hi);
|
|
|
|
|
TESTING(s);
|
|
|
|
|
|
|
|
|
|
/* Initialize */
|
2003-11-08 23:32:53 +08:00
|
|
|
|
dst = HDcalloc(sizeof(int),ARRAY_FILL_SIZE * hi);
|
2003-05-08 05:52:24 +08:00
|
|
|
|
|
|
|
|
|
/* Setup */
|
|
|
|
|
for(u=0; u<ARRAY_FILL_SIZE; u++)
|
2004-04-18 12:10:09 +08:00
|
|
|
|
src[u]=(char)u;
|
2003-05-08 05:52:24 +08:00
|
|
|
|
|
|
|
|
|
/* Fill */
|
|
|
|
|
for(w=lo; w<=hi; w++) {
|
|
|
|
|
H5V_array_fill(dst,src,sizeof(src),w);
|
|
|
|
|
|
|
|
|
|
/* Check */
|
|
|
|
|
for(u=0; u<w; u++)
|
|
|
|
|
for(v=0; v<ARRAY_FILL_SIZE; v++)
|
|
|
|
|
if(dst[(u*ARRAY_FILL_SIZE)+v]!=src[v]) TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
HDmemset(dst,0,sizeof(int)*ARRAY_FILL_SIZE*w);
|
|
|
|
|
} /* end for */
|
|
|
|
|
PASSED();
|
|
|
|
|
|
2003-11-08 23:32:53 +08:00
|
|
|
|
HDfree(dst);
|
2003-05-08 05:52:24 +08:00
|
|
|
|
return SUCCEED;
|
|
|
|
|
|
|
|
|
|
error:
|
2003-11-08 23:32:53 +08:00
|
|
|
|
HDfree(dst);
|
2003-05-08 05:52:24 +08:00
|
|
|
|
return FAIL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: test_array_offset_n_calc
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Tests H5V_array_offset and H5V_array_calc routines by comparing
|
|
|
|
|
* computed array offsets against calculated ones and then going
|
|
|
|
|
* back to the coordinates from the offset and checking those.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: SUCCEED
|
|
|
|
|
*
|
|
|
|
|
* Failure: FAIL
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* Monday, April 21, 2003
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
|
|
|
|
test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
|
|
|
|
|
{
|
|
|
|
|
hsize_t *a, *temp_a; /* Array for stored calculated offsets */
|
|
|
|
|
hsize_t off; /* Offset in array */
|
|
|
|
|
size_t u, v, w; /* Local index variables */
|
|
|
|
|
hsize_t dims[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of array to check */
|
2004-12-29 22:26:20 +08:00
|
|
|
|
hsize_t coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates to check offset of */
|
|
|
|
|
hsize_t new_coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of offset */
|
2003-05-08 05:52:24 +08:00
|
|
|
|
char s[256];
|
|
|
|
|
|
|
|
|
|
sprintf(s, "array offset %4lux%4lux%4lu elements", (unsigned long)z,(unsigned long)y,(unsigned long)x);
|
|
|
|
|
TESTING(s);
|
|
|
|
|
|
|
|
|
|
/* Initialize */
|
2003-11-08 23:32:53 +08:00
|
|
|
|
a = HDmalloc(sizeof(hsize_t) * x * y *z);
|
2003-05-08 05:52:24 +08:00
|
|
|
|
dims[0]=z;
|
|
|
|
|
dims[1]=y;
|
|
|
|
|
dims[2]=x;
|
|
|
|
|
|
|
|
|
|
/* Setup */
|
|
|
|
|
for(u=0, temp_a=a, off=0; u<z; u++)
|
|
|
|
|
for(v=0; v<y; v++)
|
|
|
|
|
for(w=0; w<x; w++)
|
|
|
|
|
*temp_a++ = off++;
|
|
|
|
|
|
|
|
|
|
/* Check offsets */
|
|
|
|
|
for(u=0; u<n; u++) {
|
|
|
|
|
/* Get random coordinate */
|
2004-04-18 12:10:09 +08:00
|
|
|
|
coords[0] = (hssize_t)(HDrandom() % z);
|
|
|
|
|
coords[1] = (hssize_t)(HDrandom() % y);
|
|
|
|
|
coords[2] = (hssize_t)(HDrandom() % x);
|
2003-05-08 05:52:24 +08:00
|
|
|
|
|
|
|
|
|
/* Get offset of coordinate */
|
|
|
|
|
off=H5V_array_offset(ARRAY_OFFSET_NDIMS,dims,coords);
|
|
|
|
|
|
|
|
|
|
/* Check offset of coordinate */
|
|
|
|
|
if(a[off]!=off) TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Get coordinates of offset */
|
|
|
|
|
if(H5V_array_calc(off,ARRAY_OFFSET_NDIMS,dims,new_coords)<0) TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Check computed coordinates */
|
|
|
|
|
for(v=0; v<ARRAY_OFFSET_NDIMS; v++)
|
|
|
|
|
if(coords[v]!=new_coords[v]) {
|
|
|
|
|
HDfprintf(stderr,"coords[%u]=%Hu, new_coords[%u]=%Hu\n",(unsigned)v,coords[v],(unsigned)v,new_coords[v]);
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
}
|
|
|
|
|
} /* end for */
|
|
|
|
|
|
|
|
|
|
PASSED();
|
|
|
|
|
|
2003-11-08 23:32:53 +08:00
|
|
|
|
HDfree(a);
|
2003-05-08 05:52:24 +08:00
|
|
|
|
return SUCCEED;
|
|
|
|
|
|
|
|
|
|
error:
|
2003-11-08 23:32:53 +08:00
|
|
|
|
HDfree(a);
|
2003-05-08 05:52:24 +08:00
|
|
|
|
return FAIL;
|
|
|
|
|
}
|
|
|
|
|
|
1997-10-21 07:22:19 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Function: main
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Purpose: Test various hyperslab operations. Give the words
|
|
|
|
|
* `small' and/or `medium' on the command line or only `small'
|
|
|
|
|
* is assumed.
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Return: Success: exit(0)
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Failure: exit(non-zero)
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
1998-03-05 00:20:23 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Friday, October 10, 1997
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
int
|
1998-01-17 06:23:43 +08:00
|
|
|
|
main(int argc, char *argv[])
|
1997-10-21 07:22:19 +08:00
|
|
|
|
{
|
1998-03-05 00:20:23 +08:00
|
|
|
|
herr_t status;
|
|
|
|
|
int nerrors = 0;
|
2001-08-15 06:09:56 +08:00
|
|
|
|
unsigned size_of_test;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
2003-05-08 05:52:24 +08:00
|
|
|
|
/* Parse arguments or assume `small' & `medium' */
|
1998-01-17 06:23:43 +08:00
|
|
|
|
if (1 == argc) {
|
2003-05-08 05:52:24 +08:00
|
|
|
|
size_of_test = TEST_SMALL | TEST_MEDIUM;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
} else {
|
2001-08-15 06:09:56 +08:00
|
|
|
|
int i;
|
1998-03-05 00:20:23 +08:00
|
|
|
|
for (i = 1, size_of_test = 0; i < argc; i++) {
|
|
|
|
|
if (!strcmp(argv[i], "small")) {
|
|
|
|
|
size_of_test |= TEST_SMALL;
|
|
|
|
|
} else if (!strcmp(argv[i], "medium")) {
|
|
|
|
|
size_of_test |= TEST_MEDIUM;
|
|
|
|
|
} else {
|
|
|
|
|
printf("unrecognized argument: %s\n", argv[i]);
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
printf("Test sizes: ");
|
|
|
|
|
if (size_of_test & TEST_SMALL)
|
1998-03-05 00:20:23 +08:00
|
|
|
|
printf(" SMALL");
|
1998-01-17 06:23:43 +08:00
|
|
|
|
if (size_of_test & TEST_MEDIUM)
|
1998-03-05 00:20:23 +08:00
|
|
|
|
printf(" MEDIUM");
|
1998-01-17 06:23:43 +08:00
|
|
|
|
printf("\n");
|
|
|
|
|
|
2003-05-08 05:52:24 +08:00
|
|
|
|
/* Set the random # seed */
|
2004-04-18 12:10:09 +08:00
|
|
|
|
HDsrandom((unsigned long)HDtime(NULL));
|
2003-05-08 05:52:24 +08:00
|
|
|
|
|
2003-02-08 05:14:19 +08:00
|
|
|
|
/*
|
|
|
|
|
* Open the library explicitly for thread-safe builds, so per-thread
|
|
|
|
|
* things are initialized correctly.
|
|
|
|
|
*/
|
|
|
|
|
#ifdef H5_HAVE_THREADSAFE
|
|
|
|
|
H5open();
|
|
|
|
|
#endif /* H5_HAVE_THREADSAFE */
|
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/*
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* TEST HYPERSLAB FILL OPERATION
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
*/
|
|
|
|
|
if (size_of_test & TEST_SMALL) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_fill((size_t)11, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_fill((size_t)11, (size_t)10, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_fill((size_t)3, (size_t)5, (size_t)5, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
if (size_of_test & TEST_MEDIUM) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_fill((size_t)113, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_fill((size_t)15, (size_t)11, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_fill((size_t)5, (size_t)7, (size_t)7, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
1997-10-21 07:22:19 +08:00
|
|
|
|
/*------------------------------
|
|
|
|
|
* TEST HYPERSLAB COPY OPERATION
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*------------------------------
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*/
|
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* exhaustive, one-dimensional test */
|
|
|
|
|
if (size_of_test & TEST_SMALL) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_SRC, (size_t)11, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_DST, (size_t)11, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_BOTH, (size_t)11, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
if (size_of_test & TEST_MEDIUM) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_SRC, (size_t)179, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_DST, (size_t)179, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_BOTH, (size_t)179, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
/* exhaustive, two-dimensional test */
|
|
|
|
|
if (size_of_test & TEST_SMALL) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_SRC, (size_t)11, (size_t)10, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_DST, (size_t)11, (size_t)10, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_BOTH, (size_t)11, (size_t)10, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
if (size_of_test & TEST_MEDIUM) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_SRC, (size_t)13, (size_t)19, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_DST, (size_t)13, (size_t)19, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_BOTH, (size_t)13, (size_t)19, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
/* sparse, two-dimensional test */
|
|
|
|
|
if (size_of_test & TEST_MEDIUM) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_SRC, (size_t)73, (size_t)67, (size_t)0, (size_t)7, (size_t)11, (size_t)1, (size_t)13, (size_t)11, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_DST, (size_t)73, (size_t)67, (size_t)0, (size_t)7, (size_t)11, (size_t)1, (size_t)13, (size_t)11, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_BOTH, (size_t)73, (size_t)67, (size_t)0, (size_t)7, (size_t)11, (size_t)1, (size_t)13, (size_t)11, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
/* exhaustive, three-dimensional test */
|
|
|
|
|
if (size_of_test & TEST_SMALL) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_SRC, (size_t)3, (size_t)5, (size_t)5, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_DST, (size_t)3, (size_t)5, (size_t)5, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_BOTH, (size_t)3, (size_t)5, (size_t)5, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
if (size_of_test & TEST_MEDIUM) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_SRC, (size_t)7, (size_t)9, (size_t)5, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_DST, (size_t)7, (size_t)9, (size_t)5, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_copy(VARIABLE_BOTH, (size_t)7, (size_t)9, (size_t)5, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
1997-10-21 07:22:19 +08:00
|
|
|
|
/*---------------------
|
|
|
|
|
* TEST MULTI-BYTE FILL
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*---------------------
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*/
|
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
if (size_of_test & TEST_SMALL) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_multifill((size_t)10);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
if (size_of_test & TEST_MEDIUM) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_multifill((size_t)500000);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
1997-10-21 07:22:19 +08:00
|
|
|
|
/*---------------------------
|
|
|
|
|
* TEST TRANSLATION OPERATORS
|
|
|
|
|
*---------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
if (size_of_test & TEST_SMALL) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_endian((size_t)10);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_transpose((size_t)9, (size_t)9);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_transpose((size_t)3, (size_t)11);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
if (size_of_test & TEST_MEDIUM) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_endian((size_t)800000);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_transpose((size_t)1200, (size_t)1200);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_transpose((size_t)800, (size_t)1800);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
1997-10-21 07:22:19 +08:00
|
|
|
|
/*-------------------------
|
|
|
|
|
* TEST SAMPLING OPERATIONS
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*-------------------------
|
1997-10-21 07:22:19 +08:00
|
|
|
|
*/
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
if (size_of_test & TEST_SMALL) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_sub_super((size_t)5, (size_t)10);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
if (size_of_test & TEST_MEDIUM) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_sub_super((size_t)480, (size_t)640);
|
1998-03-05 00:20:23 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
2003-05-08 05:52:24 +08:00
|
|
|
|
/*-------------------------
|
|
|
|
|
* TEST ARRAY FILL OPERATIONS
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*-------------------------
|
2003-05-08 05:52:24 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (size_of_test & TEST_SMALL) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_array_fill((size_t)1, (size_t)9);
|
2003-05-08 05:52:24 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
|
|
|
|
}
|
|
|
|
|
if (size_of_test & TEST_MEDIUM) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_array_fill((size_t)9, (size_t)257);
|
2003-05-08 05:52:24 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
|
|
|
|
}
|
|
|
|
|
/*-------------------------
|
|
|
|
|
* TEST ARRAY OFFSET OPERATIONS
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*-------------------------
|
2003-05-08 05:52:24 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (size_of_test & TEST_SMALL) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_array_offset_n_calc((size_t)20, (size_t)7, (size_t)11, (size_t)13);
|
2003-05-08 05:52:24 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
|
|
|
|
}
|
|
|
|
|
if (size_of_test & TEST_MEDIUM) {
|
2006-10-31 08:13:27 +08:00
|
|
|
|
status = test_array_offset_n_calc((size_t)500, (size_t)71, (size_t)193, (size_t)347);
|
2003-05-08 05:52:24 +08:00
|
|
|
|
nerrors += status < 0 ? 1 : 0;
|
|
|
|
|
}
|
1998-08-15 05:05:16 +08:00
|
|
|
|
|
|
|
|
|
/*--- END OF TESTS ---*/
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
if (nerrors) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
printf("***** %d HYPERSLAB TEST%s FAILED! *****\n",
|
|
|
|
|
nerrors, 1 == nerrors ? "" : "S");
|
[svn-r15150] Purpose: Separate Windows function macro definitions to win32defs.h
Description:
In library code, we try not to use system calls directly, but instead use the HD{function} macro instead. This way, we can map special versions of the call on particular systems. Previously, it was all done in H5private.h. However, in an effort to clean up platform-specific definitions, we move all of the Windows macros into a separate file, win32defs.h. This way, we can use the non-Posix versions that Visual Studio sends warnings about.
Some macros are set specifically in the platform-specific header files. Then, any macros left unset will be set by the "default" implementation in H5private.h.
This checkin also cleans up various source files to use the HD* macros when possible.
Tested:
VS2005 on WinXP
VS.NET on WinXP
h5committest (kagiso, linew, smirom)
2008-06-06 02:52:19 +08:00
|
|
|
|
if (HDisatty(1)) {
|
1998-03-05 00:20:23 +08:00
|
|
|
|
printf("(Redirect output to a pager or a file to see "
|
|
|
|
|
"debug output)\n");
|
|
|
|
|
}
|
|
|
|
|
exit(1);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
printf("All hyperslab tests passed.\n");
|
2003-02-08 05:14:19 +08:00
|
|
|
|
|
|
|
|
|
#ifdef H5_HAVE_THREADSAFE
|
|
|
|
|
H5close();
|
|
|
|
|
#endif /* H5_HAVE_THREADSAFE */
|
1998-02-10 03:37:40 +08:00
|
|
|
|
return 0;
|
1997-10-21 07:22:19 +08:00
|
|
|
|
}
|