test/testtypes.c
changeset 0 74212992fb08
child 47 45b1c4303f87
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/testtypes.c	Thu Apr 26 16:45:43 2001 +0000
     1.3 @@ -0,0 +1,48 @@
     1.4 +
     1.5 +#include <stdio.h>
     1.6 +
     1.7 +#include "SDL_types.h"
     1.8 +
     1.9 +int main(int argc, char *argv[])
    1.10 +{
    1.11 +	int error = 0;
    1.12 +	int verbose = 1;
    1.13 +
    1.14 +	if ( argv[1] && (strcmp(argv[1], "-q") == 0) )
    1.15 +		verbose = 0;
    1.16 +
    1.17 +	if ( sizeof(Uint8) != 1 ) {
    1.18 +		if ( verbose )
    1.19 +			printf("sizeof(Uint8) != 1, instead = %d\n",
    1.20 +								sizeof(Uint8));
    1.21 +		++error;
    1.22 +	}
    1.23 +	if ( sizeof(Uint16) != 2 ) {
    1.24 +		if ( verbose )
    1.25 +			printf("sizeof(Uint16) != 2, instead = %d\n",
    1.26 +								sizeof(Uint16));
    1.27 +		++error;
    1.28 +	}
    1.29 +	if ( sizeof(Uint32) != 4 ) {
    1.30 +		if ( verbose )
    1.31 +			printf("sizeof(Uint32) != 4, instead = %d\n",
    1.32 +								sizeof(Uint32));
    1.33 +		++error;
    1.34 +	}
    1.35 +#ifdef SDL_HAS_64BIT_TYPE
    1.36 +	if ( sizeof(Uint64) != 8 ) {
    1.37 +		if ( verbose )
    1.38 +			printf("sizeof(Uint64) != 8, instead = %d\n",
    1.39 +								sizeof(Uint64));
    1.40 +		++error;
    1.41 +	}
    1.42 +#else
    1.43 +	if ( verbose ) {
    1.44 +		printf("WARNING: No 64-bit datatype on this platform\n");
    1.45 +	}
    1.46 +#endif
    1.47 +	if ( verbose && ! error )
    1.48 +		printf("All data types are the expected size.\n");
    1.49 +
    1.50 +	return( error ? 1 : 0 );
    1.51 +}