summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>1997-08-29 23:19:22 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>1997-08-29 23:19:22 (GMT)
commit064648a1f6c43e36da540ca28136b72bd038084e (patch)
tree511c515642d54414695d5e5a957422432822a50e /test
parent38a47455632a9845c5ddce1462e541e46c308cdc (diff)
downloadhdf5-064648a1f6c43e36da540ca28136b72bd038084e.zip
hdf5-064648a1f6c43e36da540ca28136b72bd038084e.tar.gz
hdf5-064648a1f6c43e36da540ca28136b72bd038084e.tar.bz2
[svn-r59] Added [basic] testing for H5T interface, which appears to be working well.
Diffstat (limited to 'test')
-rw-r--r--test/Makefile2
-rw-r--r--test/Makefile.in2
-rw-r--r--test/testhdf5.c5
-rw-r--r--test/testhdf5.h1
-rw-r--r--test/th5t.c126
5 files changed, 132 insertions, 4 deletions
diff --git a/test/Makefile b/test/Makefile
index c1a15bf..9de43c7 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -110,7 +110,7 @@ CPPFLAGS=-I. -I../src
PROGS=testhdf5
# Source and object files for programs...
-PROG_SRC=testhdf5.c tfile.c theap.c tmeta.c tohdr.c tstab.c
+PROG_SRC=testhdf5.c tfile.c theap.c tmeta.c tohdr.c tstab.c th5t.c
PROG_OBJ=$(PROG_SRC:.c=.o)
# Private header files (not to be installed)...
diff --git a/test/Makefile.in b/test/Makefile.in
index b40849e..4220624 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -13,7 +13,7 @@ CPPFLAGS=-I. -I../src @CPPFLAGS@
PROGS=testhdf5
# Source and object files for programs...
-PROG_SRC=testhdf5.c tfile.c theap.c tmeta.c tohdr.c tstab.c
+PROG_SRC=testhdf5.c tfile.c theap.c tmeta.c tohdr.c tstab.c th5t.c
PROG_OBJ=$(PROG_SRC:.c=.o)
# Private header files (not to be installed)...
diff --git a/test/testhdf5.c b/test/testhdf5.c
index 21dd790..de0e248 100644
--- a/test/testhdf5.c
+++ b/test/testhdf5.c
@@ -157,6 +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");
Verbosity = 4; /* Default Verbosity is Low */
H5version(&major, &minor, &release, &patch);
@@ -292,9 +293,9 @@ int main(int argc, char *argv[])
{
MESSAGE(2, ("\nCleaning Up...\n\n"));
#if !(defined DOS386 | defined WIN386)
- system("rm -f *.hdf *.tmp");
+ system("rm -f *.h5 *.tmp");
#else /* OLD_WAY */
- remove("*.hdf");
+ remove("*.h5");
remove("*.tmp");
#endif /* OLD_WAY */
} /* end if */
diff --git a/test/testhdf5.h b/test/testhdf5.h
index fb67428..37321ec 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -103,6 +103,7 @@ void test_file(void);
void test_heap (void);
void test_ohdr (void);
void test_stab (void);
+void test_h5t (void);
#endif /* HDF5TEST_H */
diff --git a/test/th5t.c b/test/th5t.c
new file mode 100644
index 0000000..1570de9
--- /dev/null
+++ b/test/th5t.c
@@ -0,0 +1,126 @@
+/****************************************************************************
+ * 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 <testhdf5.h>
+
+#include <H5private.h>
+#include <H5Bprivate.h>
+#include <H5Mprivate.h>
+#include <H5Tprivate.h>
+
+#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)
+{
+ hatom_t fid1; /* HDF5 File IDs */
+ hatom_t tid1,tid2; /* Datatype ID */
+ hatom_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,-1,-1,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,-1,-1,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() */
+