diff options
author | Robb Matzke <matzke@llnl.gov> | 1998-11-21 03:36:51 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1998-11-21 03:36:51 (GMT) |
commit | 7488c6366e878651f6bb8dc94f05eb69cd0df83b (patch) | |
tree | c2ba0295a0bec1b350fa3d4fa291b46ac75e271f /test/bittests.c | |
parent | 6345a417a3930b32ec9e5fc087e0aeb20a94aed7 (diff) | |
download | hdf5-7488c6366e878651f6bb8dc94f05eb69cd0df83b.zip hdf5-7488c6366e878651f6bb8dc94f05eb69cd0df83b.tar.gz hdf5-7488c6366e878651f6bb8dc94f05eb69cd0df83b.tar.bz2 |
[svn-r936] Changes since 19981119
----------------------
./src/H5.c
./src/H5A.c
./src/H5AC.c
./src/H5B.c
./src/H5D.c
./src/H5E.c
./src/H5F.c
./src/H5Farray.c
./src/H5Fcore.c
./src/H5Ffamily.c
./src/H5Fistore.c
./src/H5Flow.c
./src/H5Fmpio.c
./src/H5Fsec2.c
./src/H5Fsplit.c
./src/H5Fstdio.c
./src/H5G.c
./src/H5Gent.c
./src/H5Gnode.c
./src/H5Gstab.c
./src/H5HG.c
./src/H5HL.c
./src/H5I.c
./src/H5Iprivate.h
./src/H5MF.c
./src/H5MM.c
./src/H5O.c
./src/H5Oattr.c
./src/H5Ocomp.c
./src/H5Ocont.c
./src/H5Odtype.c
./src/H5Oefl.c
./src/H5Ofill.c
./src/H5Olayout.c
./src/H5Omtime.c
./src/H5Oname.c
./src/H5Osdspace.c
./src/H5Oshared.c
./src/H5Ostab.c
./src/H5P.c
./src/H5R.c
./src/H5RA.c
./src/H5S.c
./src/H5Sall.c
./src/H5Shyper.c
./src/H5Smpio.c
./src/H5Snone.c
./src/H5Spoint.c
./src/H5Sselect.c
./src/H5T.c
./src/H5TB.c
./src/H5Tbit.c
./src/H5Tconv.c
./src/H5V.c
./src/H5Z.c
./src/H5detect.c
./src/H5private.h
Most of these changes are because the `interface_initialize_g'
variable change from hbool_t to int. It's a one line change.
Changed the way the library is closed so we have more control
over the order the interfaces are shut down. Instead of
registering an atexit() function for every interface in some
haphazard order we just register one: H5_term_library() which
then calls the H5*_term_interface() functions in a
well-defined order.
If the library is closed and then reopened repeatedly by
calling H5close() and H5open() in a loop we only add one copy
of the library termination functions with atexit().
Termination is a two-step process in order to help detect
programming errors that would cause an infinite loop caused by
the termination of one interface waking up some other
previously terminated interface. The first step terminates
the interface and *marks it as unusable*. After all
interfaces are terminated then we mark them all as usable
again. The FUNC_ENTER() macro has been modified to return
failure or to dump core (depending on whether NDEBUG is
defined) if we try to call an interface while it's shutting
down.
./src/H5.c
The H5dont_atexit() function returns failure if it's called
more than once or if it's called too late. However, the error
stack is not automatically printed on failure because the
library might not be initialized yet
./test/chunk.c
./test/flush1.c
./test/flush2.c
./test/iopipe.c
./test/overhead.c
./test/ragged.c
Changed the extra cast for Win32 so we do floating point
division again -- it was just confusion about precedence and
associativity of casting and the C coercion rules. Removed
extra carriage returns inserted by broken operating system.
./src/H5Ffamily.c
Fixed an bug where H5F_fam_write() lowered the EOF marker for
one of the family members causing H5F_fam_read() to read
zeros.
./test/h5test.h [NEW]
./test/h5test.c [NEW]
./test/Makefile.in
./test/bittests.c
./test/cmpd_dset.c
./test/dsets.c
./test/dtypes.c
./test/extend.c
./test/external.c
Support library for test files. This isn't done yet but
Katie's contractions are ~10 minutes apart so I figured I
better back this stuff up just in case I'm not here next
week...
Eventually all test files will understand HDF5_DRIVER to name
the low level file driver and parameters so we can easily test
various drivers. They will also understand HDF5_PREFIX to
prepend to the beginning of file names which is necessary for
testing ROMIO with various drivers. Also, the cleanup function
will know how to use the file name prefix and will understand
different file driver naming schemes like file families. I'm
not sure they'll understand the `gsf:' type prefixes yet.
Note, the external test is completely commented out because
I'm in the middle of modifying it. It will still compile and
run but it doesn't test anything at the moment.
Diffstat (limited to 'test/bittests.c')
-rw-r--r-- | test/bittests.c | 198 |
1 files changed, 98 insertions, 100 deletions
diff --git a/test/bittests.c b/test/bittests.c index 6b1f1d9..2c8daef 100644 --- a/test/bittests.c +++ b/test/bittests.c @@ -7,6 +7,8 @@ * * Purpose: Tests functions in H5Tbit.c */ +#include <h5test.h> + #define H5T_PACKAGE #include <H5Tpkg.h> @@ -38,21 +40,20 @@ test_find (void) intn i; ssize_t n; - printf ("%-70s", "Testing bit search operations"); - fflush (stdout); + TESTING("bit search operations"); /* The zero length buffer */ memset (v1, 0xaa, sizeof v1); n = H5T_bit_find (v1, 0, 0, H5T_BIT_LSB, TRUE); if (-1!=n) { - puts ("*FAILED*"); - puts (" Zero length test failed (lsb)!"); + FAILED(); + puts (" Zero length test failed (lsb)!"); goto failed; } n = H5T_bit_find (v1, 0, 0, H5T_BIT_MSB, TRUE); if (-1!=n) { - puts ("*FAILED*"); - puts (" Zero length test failed (msb)!"); + FAILED(); + puts (" Zero length test failed (msb)!"); goto failed; } @@ -61,14 +62,14 @@ test_find (void) memset (v1, 0, sizeof v1); n = H5T_bit_find (v1, 0, 8*sizeof(v1), H5T_BIT_LSB, TRUE); if (-1!=n) { - puts ("*FAILED*"); - puts (" Zero buffer test failed (lsb)!"); + FAILED(); + puts (" Zero buffer test failed (lsb)!"); goto failed; } n = H5T_bit_find (v1, 0, 8*sizeof(v1), H5T_BIT_MSB, TRUE); if (-1!=n) { - puts ("*FAILED*"); - puts (" Zero buffer test failed (msb)!"); + FAILED(); + puts (" Zero buffer test failed (msb)!"); goto failed; } @@ -78,14 +79,14 @@ test_find (void) v1[i/8] = 1<<(i%8); n = H5T_bit_find (v1, 0, 8*sizeof(v1), H5T_BIT_LSB, TRUE); if ((ssize_t)i!=n) { - puts ("*FAILED*"); - printf (" Test for set bit %d failed (lsb)!\n", i); + FAILED(); + printf (" Test for set bit %d failed (lsb)!\n", i); goto failed; } n = H5T_bit_find (v1, 0, 8*sizeof(v1), H5T_BIT_MSB, TRUE); if ((ssize_t)i!=n) { - puts ("*FAILED*"); - printf (" Test for set bit %d failed (msb)!\n", i); + FAILED(); + printf (" Test for set bit %d failed (msb)!\n", i); goto failed; } } @@ -94,14 +95,14 @@ test_find (void) memset (v1, 0xff, sizeof v1); n = H5T_bit_find (v1, 0, 8*sizeof(v1), H5T_BIT_LSB, FALSE); if (-1!=n) { - puts ("*FAILED*"); - puts (" One buffer test failed (lsb)!"); + FAILED(); + puts (" One buffer test failed (lsb)!"); goto failed; } n = H5T_bit_find (v1, 0, 8*sizeof(v1), H5T_BIT_MSB, FALSE); if (-1!=n) { - puts ("*FAILED*"); - puts (" One buffer test failed (msb)!"); + FAILED(); + puts (" One buffer test failed (msb)!"); goto failed; } @@ -111,24 +112,24 @@ test_find (void) v1[i/8] &= ~(1<<(i%8)); n = H5T_bit_find (v1, 0, 8*sizeof(v1), H5T_BIT_LSB, FALSE); if ((ssize_t)i!=n) { - puts ("*FAILED*"); - printf (" Test for clear bit %d failed (lsb)!\n", i); + FAILED(); + printf (" Test for clear bit %d failed (lsb)!\n", i); goto failed; } n = H5T_bit_find (v1, 0, 8*sizeof(v1), H5T_BIT_MSB, FALSE); if ((ssize_t)i!=n) { - puts ("*FAILED*"); - printf (" Test for clear bit %d failed (lsb)!\n", i); + FAILED(); + printf (" Test for clear bit %d failed (lsb)!\n", i); goto failed; } } - puts (" PASSED"); + PASSED(); return 0; failed: - printf (" v = 0x"); + printf (" v = 0x"); for (i=0; i<(int)sizeof(v1); i++) printf ("%02x", v1[i]); printf ("\n"); return -1; @@ -159,8 +160,7 @@ test_copy (void) intn i, j; ssize_t n; - printf ("%-70s", "Testing bit copy operations"); - fflush (stdout); + TESTING("bit copy operations"); for (i=0; i<NTESTS; i++) { s_offset = rand() % (8*sizeof v1); @@ -174,13 +174,13 @@ test_copy (void) H5T_bit_copy (v2, d_offset, v1, s_offset, size); for (j=0; j<(intn)sizeof(v2); j++) if (v2[j]) break; if (size>0 && j>=(intn)sizeof(v2)) { - puts ("*FAILED*"); - puts (" Unabled to find copied region in destination"); + FAILED(); + puts (" Unabled to find copied region in destination"); goto failed; } if (0==size && j<(intn)sizeof(v2)) { - puts ("*FAILED*"); - puts (" Found copied bits when we shouldn't have"); + FAILED(); + puts (" Found copied bits when we shouldn't have"); goto failed; } @@ -188,26 +188,26 @@ test_copy (void) /* Look for the zeros and ones */ n = H5T_bit_find (v2, 0, 8*sizeof(v2), H5T_BIT_LSB, 1); if (size>0 && n!=(ssize_t)d_offset) { - puts ("*FAILED*"); - printf (" Unable to find first copied bit in destination " + FAILED(); + printf (" Unable to find first copied bit in destination " "(n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { - puts ("*FAILED*"); - puts (" Found copied bits and shouldn't have!"); + FAILED(); + puts (" Found copied bits and shouldn't have!"); goto failed; } n = H5T_bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 0); if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) { - puts ("*FAILED*"); - printf (" Unable to find last copied bit in destination " + FAILED(); + printf (" Unable to find last copied bit in destination " "(n=%d)\n", (int)n); goto failed; } if (d_offset+size==8*sizeof(v2) && n>=0) { - puts ("*FAILED*"); - puts (" High-order zeros are present and shouldn't be!"); + FAILED(); + puts (" High-order zeros are present and shouldn't be!"); goto failed; } @@ -217,41 +217,41 @@ test_copy (void) */ n = H5T_bit_find (v2, 0, 8*sizeof(v2), H5T_BIT_MSB, 1); if (size>0 && (size_t)(n+1)!=d_offset+size) { - puts ("*FAILED*"); - printf (" Unable to find last copied bit in destination " + FAILED(); + printf (" Unable to find last copied bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { - puts ("*FAILED*"); - puts (" Found copied bits but shouldn't have (reverse)!"); + FAILED(); + puts (" Found copied bits but shouldn't have (reverse)!"); goto failed; } n = H5T_bit_find (v2, 0, d_offset+size, H5T_BIT_MSB, 0); if (d_offset>0 && n+1!=(ssize_t)d_offset) { - puts ("*FAILED*"); - printf (" Unable to find beginning of copied data " + FAILED(); + printf (" Unable to find beginning of copied data " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==d_offset && n>=0) { - puts ("*FAILED*"); - puts (" Found leading original data but shouldn't have!"); + FAILED(); + puts (" Found leading original data but shouldn't have!"); goto failed; } } - puts (" PASSED"); + PASSED(); return 0; failed: - printf (" i=%d, s_offset=%lu, d_offset=%lu, size=%lu\n", + printf (" i=%d, s_offset=%lu, d_offset=%lu, size=%lu\n", i, (unsigned long)s_offset, (unsigned long)d_offset, (unsigned long)size); - printf (" s = 0x"); + printf (" s = 0x"); for (j=sizeof(v1)-1; j>=0; --j) printf ("%02x", v1[j]); - printf ("\n d = 0x"); + printf ("\n d = 0x"); for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]); printf ("\n"); return -1; @@ -282,8 +282,7 @@ test_set (void) intn i, j; ssize_t n; - printf ("%-70s", "Testing bit set operations"); - fflush (stdout); + TESTING("bit set operations"); for (i=0; i<NTESTS; i++) { d_offset = rand() % (8*sizeof v2); @@ -295,13 +294,13 @@ test_set (void) H5T_bit_set (v2, d_offset, size, TRUE); for (j=0; j<(intn)sizeof(v2); j++) if (v2[j]) break; if (size>0 && j>=(intn)sizeof(v2)) { - puts ("*FAILED*"); - puts (" Unabled to find set region in buffer"); + FAILED(); + puts (" Unabled to find set region in buffer"); goto failed; } if (0==size && j<(intn)sizeof(v2)) { - puts ("*FAILED*"); - puts (" Found set bits when we shouldn't have"); + FAILED(); + puts (" Found set bits when we shouldn't have"); goto failed; } @@ -309,26 +308,26 @@ test_set (void) /* Look for the zeros and ones */ n = H5T_bit_find (v2, 0, 8*sizeof(v2), H5T_BIT_LSB, 1); if (size>0 && n!=(ssize_t)d_offset) { - puts ("*FAILED*"); - printf (" Unable to find first set bit in destination " + FAILED(); + printf (" Unable to find first set bit in destination " "(n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { - puts ("*FAILED*"); - puts (" Found set bits and shouldn't have!"); + FAILED(); + puts (" Found set bits and shouldn't have!"); goto failed; } n = H5T_bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 0); if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) { - puts ("*FAILED*"); - printf (" Unable to find last set bit in destination " + FAILED(); + printf (" Unable to find last set bit in destination " "(n=%d)\n", (int)n); goto failed; } if (d_offset+size==8*sizeof(v2) && n>=0) { - puts ("*FAILED*"); - puts (" High-order zeros are present and shouldn't be!"); + FAILED(); + puts (" High-order zeros are present and shouldn't be!"); goto failed; } @@ -338,38 +337,38 @@ test_set (void) */ n = H5T_bit_find (v2, 0, 8*sizeof(v2), H5T_BIT_MSB, 1); if (size>0 && (size_t)(n+1)!=d_offset+size) { - puts ("*FAILED*"); - printf (" Unable to find last set bit in destination " + FAILED(); + printf (" Unable to find last set bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { - puts ("*FAILED*"); - puts (" Found set bits but shouldn't have (reverse)!"); + FAILED(); + puts (" Found set bits but shouldn't have (reverse)!"); goto failed; } n = H5T_bit_find (v2, 0, d_offset+size, H5T_BIT_MSB, 0); if (d_offset>0 && n+1!=(ssize_t)d_offset) { - puts ("*FAILED*"); - printf (" Unable to find beginning of set bit region " + FAILED(); + printf (" Unable to find beginning of set bit region " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==d_offset && n>=0) { - puts ("*FAILED*"); - puts (" Found leading zeros but shouldn't have!"); + FAILED(); + puts (" Found leading zeros but shouldn't have!"); goto failed; } } - puts (" PASSED"); + PASSED(); return 0; failed: - printf (" i=%d, d_offset=%lu, size=%lu\n", + printf (" i=%d, d_offset=%lu, size=%lu\n", i, (unsigned long)d_offset, (unsigned long)size); - printf (" d = 0x"); + printf (" d = 0x"); for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]); printf ("\n"); return -1; @@ -400,8 +399,7 @@ test_clear (void) intn i, j; ssize_t n; - printf ("%-70s", "Testing bit clear operations"); - fflush (stdout); + TESTING("bit clear operations"); for (i=0; i<NTESTS; i++) { d_offset = rand() % (8*sizeof v2); @@ -413,13 +411,13 @@ test_clear (void) H5T_bit_set (v2, d_offset, size, FALSE); for (j=0; j<(intn)sizeof(v2); j++) if (0xff!=v2[j]) break; if (size>0 && j>=(intn)sizeof(v2)) { - puts ("*FAILED*"); - puts (" Unabled to find cleared region in buffer"); + FAILED(); + puts (" Unabled to find cleared region in buffer"); goto failed; } if (0==size && j<(intn)sizeof(v2)) { - puts ("*FAILED*"); - puts (" Found cleared bits when we shouldn't have"); + FAILED(); + puts (" Found cleared bits when we shouldn't have"); goto failed; } @@ -427,26 +425,26 @@ test_clear (void) /* Look for the zeros and ones */ n = H5T_bit_find (v2, 0, 8*sizeof(v2), H5T_BIT_LSB, 0); if (size>0 && n!=(ssize_t)d_offset) { - puts ("*FAILED*"); - printf (" Unable to find first cleared bit in destination " + FAILED(); + printf (" Unable to find first cleared bit in destination " "(n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { - puts ("*FAILED*"); - puts (" Found cleared bits and shouldn't have!"); + FAILED(); + puts (" Found cleared bits and shouldn't have!"); goto failed; } n = H5T_bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 1); if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) { - puts ("*FAILED*"); - printf (" Unable to find last cleared bit in destination " + FAILED(); + printf (" Unable to find last cleared bit in destination " "(n=%d)\n", (int)n); goto failed; } if (d_offset+size==8*sizeof(v2) && n>=0) { - puts ("*FAILED*"); - puts (" High-order ones are present and shouldn't be!"); + FAILED(); + puts (" High-order ones are present and shouldn't be!"); goto failed; } @@ -456,38 +454,38 @@ test_clear (void) */ n = H5T_bit_find (v2, 0, 8*sizeof(v2), H5T_BIT_MSB, 0); if (size>0 && (size_t)(n+1)!=d_offset+size) { - puts ("*FAILED*"); - printf (" Unable to find last cleared bit in destination " + FAILED(); + printf (" Unable to find last cleared bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { - puts ("*FAILED*"); - puts (" Found cleared bits but shouldn't have (reverse)!"); + FAILED(); + puts (" Found cleared bits but shouldn't have (reverse)!"); goto failed; } n = H5T_bit_find (v2, 0, d_offset+size, H5T_BIT_MSB, 1); if (d_offset>0 && n+1!=(ssize_t)d_offset) { - puts ("*FAILED*"); - printf (" Unable to find beginning of cleared bit region " + FAILED(); + printf (" Unable to find beginning of cleared bit region " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==d_offset && n>=0) { - puts ("*FAILED*"); - puts (" Found leading ones but shouldn't have!"); + FAILED(); + puts (" Found leading ones but shouldn't have!"); goto failed; } } - puts (" PASSED"); + PASSED(); return 0; failed: - printf (" i=%d, d_offset=%lu, size=%lu\n", + printf (" i=%d, d_offset=%lu, size=%lu\n", i, (unsigned long)d_offset, (unsigned long)size); - printf (" d = 0x"); + printf (" d = 0x"); for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]); printf ("\n"); return -1; |