* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
* Test the Array Datatype functionality
*************************************************************/
#define FILENAME "tarray1.h5"
#define TESTFILE "tarrold.h5"
/* Forward declarations for custom vlen memory manager functions */
void *test_array_alloc_custom(size_t size, void *info);
void test_array_free_custom(void *mem, void *info);
/*-------------------------------------------------------------------------
* Function: test_array_atomic_1d
* Purpose: Test basic array datatype code.
* Tests 1-D array of atomic datatypes.
*-------------------------------------------------------------------------
CHECK(ret, FAIL, "H5Dclose");
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_atomic_1d() */
/*-------------------------------------------------------------------------
* Function: test_array_funcs
* Purpose: Test some type functions that are and aren't supposed to
*-------------------------------------------------------------------------
strpad=H5Tget_strpad(type);
VERIFY(strpad, FAIL, "H5Tget_strpad");
CHECK(ret, FAIL, "H5Tclose");
} /* end test_array_funcs() */
/*-------------------------------------------------------------------------
* Function: test_array_atomic_3d
* Purpose: Test basic array datatype code.
* Tests 3-D array of atomic datatypes.
*-------------------------------------------------------------------------
CHECK(ret, FAIL, "H5Dclose");
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_atomic_3d() */
/*-------------------------------------------------------------------------
* Function: test_array_array_atomic
* Purpose: Test basic array datatype code.
* Tests 1-D array 2-D arrays of atomic datatypes.
*-------------------------------------------------------------------------
CHECK(ret, FAIL, "H5Dclose");
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_array_atomic() */
/*-------------------------------------------------------------------------
* Function: test_array_compound_atomic
* Purpose: Test basic array datatype code.
* Tests 1-D array of compound datatypes (with no array fields).
*-------------------------------------------------------------------------
CHECK(ret, FAIL, "H5Dclose");
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_compound_atomic() */
/*-------------------------------------------------------------------------
* Function: test_array_compound_array
* Purpose: Test basic array datatype code.
* Tests 1-D array of compound datatypes (with array fields).
*-------------------------------------------------------------------------
} /* end test_array_compound_array() */
/****************************************************************
** test_array_alloc_custom(): Test VL datatype custom memory
** allocation routines. This routine just uses malloc to
** allocate the memory and increments the amount of memory
****************************************************************/
/*-------------------------------------------------------------------------
* Function: test_array_alloc_custom
* Purpose: Memory allocator for testing VL datatype custom memory
* This routine just uses malloc to allocate the memory and
* increments the amount of memory allocated.
if((ret_value = HDmalloc(extra+size)) != NULL) {
*(size_t *)ret_value = size;
ret_value = ((unsigned char *)ret_value) + extra;
} /* end test_array_alloc_custom() */
/*-------------------------------------------------------------------------
* Function: test_array_free_custom
* Purpose: Memory free function for testing VL datatype custom memory
* This routine just uses free to free the memory and
* decrements the amount of memory allocated.
mem = ((unsigned char *)_mem) - extra;
*mem_used -= *(size_t *)mem;
} /* end test_array_free_custom() */
/*-------------------------------------------------------------------------
* Function: test_array_vlen_atomic
* Purpose: Test basic array datatype code.
* Tests 1-D array of atomic VL datatypes.
*-------------------------------------------------------------------------
CHECK(ret, FAIL, "H5Dclose");
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_vlen_atomic() */
/*-------------------------------------------------------------------------
* Function: test_array_vlen_array
* Purpose: Test basic array datatype code.
* Tests 1-D array of 1-D array VL datatypes.
*-------------------------------------------------------------------------
CHECK(ret, FAIL, "H5Dclose");
CHECK(ret, FAIL, "H5Fclose");
} /* end test_array_vlen_array() */
/*-------------------------------------------------------------------------
* Function: test_array_bkg
* Purpose: Test basic array datatype code.
* Tests reading compound datatype with array fields and
* writing partial fields.
*-------------------------------------------------------------------------
hsize_t dim[] = {LENGTH};
unsigned ndims[3] = {1,1,1};
CmpDTSinfo *dtsinfo = NULL;
status = H5Tclose (type);
CHECK(status, FAIL, "H5Tclose");
CHECK(status, FAIL, "H5Fclose");
} /* end test_array_bkg() */
/*-------------------------------------------------------------------------
* Purpose: Test array datatype compatibility code.
* Reads file containing old version of datatype object header
* messages for compound datatypes and verifies reading the older
* version of the is working correctly.
CHECK_I(ret, "H5Fclose");
printf("***cannot open the pre-created compound datatype test file (%s)\n",testfile);
} /* end test_compat() */
/*-------------------------------------------------------------------------
* Purpose: Main array datatype testing routine.
*-------------------------------------------------------------------------
test_array_vlen_array(); /* Test 1-D array of 1-D array VL datatypes */
test_array_funcs(); /* Test type functions with array types */
test_array_bkg(); /* Read compound datatype with array fields and background fields read */
/* This test uses a custom file */
test_compat(); /* Test compatibility changes for compound datatype fields */
/*-------------------------------------------------------------------------
* Function: cleanup_array
* Purpose: Cleanup temporary test files
* Programmer: Quincey Koziol