summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-06-12 17:31:06 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-06-12 17:31:06 (GMT)
commitdd58a3ec29a061f42609669ff633c0763f834af9 (patch)
tree82c95ae74cc9730a1920862f183cd98f8371e0f5 /test
parent674198fcc7454b962670010b0e3b120fa792f216 (diff)
downloadhdf5-dd58a3ec29a061f42609669ff633c0763f834af9.zip
hdf5-dd58a3ec29a061f42609669ff633c0763f834af9.tar.gz
hdf5-dd58a3ec29a061f42609669ff633c0763f834af9.tar.bz2
[svn-r425] Changes since 19980610
---------------------- THIS CHECKIN IS FOR QUINCEY -- NOT EVERYTHING WORKS (but it compiles) MOST OF THE CHANGES ARE FOR BETTER TYPE CONVERSION IN THE NEXT ALPHA ./MANIFEST ./src/H5Tbit.c NEW ./src/Makefile.in Bit vector operations (not done yet) ./configure.in Added -lm to the library list, needed by bit-vector operations and conversion functions. Removed vestiges of PARALLEL_SRC no longer used by the makefiles. Albert came up with a better way (that actually works :-) ./src/H5D.c No code changes. Split a couple of long lines, refilled a couple multi-line comments. ./src/H5T.c ./src/H5Tpublic.h Fixed a bug reported by Jim Reus regarding conversion of compound data types whose members require conversions which are satisfied by as-yet unregistered soft conversion functions. Added H5T_IEEE architecture, but the funny-looking integer types will be changed to H5T_BE_ and H5T_LE_ architectures with the type names changed to match the H5T_NATIVE_ integers. Added an H5Tconvert() but it hasn't been documented or tested yet. ./src/H5Tconv.c ./src/H5Tpkg.h Registered conversion functions integer->integer (a general case) and integer->float (for a specific case). The integer->integer conversion depends on the bitvector operations which aren't finished yet and the int->float conversion hasn't been retested since it was borrowed from AIO. Don't look at them yet, they're ugly :-) ./src/H5detect.c Fixed a typo which caused the msb_pad field of an atomic type to not be initialized. ./test/dtypes.c Added a test for number conversions but it's commented out until the conversion stuff is truly working.
Diffstat (limited to 'test')
-rw-r--r--test/dtypes.c74
1 files changed, 73 insertions, 1 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index eed8a29..e3d300f 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -499,6 +499,75 @@ test_named (void)
/*-------------------------------------------------------------------------
+ * Function: test_conv_num
+ *
+ * Purpose: Test atomic number conversions.
+ *
+ * Return: Success:
+ *
+ * Failure:
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, June 10, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_conv_num (void)
+{
+ const size_t ntests=1;
+ const size_t nelmts=1;
+
+ size_t i, j;
+ void *buf=NULL, *saved=NULL;
+
+ printf ("%-70s", "Testing atomic number conversions");
+
+ /* Allocate buffers */
+ buf = malloc (nelmts*8);
+ saved = malloc (nelmts*8);
+
+ for (i=0; i<ntests; i++) {
+
+ /* Start with NATIVE_INT */
+ for (j=0; j<nelmts; j++) ((int*)buf)[j] = rand();
+ memcpy (saved, buf, nelmts*sizeof(int));
+
+ /* Convert there and back */
+ if (H5Tconvert (H5T_NATIVE_INT, H5T_IEEE_S64LE, nelmts, buf,
+ NULL)<0) goto error;
+ if (H5Tconvert (H5T_IEEE_S64LE, H5T_NATIVE_INT, nelmts, buf,
+ NULL)<0) goto error;
+
+ /* Check results */
+ for (j=0; j<nelmts; j++) {
+ if (((int*)buf)[j]!=((int*)saved)[j]) {
+ puts ("*FAILED*");
+ printf (" Test %lu, elmt %lu, got %d instead of %d\n",
+ (unsigned long)i, (unsigned long)j,
+ ((int*)buf)[j], ((int*)saved)[j]);
+ goto error;
+ }
+ }
+ }
+
+ puts (" PASSED");
+ free (buf);
+ free (saved);
+ return 0;
+
+ error:
+ if (buf) free (buf);
+ if (saved) free (saved);
+ return -1;
+}
+
+
+
+
+/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Test the data type interface.
@@ -528,7 +597,10 @@ main(void)
nerrors += test_compound()<0 ? 1 : 0;
nerrors += test_transient ()<0 ? 1 : 0;
nerrors += test_named ()<0 ? 1 : 0;
-
+#if 0
+ nerrors += test_conv_num ()<0 ? 1 : 0;
+#endif
+
if (nerrors) {
printf("***** %d DATA TYPE TEST%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "S");