From d49ed7bedfdb13c3a5d58cae8def4d5dc1eb8bbf Mon Sep 17 00:00:00 2001 From: Robb Matzke Date: Wed, 10 Dec 1997 17:41:56 -0500 Subject: [svn-r140] ./test/Makefile.in Added new tests. ./test/dsets.c NEW Tests datasets. ./test/dspace.c NEW Tests data spaces. ./test/dtypes.c NEW Tests data types. ./test/istore.c ./test/tfile.c ./test/th5p.c ./test/theap.c ./test/tohdr.c Changed to work with new function names. ./test/testhdf5.c Removed the data type and dataset tests since they're now in their own files. They had to be rewritten because of extensive changes to those interfaces. --- test/Makefile.in | 24 +++-- test/dsets.c | 267 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/dspace.c | 14 +++ test/dtypes.c | 174 ++++++++++++++++++++++++++++++++++++ test/istore.c | 13 +-- test/testhdf5.c | 2 - test/tfile.c | 86 +++++++++--------- test/th5d.c | 263 ------------------------------------------------------ test/th5p.c | 12 +-- test/th5t.c | 126 -------------------------- test/theap.c | 2 +- test/tohdr.c | 2 +- 12 files changed, 530 insertions(+), 455 deletions(-) create mode 100644 test/dsets.c create mode 100644 test/dspace.c create mode 100644 test/dtypes.c delete mode 100644 test/th5d.c delete mode 100644 test/th5t.c diff --git a/test/Makefile.in b/test/Makefile.in index d2cbe3a..66bd646 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -9,22 +9,28 @@ # Add include directory to the C preprocessor flags. CPPFLAGS=-I. -I../src @CPPFLAGS@ -# These are our main targets: -PROGS=testhdf5 hyperslab istore +# These are our main targets. They should be listed in the order to be +# executed, generally most specific tests to least specific tests. +PROGS=testhdf5 hyperslab istore dtypes dsets TESTS=$(PROGS) # Source and object files for programs... The PROG_SRC list contains all the # source files and is used for things like dependencies, archiving, etc. The # other source lists are for the individual tests, the files of which may # overlap with other tests. -PROG_SRC=testhdf5.c tfile.c theap.c tmeta.c tohdr.c tstab.c th5t.c th5p.c \ - th5d.c hyperslab.c istore.c +PROG_SRC=testhdf5.c tfile.c theap.c tmeta.c tohdr.c tstab.c th5p.c dtypes.c \ + hyperslab.c istore.c dsets.c PROG_OBJ=$(PROG_SRC:.c=.o) -TESTHDF5_SRC=testhdf5.c tfile.c theap.c tmeta.c tohdr.c tstab.c th5t.c \ - th5p.c th5d.c +TESTHDF5_SRC=testhdf5.c tfile.c theap.c tmeta.c tohdr.c tstab.c th5p.c TESTHDF5_OBJ=$(TESTHDF5_SRC:.c=.o) +DSETS_SRC=dsets.c +DSETS_OBJ=$(DSETS_SRC:.c=.o) + +DTYPES_SRC=dtypes.c +DTYPES_OBJ=$(DTYPES_SRC:.c=.o) + HYPERSLAB_SRC=hyperslab.c HYPERSLAB_OBJ=$(HYPERSLAB_SRC:.c=.o) @@ -38,6 +44,12 @@ PRIVATE_HDR=testhdf5.h testhdf5: $(TESTHDF5_OBJ) ../src/libhdf5.a $(CC) $(CFLAGS) -o $@ $(TESTHDF5_OBJ) ../src/libhdf5.a $(LIBS) +dsets: $(DSETS_OBJ) ../src/libhdf5.a + $(CC) $(CFLAGS) -o $@ $(DSETS_OBJ) ../src/libhdf5.a $(LIBS) + +dtypes: $(DTYPES_OBJ) ../src/libhdf5.a + $(CC) $(CFLAGS) -o $@ $(DTYPES_OBJ) ../src/libhdf5.a $(LIBS) + hyperslab: $(HYPERSLAB_OBJ) ../src/libhdf5.a $(CC) $(CFLAGS) -o $@ $(HYPERSLAB_OBJ) ../src/libhdf5.a $(LIBS) diff --git a/test/dsets.c b/test/dsets.c new file mode 100644 index 0000000..382cb9b --- /dev/null +++ b/test/dsets.c @@ -0,0 +1,267 @@ +/* + * Copyright (C) 1997 NCSA + * All rights reserved. + * + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 + * + * Purpose: Tests the dataset interface (H5D) + */ +#include +#include +#include +#include +#include + +#define AT() printf (" at %s:%d in %s()...\n", \ + __FILE__, __LINE__, __FUNCTION__); + + + +/*------------------------------------------------------------------------- + * Function: test_create + * + * Purpose: Attempts to create a dataset. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +test_create (hid_t file) +{ + hid_t dataset, space; + intn dims[2]; + herr_t status; + + printf ("%-70s", "Testing create/open/close"); + + + /* Create the data space */ + space = H5Pcreate (H5P_SIMPLE); + dims[0] = 256; + dims[1] = 512; + status = H5Pset_space (space, 2, dims); + assert (status>=0); + + /* Create the dataset */ + dataset = H5Dcreate (file, "dataset_01", H5T_NATIVE_DOUBLE, space, + H5C_DEFAULT); + if (dataset<0) { + puts ("*FAILED*"); + if (!isatty (1)) { + AT (); + printf (" Cannot create initial dataset.\n"); + } + goto error; + } + + /* Close the dataset */ + if (H5Dclose (dataset)<0) { + puts ("*FAILED*"); + if (!isatty (1)) { + AT (); + printf (" Cannot close initial dataset.\n"); + } + goto error; + } + + /* Try creating a dataset that already exists. This should fail. */ + dataset = H5Dcreate (file, "dataset_01", H5T_NATIVE_DOUBLE, space, + H5C_DEFAULT); + if (dataset>=0) { + puts ("*FAILED*"); + if (!isatty (1)) { + AT (); + printf (" Library allowed overwrite of existing dataset.\n"); + } + goto error; + } + + /* Try opening and closing an existing dataset */ + dataset = H5Dopen (file, "dataset_01"); + if (dataset<0) { + puts ("*FAILED*"); + if (!isatty (1)) { + AT (); + printf (" Cannot open dataset `dataset_01'.\n"); + } + goto error; + } + if (H5Dclose (dataset)<0) { + puts ("*FAILED*"); + if (!isatty (1)) { + AT (); + printf (" Cannot close dataset.\n"); + } + goto error; + } + + /* Try opening a non-existent dataset. This should fail */ + dataset = H5Dopen (file, "does_not_exist"); + if (dataset>=0) { + puts ("*FAILED*"); + if (!isatty (1)) { + AT (); + printf (" Opened a non-existent dataset.\n"); + } + goto error; + } + + puts (" PASSED"); + return SUCCEED; + + error: + return FAIL; +} + + + +/*------------------------------------------------------------------------- + * Function: test_simple_io + * + * Purpose: Tests simple I/O. That is, reading and writing a complete + * multi-dimensional array without data type or data space + * conversions, without compression, and stored contiguously. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Wednesday, December 10, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +test_simple_io (hid_t file) +{ + hid_t dataset, space; + herr_t status; + int points[100][200], check[100][200]; + int i, j, n, dims[2]; + + printf ("%-70s", "Testing simple I/O"); + + /* Initialize the dataset */ + for (i=n=0; i<100; i++) { + for (j=0; j<100; j++) { + points[i][j] = n++; + } + } + + /* Create the data space */ + space = H5Pcreate (H5P_SIMPLE); + dims[0] = 100; + dims[1] = 200; + status = H5Pset_space (space, 2, dims); + assert (status>=0); + + /* Create the dataset */ + dataset = H5Dcreate (file, "dataset_02", H5T_NATIVE_INT, space, + H5C_DEFAULT); + assert (dataset>=0); + + /* Write the data to the dataset */ + status = H5Dwrite (dataset, H5T_NATIVE_INT, H5P_ALL, H5C_DEFAULT, points); + if (status<0) { + puts ("*FAILED*"); + if (!isatty (1)) { + AT (); + printf (" H5Dwrite() failed\n"); + } + goto error; + } + + /* Read the dataset back */ + status = H5Dread (dataset, H5T_NATIVE_INT, H5P_ALL, H5C_DEFAULT, check); + if (status<0) { + puts ("*FAILED*"); + if (!isatty (1)) { + AT (); + printf (" H5Dread() failed\n"); + } + goto error; + } + + /* Check that the values read are the same as the values written */ + for (i=0; i<100; i++) { + for (j=0; j<200; j++) { + if (points[i][j]!=check[i][j]) { + puts ("*FAILED*"); + if (!isatty (1)) { + AT (); + printf (" Read different values than written.\n"); + printf (" At index %d,%d\n", i, j); + } + goto error; + } + } + } + + puts (" PASSED"); + return SUCCEED; + + error: + return FAIL; +} + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Tests the dataset interface (H5D) + * + * Return: Success: exit(0) + * + * Failure: exit(1) + * + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +int +main (void) +{ + hid_t file; + herr_t status; + intn nerrors = 0; + + + unlink ("dataset.h5"); + file = H5Fcreate ("dataset.h5", H5ACC_DEFAULT, H5C_DEFAULT, H5C_DEFAULT); + assert (file>=0); + + status = test_create (file); + nerrors += status<0 ? 1 : 0; + + status = test_simple_io (file); + nerrors += status<0 ? 1 : 0; + + status = H5Fclose (file); + + if (nerrors) { + printf ("***** %d DATASET TEST%s FAILED! *****\n", + nerrors, 1==nerrors?"":"S"); + if (isatty (1)) { + printf ("(Redirect output to a pager or a file to see debug " + "output)\n"); + } + exit (1); + } + + printf ("All dataset tests passed.\n"); + exit (0); +} diff --git a/test/dspace.c b/test/dspace.c new file mode 100644 index 0000000..2d6f54f --- /dev/null +++ b/test/dspace.c @@ -0,0 +1,14 @@ +/* + * Copyright (C) 1997 NCSA + * All rights reserved. + * + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 + * + * Purpose: Tests the data space interface (H5P). + */ + +int +main (void) +{ + diff --git a/test/dtypes.c b/test/dtypes.c new file mode 100644 index 0000000..b4e865f --- /dev/null +++ b/test/dtypes.c @@ -0,0 +1,174 @@ +/* + * Copyright (C) 1997 NCSA + * All rights reserved. + * + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 + * + * Purpose: Tests the data type interface (H5T) + */ +#include +#include +#include + + +#define AT() printf (" at %s:%d in %s()...\n", \ + __FILE__, __LINE__, __FUNCTION__); + + + +/*------------------------------------------------------------------------- + * Function: test_classes + * + * Purpose: Test type classes + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +test_classes (void) +{ + H5T_class_t type_class; + + printf ("%-70s", "Testing H5Tget_class()"); + + if (H5T_FIXED!=(type_class=H5Tget_class (H5T_NATIVE_INT))) { + puts ("*FAILED*"); + if (!isatty (1)) { + AT (); + printf (" Invalid type class for H5T_NATIVE_INT\n"); + } + goto error; + } + + if (H5T_FLOAT!=(type_class=H5Tget_class (H5T_NATIVE_DOUBLE))) { + puts ("*FAILED*"); + if (!isatty (1)) { + AT (); + printf (" Invalid type class for H5T_NATIVE_DOUBLE\n"); + } + goto error; + } + + + + puts (" PASSED"); + return SUCCEED; + + error: + return FAIL; +} + + + +/*------------------------------------------------------------------------- + * Function: test_copy + * + * Purpose: Are we able to copy a data type? + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +test_copy (void) +{ + hid_t a_copy; + + printf ("%-70s", "Testing H5Tcopy()"); + + if ((a_copy=H5Tcopy (H5T_NATIVE_SHORT))<0) { + puts ("*FAILED*"); + if (!isatty (1)) { + AT (); + printf (" Cannot copy a builtin type.\n"); + } + goto error; + } + + if (H5Tclose (a_copy)<0) { + puts ("*FAILED*"); + if (!isatty (1)) { + AT (); + printf (" Cannot close the copied type.\n"); + } + goto error; + } + + if (H5Tclose (H5T_NATIVE_CHAR)>=0) { + puts ("*FAILED*"); + if (!isatty (1)) { + AT (); + printf (" Was able to free a built-in type.\n"); + } + goto error; + } + + puts (" PASSED"); + return SUCCEED; + + error: + return FAIL; +} + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Test the data type interface. + * + * Return: Success: + * + * Failure: + * + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +int +main (void) +{ + herr_t status; + intn nerrors = 0; + + H5init (); + + status = test_classes (); + nerrors += status<0 ? 1 : 0; + + status = test_copy (); + nerrors += status<0 ? 1 : 0; + + + if (nerrors) { + printf ("***** %d DATA TYPE TEST%s FAILED! *****\n", + nerrors, 1==nerrors?"":"S"); + if (isatty (1)) { + printf ("(Redirect output to a pager or a file to see debug " + "output)\n"); + } + exit (1); + } + + printf ("All data type tests passed.\n"); + exit (0); +} + diff --git a/test/istore.c b/test/istore.c index 6487a30..589829e 100644 --- a/test/istore.c +++ b/test/istore.c @@ -8,13 +8,14 @@ * Purpose: Tests various aspects of indexed raw data storage. */ #include +#include #include #include #include #include #include -#if 0 +#if 1 # define FILETYPE H5F_LOW_DFLT # define FILENAME "istore.h5" #elif 0 @@ -118,7 +119,7 @@ new_object (H5F_t *f, const char *name, size_t ndims) } } - H5F_istore_new (f, &istore, ndims, alignment); + H5F_istore_create (f, &istore, ndims, alignment); if (H5O_modify (f, NO_ADDR, handle, H5O_ISTORE, H5O_NEW_MESG, &istore)<0) { printf ("*FAILED*\n"); @@ -525,7 +526,7 @@ main (int argc, char *argv[]) uint8 offset_size; H5G_entry_t *ent = NULL; hid_t template_id; - file_create_temp_t *creation_template = NULL; + H5F_create_t *creation_template = NULL; setbuf (stdout, NULL); @@ -557,8 +558,8 @@ main (int argc, char *argv[]) * Use larger file addresses... */ offset_size = 8; - template_id = H5C_copy (H5C_get_default_atom (H5_TEMPLATE)); - H5Csetparm (template_id, H5_OFFSET_SIZE, &offset_size); + template_id = H5Ccreate (H5C_FILE_CREATE); + H5Csetparm (template_id, H5F_OFFSET_SIZE, &offset_size); creation_template = H5Aatom_object (template_id); /* Create the test file */ @@ -577,7 +578,7 @@ main (int argc, char *argv[]) * allocated a whole bunch of data. */ haddr_t addr; - addr.offset = (uint64)1<<33; /*8GB*/ + addr.offset = 250 * ((uint64)1<<30); /*250 GB*/ H5F_low_seteof (f->shared->lf, &addr); } #endif diff --git a/test/testhdf5.c b/test/testhdf5.c index 98ac03c..716a740 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -157,9 +157,7 @@ int main(int argc, char *argv[]) InitTest("heap", test_heap, "Object and Name Heaps"); InitTest("ohdr", test_ohdr, "Object Headers"); InitTest("stab", test_stab, "Symbol Tables"); - InitTest("h5t", test_h5t, "Datatypes"); InitTest("h5p", test_h5p, "Dataspaces"); - InitTest("h5d", test_h5d, "Datasets"); Verbosity = 4; /* Default Verbosity is Low */ H5version(&major, &minor, &release, &patch); diff --git a/test/tfile.c b/test/tfile.c index d7ba2d6..ffd2d19 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -31,11 +31,11 @@ static char RcsId[] = "$Revision$"; #include #include -#define F1_USERBLOCK_SIZE H5C_USERBLOCK_DEFAULT -#define F1_OFFSET_SIZE H5C_OFFSETSIZE_DEFAULT -#define F1_LENGTH_SIZE H5C_LENGTHSIZE_DEFAULT -#define F1_SYM_LEAF_K H5C_SYM_LEAF_K_DEFAULT -#define F1_SYM_INTERN_K (btree_k_default_g[H5B_SNODE_ID]) +#define F1_USERBLOCK_SIZE 0 +#define F1_OFFSET_SIZE 4 +#define F1_LENGTH_SIZE 4 +#define F1_SYM_LEAF_K 4 +#define F1_SYM_INTERN_K 16 #define FILE1 "tfile1.h5" #define F2_USERBLOCK_SIZE 512 @@ -45,15 +45,13 @@ static char RcsId[] = "$Revision$"; #define F2_SYM_INTERN_K 32 #define FILE2 "tfile2.h5" -#define F3_USERBLOCK_SIZE H5C_USERBLOCK_DEFAULT +#define F3_USERBLOCK_SIZE 0 #define F3_OFFSET_SIZE F2_OFFSET_SIZE #define F3_LENGTH_SIZE F2_LENGTH_SIZE #define F3_SYM_LEAF_K F2_SYM_LEAF_K #define F3_SYM_INTERN_K F2_SYM_INTERN_K #define FILE3 "tfile3.h5" -static const uintn btree_k_default_g[] = H5C_BTREE_K_DEFAULT; - /**************************************************************** ** ** test_file_create(): Low-level file creation I/O test routine. @@ -79,61 +77,61 @@ static void test_file_create(void) VERIFY(fid2,FAIL,"H5Fcreate"); /* Get the file-creation template */ - tmpl1=H5Fget_create_template(fid1); + tmpl1 = H5Fget_create_template (fid1); CHECK(tmpl1,FAIL,"H5Fget_create_template"); /* Get the file-creation parameters */ - ret=H5Cgetparm(tmpl1,H5_USERBLOCK_SIZE,&parm); + ret=H5Cgetparm(tmpl1,H5F_USERBLOCK_SIZE,&parm); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm,F1_USERBLOCK_SIZE,"H5Cgetparm"); - ret=H5Cgetparm(tmpl1,H5_OFFSET_SIZE,&parm2); + ret=H5Cgetparm(tmpl1,H5F_OFFSET_SIZE,&parm2); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm2,F1_OFFSET_SIZE,"H5Cgetparm"); - ret=H5Cgetparm(tmpl1,H5_LENGTH_SIZE,&parm2); + ret=H5Cgetparm(tmpl1,H5F_LENGTH_SIZE,&parm2); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm2,F1_LENGTH_SIZE,"H5Cgetparm"); - ret=H5Cgetparm(tmpl1,H5_SYM_LEAF_K,&parm); + ret=H5Cgetparm(tmpl1,H5F_SYM_LEAF_K,&parm); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm,F1_SYM_LEAF_K,"H5Cgetparm"); - ret=H5Cgetparm(tmpl1,H5_SYM_INTERN_K,&parm); + ret=H5Cgetparm(tmpl1,H5F_SYM_INTERN_K,&parm); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm,F1_SYM_INTERN_K,"H5Cgetparm"); /* Release file-creation template */ - ret=H5Mrelease(tmpl1); + ret=H5Mclose(tmpl1); CHECK(ret,FAIL,"H5Mrelease"); /* Double-check that the atom has been vaporized */ - ret=H5Mrelease(tmpl1); + ret=H5Mclose(tmpl1); VERIFY(ret,FAIL,"H5Mrelease"); /* Create a new file with a non-standard file-creation template */ - tmpl1=H5Mcreate(fid1,H5_TEMPLATE,NULL); - CHECK(tmpl1,FAIL,"H5Mcreate"); + tmpl1 = H5Ccreate (H5C_FILE_CREATE); + CHECK(tmpl1,FAIL,"H5Cnew"); /* Set the new file-creation parameters */ parm=F2_USERBLOCK_SIZE; - ret=H5Csetparm(tmpl1,H5_USERBLOCK_SIZE,&parm); + ret=H5Csetparm(tmpl1,H5F_USERBLOCK_SIZE,&parm); CHECK(ret,FAIL,"H5Csetparm"); parm2=F2_OFFSET_SIZE; - ret=H5Csetparm(tmpl1,H5_OFFSET_SIZE,&parm2); + ret=H5Csetparm(tmpl1,H5F_OFFSET_SIZE,&parm2); CHECK(ret,FAIL,"H5Csetparm"); parm2=F2_LENGTH_SIZE; - ret=H5Csetparm(tmpl1,H5_LENGTH_SIZE,&parm2); + ret=H5Csetparm(tmpl1,H5F_LENGTH_SIZE,&parm2); CHECK(ret,FAIL,"H5Csetparm"); parm=F2_SYM_LEAF_K; - ret=H5Csetparm(tmpl1,H5_SYM_LEAF_K,&parm); + ret=H5Csetparm(tmpl1,H5F_SYM_LEAF_K,&parm); CHECK(ret,FAIL,"H5Csetparm"); parm=F2_SYM_INTERN_K; - ret=H5Csetparm(tmpl1,H5_SYM_INTERN_K,&parm); + ret=H5Csetparm(tmpl1,H5F_SYM_INTERN_K,&parm); CHECK(ret,FAIL,"H5Csetparm"); /* Try to create second file, with non-standard file-creation template params */ @@ -141,7 +139,7 @@ static void test_file_create(void) CHECK(fid2,FAIL,"H5Fcreate"); /* Release file-creation template */ - ret=H5Mrelease(tmpl1); + ret=H5Mclose(tmpl1); CHECK(ret,FAIL,"H5Mrelease"); /* Get the file-creation template */ @@ -149,23 +147,23 @@ static void test_file_create(void) CHECK(tmpl1,FAIL,"H5Fget_create_template"); /* Get the file-creation parameters */ - ret=H5Cgetparm(tmpl1,H5_USERBLOCK_SIZE,&parm); + ret=H5Cgetparm(tmpl1,H5F_USERBLOCK_SIZE,&parm); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm,F2_USERBLOCK_SIZE,"H5Cgetparm"); - ret=H5Cgetparm(tmpl1,H5_OFFSET_SIZE,&parm2); + ret=H5Cgetparm(tmpl1,H5F_OFFSET_SIZE,&parm2); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm2,F2_LENGTH_SIZE,"H5Cgetparm"); - ret=H5Cgetparm(tmpl1,H5_LENGTH_SIZE,&parm2); + ret=H5Cgetparm(tmpl1,H5F_LENGTH_SIZE,&parm2); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm2,F2_OFFSET_SIZE,"H5Cgetparm"); - ret=H5Cgetparm(tmpl1,H5_SYM_LEAF_K,&parm); + ret=H5Cgetparm(tmpl1,H5F_SYM_LEAF_K,&parm); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm,F2_SYM_LEAF_K,"H5Cgetparm"); - ret=H5Cgetparm(tmpl1,H5_SYM_INTERN_K,&parm); + ret=H5Cgetparm(tmpl1,H5F_SYM_INTERN_K,&parm); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm,F2_SYM_INTERN_K,"H5Cgetparm"); @@ -174,12 +172,12 @@ static void test_file_create(void) CHECK(tmpl2,FAIL,"H5Mcopy"); /* Release file-creation template */ - ret=H5Mrelease(tmpl1); + ret=H5Mclose(tmpl1); CHECK(ret,FAIL,"H5Mrelease"); /* Set the new file-creation parameter */ parm=F3_USERBLOCK_SIZE; - ret=H5Csetparm(tmpl2,H5_USERBLOCK_SIZE,&parm); + ret=H5Csetparm(tmpl2,H5F_USERBLOCK_SIZE,&parm); CHECK(ret,FAIL,"H5Csetparm"); /* Try to create second file, with non-standard file-creation template params */ @@ -187,7 +185,7 @@ static void test_file_create(void) CHECK(fid3,FAIL,"H5Fcreate"); /* Release file-creation template */ - ret=H5Mrelease(tmpl2); + ret=H5Mclose(tmpl2); CHECK(ret,FAIL,"H5Mrelease"); /* Get the file-creation template */ @@ -195,28 +193,28 @@ static void test_file_create(void) CHECK(tmpl1,FAIL,"H5Fget_create_template"); /* Get the file-creation parameters */ - ret=H5Cgetparm(tmpl1,H5_USERBLOCK_SIZE,&parm); + ret=H5Cgetparm(tmpl1,H5F_USERBLOCK_SIZE,&parm); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm,F3_USERBLOCK_SIZE,"H5Cgetparm"); - ret=H5Cgetparm(tmpl1,H5_OFFSET_SIZE,&parm2); + ret=H5Cgetparm(tmpl1,H5F_OFFSET_SIZE,&parm2); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm2,F3_LENGTH_SIZE,"H5Cgetparm"); - ret=H5Cgetparm(tmpl1,H5_LENGTH_SIZE,&parm2); + ret=H5Cgetparm(tmpl1,H5F_LENGTH_SIZE,&parm2); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm2,F3_OFFSET_SIZE,"H5Cgetparm"); - ret=H5Cgetparm(tmpl1,H5_SYM_LEAF_K,&parm); + ret=H5Cgetparm(tmpl1,H5F_SYM_LEAF_K,&parm); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm,F3_SYM_LEAF_K,"H5Cgetparm"); - ret=H5Cgetparm(tmpl1,H5_SYM_INTERN_K,&parm); + ret=H5Cgetparm(tmpl1,H5F_SYM_INTERN_K,&parm); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm,F3_SYM_INTERN_K,"H5Cgetparm"); /* Release file-creation template */ - ret=H5Mrelease(tmpl1); + ret=H5Mclose(tmpl1); CHECK(ret,FAIL,"H5Mrelease"); /* Close first file */ @@ -258,28 +256,28 @@ static void test_file_open(void) CHECK(tmpl1,FAIL,"H5Fget_create_template"); /* Get the file-creation parameters */ - ret=H5Cgetparm(tmpl1,H5_USERBLOCK_SIZE,&parm); + ret=H5Cgetparm(tmpl1,H5F_USERBLOCK_SIZE,&parm); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm,F2_USERBLOCK_SIZE,"H5Cgetparm"); - ret=H5Cgetparm(tmpl1,H5_OFFSET_SIZE,&parm2); + ret=H5Cgetparm(tmpl1,H5F_OFFSET_SIZE,&parm2); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm2,F2_OFFSET_SIZE,"H5Cgetparm"); - ret=H5Cgetparm(tmpl1,H5_LENGTH_SIZE,&parm2); + ret=H5Cgetparm(tmpl1,H5F_LENGTH_SIZE,&parm2); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm2,F2_LENGTH_SIZE,"H5Cgetparm"); - ret=H5Cgetparm(tmpl1,H5_SYM_LEAF_K,&parm); + ret=H5Cgetparm(tmpl1,H5F_SYM_LEAF_K,&parm); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm,F2_SYM_LEAF_K,"H5Cgetparm"); - ret=H5Cgetparm(tmpl1,H5_SYM_INTERN_K,&parm); + ret=H5Cgetparm(tmpl1,H5F_SYM_INTERN_K,&parm); CHECK(ret,FAIL,"H5Cgetparm"); VERIFY(parm,F2_SYM_INTERN_K,"H5Cgetparm"); /* Release file-creation template */ - ret=H5Mrelease(tmpl1); + ret=H5Mclose(tmpl1); CHECK(ret,FAIL,"H5Mrelease"); /* Close first file */ diff --git a/test/th5d.c b/test/th5d.c deleted file mode 100644 index ffec238..0000000 --- a/test/th5d.c +++ /dev/null @@ -1,263 +0,0 @@ -/**************************************************************************** - * 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: th5d -* -* Test the basic dataset functionality -* -*************************************************************/ - -#include - -#include -#include -#include -#include - -#define FILE "th5d1.h5" - -/* 3-D dataset with fixed dimensions */ -#define SPACE1_NAME "Space1" -#define SPACE1_RANK 3 -#define SPACE1_DIM1 3 -#define SPACE1_DIM2 15 -#define SPACE1_DIM3 13 - -/* 32-bit big-endian integer type */ -#define TYPE1_NAME "Type1" -#define TYPE1_BASE H5T_INT -#define TYPE1_LEN 4 -#define TYPE1_ARCH H5T_BIGENDIAN - -/* 3-d 32-bit integer dataset */ -#define DATA1_NAME "Data1" -int32 data1[SPACE1_DIM1][SPACE1_DIM2][SPACE1_DIM3]; - -/* 4-D dataset with fixed dimensions */ -#define SPACE2_NAME "Space2" -#define SPACE2_RANK 4 -#define SPACE2_DIM1 3 -#define SPACE2_DIM2 15 -#define SPACE2_DIM3 13 -#define SPACE2_DIM4 7 - -/* 64-bit big-endian floating-point type */ -#define TYPE2_NAME "Type2" -#define TYPE2_BASE H5T_FLOAT -#define TYPE2_LEN 8 -#define TYPE2_ARCH H5T_BIGENDIAN - -/* 4-d 64-bit floating-point dataset */ -#define DATA2_NAME "Data2" -float64 data2[SPACE2_DIM1][SPACE2_DIM2][SPACE2_DIM3][SPACE2_DIM4]; - -/**************************************************************** -** -** init_data(): Initialize data arrays. -** -****************************************************************/ -static void init_data(void) -{ - int32 *ip; - float64 *fp; - uintn u; - - for(ip=(int32 *)data1, u=0; u<(SPACE1_DIM1*SPACE1_DIM2*SPACE1_DIM3); u++) - *ip++=(int32)u*2; - - for(fp=(float64 *)data2, u=0; u<(SPACE2_DIM1*SPACE2_DIM2*SPACE2_DIM3*SPACE2_DIM4); u++) - *fp++=((float64)u/4.0); -} - -/**************************************************************** -** -** test_h5d_basic_write(): Test basic H5D (dataset) writing code. -** -****************************************************************/ -static void test_h5d_basic_write(void) -{ - hid_t fid1; /* HDF5 File IDs */ - hid_t did1; /* Dataset ID */ - hid_t tid1; /* Datatype ID */ - hid_t sid1; /* Dataspace ID */ - uint32 dims1[]={SPACE1_DIM1,SPACE1_DIM2,SPACE1_DIM3}; /* dataspace dim sizes */ - hid_t did2; /* Dataset ID */ - hid_t tid2; /* Datatype ID */ - hid_t sid2; /* Dataspace ID */ - uint32 dims2[]={SPACE2_DIM1,SPACE2_DIM2,SPACE2_DIM3,SPACE2_DIM4}; /* dataspace dim sizes */ - herr_t ret; /* Generic return value */ - - /* Output message about test being performed */ - MESSAGE(5, ("Testing Datatype Manipulation\n")); - - /* Create file */ - fid1=H5Fcreate(FILE,H5ACC_OVERWRITE,0,0); - CHECK(fid1,FAIL,"H5Fcreate"); - - sid1=H5Mcreate(fid1,H5_DATASPACE,SPACE1_NAME); - CHECK(sid1,FAIL,"H5Mcreate"); - - ret=H5Pset_space(sid1,SPACE1_RANK,dims1); - CHECK(ret,FAIL,"H5Pset_space"); - - tid1=H5Mcreate(fid1,H5_DATATYPE,TYPE1_NAME); - CHECK(tid1,FAIL,"H5Mcreate"); - - ret=H5Tset_type(tid1,TYPE1_BASE,TYPE1_LEN,TYPE1_ARCH); - CHECK(ret,FAIL,"H5Tset_type"); - - did1=H5Mcreate(fid1,H5_DATASET,DATA1_NAME); - CHECK(did1,FAIL,"H5Mcreate"); - - ret=H5Dset_info(did1,tid1,sid1); - CHECK(ret,FAIL,"H5Dset_info"); - - ret=H5Dwrite(did1,H5P_ALL,data1); - CHECK(ret,FAIL,"H5Dwrite"); - - ret=H5Mrelease(did1); - CHECK(ret,FAIL,"H5Mrelease"); - - ret=H5Mrelease(tid1); - CHECK(ret,FAIL,"H5Mrelease"); - - /* Write second dataset out */ - sid2=H5Mcreate(fid1,H5_DATASPACE,SPACE2_NAME); - CHECK(sid1,FAIL,"H5Mcreate"); - - ret=H5Pset_space(sid2,SPACE2_RANK,dims2); - CHECK(ret,FAIL,"H5Pset_space"); - - tid2=H5Mcreate(fid1,H5_DATATYPE,TYPE2_NAME); - CHECK(tid2,FAIL,"H5Mcreate"); - - ret=H5Tset_type(tid2,TYPE2_BASE,TYPE2_LEN,TYPE2_ARCH); - CHECK(ret,FAIL,"H5Tset_type"); - - did2=H5Mcreate(fid1,H5_DATASET,DATA2_NAME); - CHECK(sid2,FAIL,"H5Mcreate"); - - ret=H5Dset_info(did2,tid2,sid2); - CHECK(ret,FAIL,"H5Dset_info"); - - ret=H5Dwrite(did2,H5P_ALL,data2); - CHECK(ret,FAIL,"H5Dwrite"); - - ret=H5Mrelease(did2); - CHECK(ret,FAIL,"H5Mrelease"); - - ret=H5Mrelease(tid2); - CHECK(ret,FAIL,"H5Mrelease"); - - ret=H5Mrelease(sid2); - CHECK(ret,FAIL,"H5Mrelease"); - - ret=H5Mrelease(sid1); - CHECK(ret,FAIL,"H5Mrelease"); - - /* Close first file */ - ret=H5Fclose(fid1); - CHECK(ret,FAIL,"H5Fclose"); -} /* test_h5d_basic_write() */ - -/**************************************************************** -** -** test_h5d_basic_read(): Test basic H5D (dataset) reading code. -** -****************************************************************/ -static void test_h5d_basic_read(void) -{ - hid_t fid1; /* HDF5 File IDs */ -#if 0 - hid_t oid1; /* Dataset OID */ -#endif - hid_t did1; /* Dataset ID */ - hid_t tid1; /* Datatype ID */ - hid_t sid1; /* Dataspace ID */ - void *buf; /* space for the buffer read */ - uint32 buf_size; /* size of the buffer to read */ - hid_t type; /* Datatype's base type */ - uint8 len, arch; /* Datatype's length and architecture */ - uintn n; /* number of dataspace elements */ - herr_t ret; /* Generic return value */ - - /* Output message about test being performed */ - MESSAGE(5, ("Testing Datatype Manipulation\n")); - - /* Create file */ - fid1=H5Fopen(FILE,0,0); - CHECK(fid1,FAIL,"H5Fopen"); - - did1 = H5Mfind_name (fid1, H5_DATASET, DATA1_NAME); - CHECK (did1, FAIL, "H5Mfind_name"); - - ret=H5Dget_info(did1,&tid1,&sid1); - CHECK(ret,FAIL,"H5Pget_info"); - - ret=H5Tis_atomic(tid1); - VERIFY(ret,BTRUE,"H5Tis_atomic"); - - ret=H5Tget_type(tid1,&type,&len,&arch); - CHECK(ret,FAIL,"H5Tget_type"); - VERIFY(type,TYPE1_BASE,"H5Tget_type"); - VERIFY(len,TYPE1_LEN,"H5Tget_type"); - VERIFY(arch,TYPE1_ARCH,"H5Tget_type"); - - n=H5Pnelem(sid1); - CHECK(n,UFAIL,"H5Pnelem"); - VERIFY(n,SPACE1_DIM1*SPACE1_DIM2*SPACE1_DIM3,"H5Pnelem"); - - buf_size=H5Tsize(tid1,BTRUE)*n; - buf=HDmalloc(buf_size); - ret=H5Dread(did1,H5P_ALL,buf); - CHECK(ret,FAIL,"H5Dread"); - VERIFY(HDmemcmp(buf,data1,buf_size),0,"H5Dread"); - HDfree(buf); - - ret=H5Mrelease(tid1); - CHECK(ret,FAIL,"H5Mrelease"); - - ret=H5Mrelease(sid1); - CHECK(ret,FAIL,"H5Mrelease"); - - ret=H5Mrelease(did1); - CHECK(ret,FAIL,"H5Mrelease"); - - /* Close first file */ - ret=H5Fclose(fid1); - CHECK(ret,FAIL,"H5Fclose"); -} /* test_h5d_basic_read() */ - - -/**************************************************************** -** -** test_h5d(): Main H5D (dataset) testing routine. -** -****************************************************************/ -void test_h5d(void) -{ - /* Output message about test being performed */ - MESSAGE(5, ("Testing datasets\n")); - - init_data(); /* initialize data arrays */ - test_h5d_basic_write(); /* Test basic H5D writing code */ - test_h5d_basic_read(); /* Test basic H5D reading code */ -} /* test_h5d() */ - diff --git a/test/th5p.c b/test/th5p.c index 2d5d3bf..a39f7de 100644 --- a/test/th5p.c +++ b/test/th5p.c @@ -71,13 +71,13 @@ static void test_h5p_basic(void) fid1=H5Fcreate(FILE,H5ACC_OVERWRITE,0,0); CHECK(fid1,FAIL,"H5Fcreate"); - sid1=H5Mcreate(fid1,H5_DATASPACE,SPACE1_NAME); + sid1=H5Pcreate (H5P_SIMPLE); CHECK(sid1,FAIL,"H5Mcreate"); ret=H5Pset_space(sid1,SPACE1_RANK,dims1); CHECK(ret,FAIL,"H5Pset_space"); - n=H5Pnelem(sid1); + n=H5Pget_npoints(sid1); CHECK(n,UFAIL,"H5Pnelem"); VERIFY(n,SPACE1_DIM1*SPACE1_DIM2*SPACE1_DIM3,"H5Pnelem"); @@ -89,13 +89,13 @@ static void test_h5p_basic(void) CHECK(ret,FAIL,"H5Pget_ldims"); VERIFY(HDmemcmp(tdims,dims1,SPACE1_RANK*sizeof(uint32)),0,"H5Pget_ldims"); - sid2=H5Mcreate(fid1,H5_DATASPACE,SPACE2_NAME); + sid2=H5Pcreate(H5P_SIMPLE); CHECK(sid2,FAIL,"H5Mcreate"); ret=H5Pset_space(sid2,SPACE2_RANK,dims2); CHECK(ret,FAIL,"H5Pset_space"); - n=H5Pnelem(sid2); + n=H5Pget_npoints(sid2); CHECK(n,UFAIL,"H5Pnelem"); VERIFY(n,SPACE2_DIM1*SPACE2_DIM2*SPACE2_DIM3*SPACE2_DIM4,"H5Pnelem"); @@ -107,10 +107,10 @@ static void test_h5p_basic(void) CHECK(ret,FAIL,"H5Pget_ldims"); VERIFY(HDmemcmp(tdims,dims2,SPACE2_RANK*sizeof(uint32)),0,"H5Pget_ldims"); - ret=H5Mrelease(sid1); + ret=H5Mclose(sid1); CHECK(ret,FAIL,"H5Mrelease"); - ret=H5Mrelease(sid2); + ret=H5Mclose(sid2); CHECK(ret,FAIL,"H5Mrelease"); /* Close first file */ diff --git a/test/th5t.c b/test/th5t.c deleted file mode 100644 index 8c44bd2..0000000 --- a/test/th5t.c +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** - * 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: tfile -* -* Test the low-level file I/O features. -* -*************************************************************/ - -#include - -#include -#include -#include -#include - -#define FILE "th5t1.h5" - -#define TYPE1_NAME "Type1" -#define TYPE1_BASE H5T_INT -#define TYPE1_LEN 4 -#define TYPE1_ARCH H5T_BIGENDIAN - -#define TYPE2_NAME "Type2" -#define TYPE2_BASE H5T_FLOAT -#define TYPE2_LEN 8 -#define TYPE2_ARCH H5T_LITTLEENDIAN - -/**************************************************************** -** -** test_h5t_basic(): Test basic H5T (datatype) code. -** -****************************************************************/ -static void test_h5t_basic(void) -{ - hid_t fid1; /* HDF5 File IDs */ - hid_t tid1,tid2; /* Datatype ID */ - hid_t type; /* Datatype's base type */ - uint8 len, arch; /* Datatype's length and architecture */ - herr_t ret; /* Generic return value */ - - /* Output message about test being performed */ - MESSAGE(5, ("Testing Datatype Manipulation\n")); - - /* Create file */ - fid1=H5Fcreate(FILE,H5ACC_OVERWRITE,0,0); - CHECK(fid1,FAIL,"H5Fcreate"); - - tid1=H5Mcreate(fid1,H5_DATATYPE,TYPE1_NAME); - CHECK(tid1,FAIL,"H5Mcreate"); - - ret=H5Tset_type(tid1,TYPE1_BASE,TYPE1_LEN,TYPE1_ARCH); - CHECK(ret,FAIL,"H5Tset_type"); - - ret=H5Tsize(tid1,BTRUE); - VERIFY(ret,TYPE1_LEN,"H5Tsize"); - - ret=H5Tis_atomic(tid1); - VERIFY(ret,BTRUE,"H5Tis_atomic"); - - ret=H5Tget_type(tid1,&type,&len,&arch); - CHECK(ret,FAIL,"H5Tget_type"); - VERIFY(type,TYPE1_BASE,"H5Tget_type"); - VERIFY(len,TYPE1_LEN,"H5Tget_type"); - VERIFY(arch,TYPE1_ARCH,"H5Tget_type"); - - tid2=H5Mcreate(fid1,H5_DATATYPE,TYPE2_NAME); - CHECK(tid1,FAIL,"H5Mcreate"); - - ret=H5Tset_type(tid2,TYPE2_BASE,TYPE2_LEN,TYPE2_ARCH); - CHECK(ret,FAIL,"H5Tset_type"); - - ret=H5Tsize(tid2,BTRUE); - VERIFY(ret,TYPE2_LEN,"H5Tsize"); - - ret=H5Tis_atomic(tid2); - VERIFY(ret,BTRUE,"H5Tis_atomic"); - - ret=H5Tget_type(tid2,&type,&len,&arch); - CHECK(ret,FAIL,"H5Tget_type"); - VERIFY(type,TYPE2_BASE,"H5Tget_type"); - VERIFY(len,TYPE2_LEN,"H5Tget_type"); - VERIFY(arch,TYPE2_ARCH,"H5Tget_type"); - - ret=H5Mrelease(tid1); - CHECK(ret,FAIL,"H5Mrelease"); - - ret=H5Mrelease(tid2); - CHECK(ret,FAIL,"H5Mrelease"); - - /* Close first file */ - ret=H5Fclose(fid1); - CHECK(ret,FAIL,"H5Fclose"); -} /* test_h5t_basic() */ - - -/**************************************************************** -** -** test_h5t(): Main H5T (datatype) testing routine. -** -****************************************************************/ -void test_h5t(void) -{ - /* Output message about test being performed */ - MESSAGE(5, ("Testing Datatypes\n")); - - test_h5t_basic(); /* Test basic H5T code */ -} /* test_h5t() */ - diff --git a/test/theap.c b/test/theap.c index d46726f..5a5bb72 100644 --- a/test/theap.c +++ b/test/theap.c @@ -60,7 +60,7 @@ test_heap (void) CHECK (f, NULL, "H5Aatom_object"); /* Create a new heap */ - status = H5H_new (f, H5H_LOCAL, 0, &heap_addr/*out*/); + status = H5H_create (f, H5H_LOCAL, 0, &heap_addr/*out*/); CHECK_I (status, "H5H_new"); /* Add stuff to the heap */ diff --git a/test/tohdr.c b/test/tohdr.c index 2ea0896..5c0711d 100644 --- a/test/tohdr.c +++ b/test/tohdr.c @@ -66,7 +66,7 @@ test_ohdr (void) /* the new object header */ MESSAGE (8, ("Creating new object header...\n")); - status = H5O_new (f, 1, 64, &oh_addr/*out*/); + status = H5O_create (f, 1, 64, &oh_addr/*out*/); CHECK_I (status, "H5O_new"); /* -- cgit v0.12