diff options
-rw-r--r-- | test/Makefile | 5 | ||||
-rw-r--r-- | test/testhdf5.c | 1 | ||||
-rw-r--r-- | test/testhdf5.h | 23 | ||||
-rw-r--r-- | test/tstab.c | 77 |
4 files changed, 94 insertions, 12 deletions
diff --git a/test/Makefile b/test/Makefile index c967547..c14fe3a 100644 --- a/test/Makefile +++ b/test/Makefile @@ -14,7 +14,7 @@ DEFS = -I../src INCL = ../src/hdf5.h testhdf5.h -OBJ = testhdf5.o tmeta.o tfile.o theap.o tohdr.o +OBJ = testhdf5.o tmeta.o tfile.o theap.o tohdr.o tstab.o LIBS = ../src/libhdf5.a @@ -50,4 +50,7 @@ theap.o: theap.c $(INCL) tohdr.o: tohdr.c $(INCL) $(CC) $(CFLAGS) $(DEFS) tohdr.c +tstab.o: tstab.c $(INCL) + $(CC) $(CFLAGS) $(DEFS) tstab.c + diff --git a/test/testhdf5.c b/test/testhdf5.c index eaedee8..6d1cfc9 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -150,6 +150,7 @@ int main(int argc, char *argv[]) InitTest("file", test_file, "Low-Level File I/O"); InitTest("heap", test_heap, "Object and Name Heaps"); InitTest("ohdr", test_ohdr, "Object Headers"); + InitTest("stab", test_stab, "Symbol Tables"); Verbosity = 4; /* Default Verbosity is Low */ H5version(&major, &minor, &release, &patch); diff --git a/test/testhdf5.h b/test/testhdf5.h index 63ea109..ae83311 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -48,23 +48,23 @@ if(ret == val) {print_func("*** UNEXPECTED RETURN from %s is %ld at line %4d in if (Verbosity>9) { \ print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \ (where), (int)__LINE__, __FILE__, (long)(ret)); \ - if ((ret)<0) { \ - print_func ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \ - (where), (long)(ret), (int)__LINE__, __FILE__); \ - num_errs++; \ - } \ + } \ + if ((ret)<0) { \ + print_func ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \ + (where), (long)(ret), (int)__LINE__, __FILE__); \ + num_errs++; \ } \ } #define CHECK_PTR(ret,where) { \ if (Verbosity>9) { \ print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ - (where), (int)__LINE__, __FILE__, (ret)); \ - if (!(ret)) { \ - print_func ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n",\ - (where), (int)__LINE__, __FILE__); \ - num_errs++; \ - } \ + (where), (int)__LINE__, __FILE__, (ret)); \ + } \ + if (!(ret)) { \ + print_func ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \ + (where), (int)__LINE__, __FILE__); \ + num_errs++; \ } \ } @@ -111,6 +111,7 @@ void test_metadata(void); void test_file(void); void test_heap (void); void test_ohdr (void); +void test_stab (void); #endif /* HDF5TEST_H */ diff --git a/test/tstab.c b/test/tstab.c new file mode 100644 index 0000000..0b4c80c --- /dev/null +++ b/test/tstab.c @@ -0,0 +1,77 @@ +/*------------------------------------------------------------------------- + * Copyright (C) 1997 National Center for Supercomputing Applications. + * All rights reserved. + * + *------------------------------------------------------------------------- + * + * Created: tstab.c + * Aug 7 1997 + * Robb Matzke <matzke@llnl.gov> + * + * Purpose: + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +#include "testhdf5.h" + +#include "H5ACprivate.h" +#include "H5Fprivate.h" +#include "H5Gprivate.h" + + +/*------------------------------------------------------------------------- + * Function: test_stab + * + * Purpose: Test symbol tables + * + * Return: void + * + * Programmer: Robb Matzke + * matzke@viper.llnl.gov + * Aug 7 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +test_stab (void) +{ + hatom_t fid; + hdf5_file_t *f; + haddr_t addr; + H5G_entry_t root, sub; + int i; + char name[256]; + herr_t status; + + MESSAGE (5, print_func("Testing Symbol Tables\n");); + + /* create the file */ + fid = H5Fcreate ("tstab.h5", H5ACC_OVERWRITE, 0, 0); + CHECK (fid, FAIL, "H5Fcreate"); + f = H5Aatom_object (fid); + CHECK (f, NULL, "H5Aatom_object"); + + /* create a new symbol table */ + addr = H5G_stab_new (f, &root, 100); + CHECK_I (addr, "H5G_stab_new"); + MESSAGE (8, print_func ("Root address is %lu\n", (unsigned long)addr);); + + /* create some empty symbol tables as objects in the root stab */ + for (i=0; i<16384; i++) { + addr = H5G_stab_new (f, &sub, 0); + CHECK_I (addr, "H5G_stab_new"); + + sprintf (name, "sub%05d", i); + MESSAGE (8, print_func ("%s\n", name);); + status = H5G_stab_insert (f, &root, name, &sub); + CHECK_I (status, "H5G_stab_insert"); + } + + + /* close the file */ + H5Fclose (fid); +} |