From 41241d47e579bde20f97d6977c746bf1b7cdade0 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 13 Oct 1998 17:42:24 -0500 Subject: [svn-r759] Added missing test file. --- test/trefer.c | 232 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 232 insertions(+) create mode 100644 test/trefer.c diff --git a/test/trefer.c b/test/trefer.c new file mode 100644 index 0000000..1fece32 --- /dev/null +++ b/test/trefer.c @@ -0,0 +1,232 @@ +/**************************************************************************** + * NCSA HDF * + * Software Development Group * + * National Center for Supercomputing Applications * + * University of Illinois at Urbana-Champaign * + * 605 E. Springfield, Champaign IL 61820 * + * * + * For conditions of distribution and use, see the accompanying * + * hdf/COPYING file. * + * * + ****************************************************************************/ + +#ifdef RCSID +static char RcsId[] = "$Revision$"; +#endif + +/* $Id$ */ + +/*********************************************************** +* +* Test program: trefer +* +* Test the Reference functionality +* +*************************************************************/ + +#include + +#include + +#define FILE "trefer.h5" + +/* 1-D dataset with fixed dimensions */ +#define SPACE1_NAME "Space1" +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 + +/**************************************************************** +** +** test_reference_obj(): Test basic H5R (reference) object reference code. +** Tests references to various kinds of objects +** +****************************************************************/ +static void +test_reference_obj(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t group; /* Group ID */ + hid_t sid1; /* Dataspace ID */ + hsize_t dims1[] = {SPACE1_DIM1}; + href_t *wbuf, /* buffer to write to disk */ + *rbuf, /* buffer read from disk */ + *tbuf; /* temp. buffer read from disk */ + H5R_type_t reftype; /* Reference type created */ + uint32 *tu32; /* Temporary pointer to uint32 data */ + intn i; /* counting variables */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Object Reference Functions\n")); + + /* Allocate write & read buffers */ + wbuf=malloc(sizeof(href_t)*SPACE1_DIM1); + rbuf=malloc(sizeof(href_t)*SPACE1_DIM1); + tbuf=malloc(sizeof(href_t)*SPACE1_DIM1); + + /* Create file */ + fid1 = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid1, FAIL, "H5Fcreate"); + + /* Create dataspace for datasets */ + sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); + CHECK(sid1, FAIL, "H5Screate_simple"); + + /* Create a group */ + group=H5Gcreate(fid1,"Group1",-1); + CHECK(group, FAIL, "H5Gcreate"); + + /* Close group */ + ret = H5Gclose(group); + CHECK(ret, FAIL, "H5Gclose"); + + /* Create a dataset */ + dataset=H5Dcreate(fid1,"Dataset1",H5T_STD_U32LE,sid1,H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dcreate"); + + for(tu32=(uint32 *)wbuf,i=0; i