hdf5/test/links.c
Robb Matzke 1e8ebeecfc [svn-r410] Changes since 19980604
----------------------

./src/H5A.c
	Named data types can have attributes.

	Fixed bugs where the API functions didn't check the return
	values of their internal counterparts and thus the automatic
	error reporting didn't work.

	Fixed some places where the error stack wasn't cleared after a
	function returned failure.

	Data types returned by H5Aget_type() are always read-only.

	If the `attr_num' argument of H5Aiterate() is null then it
	acts like H5Giterate() instead of failing -- it begins
	processing attributes with the first one.

./src/H5D.c
	We check for allocation overruns when scalar datasets are
	stored in external files.

./src/H5O.c
	H5O_modify() will fail if the message is >=16kB.

./src/H5Oattr.c
	Split some long lines

./src/H5T.c
./src/H5Tprivate.h
	Added H5T_entof() to support attributes on named types.

./src/h5ls.c
	Prints the names of attributes and their sizes.

./test/cmpd_dset.c
./test/dsets.c
./test/dtypes.c
./test/extend.c
./test/external.c
./test/gheap.c
./test/istore.c
./test/links.c
./test/shtype.c
	If the environment variable HDF5_NOCLEANUP is defined then the
	temporary files are not removed.  The testhdf5 program still
	has the bug that it removes *.h5, clobbering test files from
	other programs... oh well.

./test/dtypes.c
	Added attribute tests.
1998-06-05 16:03:49 -05:00

91 lines
2.0 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Copyright (C) 1998 NCSA
* All rights reserved.
*
* Programmer: Robb Matzke <matzke@llnl.gov>
* Friday, April 10, 1998
*
* Purpose: Tests hard and soft (symbolic) links.
*/
#include <hdf5.h>
#include <stdlib.h>
#define TEST_FILE_NAME "links.h5"
/*-------------------------------------------------------------------------
* Function: cleanup
*
* Purpose: Cleanup temporary test files
*
* Return: none
*
* Programmer: Albert Cheng
* May 28, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static void
cleanup(void)
{
if (!getenv ("HDF5_NOCLEANUP")) {
remove(TEST_FILE_NAME);
}
}
/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Tests links.
*
* Return: Success: 0
*
* Failure: non-zero
*
* Programmer: Robb Matzke
* Friday, April 10, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
int
main (void)
{
hid_t file, scalar, grp, d1;
hsize_t size[1] = {1};
/* Create a file */
file = H5Fcreate (TEST_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
scalar = H5Screate_simple (1, size, size);
/* Create a group */
grp = H5Gcreate (file, "grp1", 0);
H5Gclose (grp);
/* Create a dataset */
d1 = H5Dcreate (file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT);
H5Dclose (d1);
/* Create a hard link */
H5Glink (file, H5G_LINK_HARD, "d1", "grp1/hard");
/* Create a symbolic link */
H5Glink (file, H5G_LINK_SOFT, "/d1", "grp1/soft");
/* Create a symbolic link to something that doesn't exist */
H5Glink (file, H5G_LINK_SOFT, "foobar", "grp1/dangle");
/* Create a recursive symbolic link */
H5Glink (file, H5G_LINK_SOFT, "/grp1/recursive", "/grp1/recursive");
/* Close */
H5Sclose (scalar);
H5Fclose (file);
cleanup();
return 0;
}