[svn-r428] Changes since 19980612

----------------------

./src/H5Tbit.c
./MANIFEST
./test/Makefile.in
./test/bittests.c	NEW
	Finished the bit vector operations and added test cases.

./src/H5Tconv.c
./test/dtypes.c
	Finished integer->integer general conversion and added test
	cases. Overflows and underflows are handled by substituting
	the closest possible value.  Examples:

	   (unsigned)0xffff -> (unsigned)  0xff
	   (  signed)0xffff -> (unsigned)0x0000
	   (unsigned)0xffff -> (  signed)0x7fff
	   (  signed)0x7fff -> (  signed)  0x7f
	   (  signed)0xbfff -> (  signed)  0xbf
	   (  signed)0x8000 -> (  signed)  0x80

./src/H5private.h
	Added definitions for MIN and MAX that take 3 or 4 arguments:
	MIN3(), MIN4(), MAX3(), MAX4(). Also added MIN2() and MAX2()
	as aliases for MIN() and MAX().

./test/tattr.c
	Removed some redundant `&' operators.

./configure.in
./src/H5config.h.in	[regenerated]
./src/H5.c
	Fixed warnings on DEC where long double is the same as
	double.
This commit is contained in:
Robb Matzke
1998-06-16 14:38:26 -05:00
parent a639a5998c
commit 53916f4e59
13 changed files with 937 additions and 97 deletions

View File

@@ -517,14 +517,100 @@ test_named (void)
static herr_t
test_conv_num (void)
{
const size_t ntests=1;
const size_t nelmts=1;
const size_t ntests=100;
const size_t nelmts=2000;
size_t i, j;
void *buf=NULL, *saved=NULL;
unsigned char byte[4];
printf ("%-70s", "Testing atomic number conversions");
/*---------------------------------------------------------------------
* Test some specific overflow/underflow cases.
*---------------------------------------------------------------------
*/
printf ("%-70s", "Testing atomic number overflow conversions");
fflush (stdout);
/* (unsigned)0x80000000 -> (unsigned)0xffff */
byte[0] = byte[1] = byte[2] = 0;
byte[3] = 0x80;
if (H5Tconvert (H5T_NATIVE_UINT32, H5T_NATIVE_UINT16, 1, byte, NULL)<0) {
goto error;
}
if (byte[0]!=0xff || byte[1]!=0xff) {
puts ("*FAILED*");
puts (" (unsigned)0x80000000 -> (unsigned)0xffff");
goto error;
}
/* (unsigned)0xffffffff -> (signed)0x7fff */
byte[0] = byte[1] = byte[2] = byte[3] = 0xff;
if (H5Tconvert (H5T_NATIVE_UINT32, H5T_NATIVE_INT16, 1, byte, NULL)<0) {
goto error;
}
if (byte[0]!=0xff || byte[1]!=0x7f) {
puts ("*FAILED*");
puts (" (unsigned)0xffffffff -> (signed)0x7f");
goto error;
}
/* (signed)0xffffffff -> (unsigned)0x0000 */
byte[0] = byte[1] = byte[2] = byte[3] = 0xff;
if (H5Tconvert (H5T_NATIVE_INT32, H5T_NATIVE_UINT16, 1, byte, NULL)<0) {
goto error;
}
if (byte[0]!=0x00 || byte[1]!=0x00) {
puts ("*FAILED*");
puts (" (signed)0xffffffff -> (unsigned)0x00");
goto error;
}
/* (signed)0x7fffffff -> (unsigned)0xffff */
byte[0] = byte[1] = byte[2] = 0xff;
byte[3] = 0x7f;
if (H5Tconvert (H5T_NATIVE_INT32, H5T_NATIVE_UINT16, 1, byte, NULL)<0) {
goto error;
}
if (byte[0]!=0xff || byte[1]!=0xff) {
puts ("*FAILED*");
puts (" (signed)0x7fffffff -> (unsigned)0xffff");
goto error;
}
/* (signed)0x7fffffff -> (signed)0x7fff */
byte[0] = byte[1] = byte[2] = 0xff;
byte[3] = 0x7f;
if (H5Tconvert (H5T_NATIVE_INT32, H5T_NATIVE_INT16, 1, byte, NULL)<0) {
goto error;
}
if (byte[0]!=0xff || byte[1]!=0x7f) {
puts ("*FAILED*");
puts (" (signed)0x7fffffff -> (signed)0x7fff");
goto error;
}
/* (signed)0xbfffffff -> (signed)0x8000 */
byte[0] = byte[1] = byte[2] = 0xff;
byte[3] = 0xbf;
if (H5Tconvert (H5T_NATIVE_INT32, H5T_NATIVE_INT16, 1, byte, NULL)<0) {
goto error;
}
if (byte[0]!=0x00 || byte[1]!=0x80) {
puts ("*FAILED*");
puts (" (signed)0xbfffffff -> (signed)0x8000");
goto error;
}
puts (" PASSED");
/*-----------------------------------------------------------------------
* Test random cases.
*-----------------------------------------------------------------------
*/
printf ("%-70s", "Testing atomic number random conversions");
fflush (stdout);
/* Allocate buffers */
buf = malloc (nelmts*8);
saved = malloc (nelmts*8);
@@ -597,9 +683,7 @@ 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",