Files
harbour-core/harbour/tests/bldtest/bldtest.c
Viktor Szakats 29a46a1302 2012-11-17 23:11 UTC+0100 Viktor Szakats (harbour syenar.net)
* contrib/gtwvg/tests/_wvtcls.prg
  * contrib/gtwvg/tests/demowvg.prg
  * contrib/hbct/doc/en/dattime3.txt
  * contrib/hbct/tests/datetime.prg
  * contrib/hbnf/doc/en/acctadj.txt
  * contrib/hbnf/doc/en/acctmnth.txt
  * contrib/hbnf/doc/en/acctqtr.txt
  * contrib/hbnf/doc/en/acctweek.txt
  * contrib/hbnf/doc/en/acctyear.txt
  * contrib/hbnf/doc/en/dayofyr.txt
  * contrib/hbnf/doc/en/daytobow.txt
  * contrib/hbnf/doc/en/elapsed.txt
  * contrib/hbnf/doc/en/firstday.txt
  * contrib/hbnf/doc/en/lastday.txt
  * contrib/hbnf/doc/en/madd.txt
  * contrib/hbnf/doc/en/month.txt
  * contrib/hbnf/doc/en/qtr.txt
  * contrib/hbnf/doc/en/savearr.txt
  * contrib/hbnf/doc/en/setdate.txt
  * contrib/hbnf/doc/en/wda.txt
  * contrib/hbnf/doc/en/week.txt
  * contrib/hbnf/doc/en/workdays.txt
  * contrib/hbnf/doc/en/woy.txt
  * contrib/hbnf/doc/en/year.txt
  * contrib/hbnf/tests/elapsed.prg
  * contrib/hbnf/tests/savearr.prg
  * contrib/hbnf/tests/setdate.prg
  * contrib/hbnf/tests/wda.prg
  * contrib/hbnf/tests/workdays.prg
  * contrib/hbnf/tests/woy.prg
  * contrib/hbpgsql/tests/dbf2pg.prg
  * contrib/hbsqlit3/hdbcsqlt.prg
  * contrib/rddsql/tests/arrayrdd.prg
  * doc/en/datetime.txt
  * doc/en/math.txt
  * doc/en/string.txt
  * doc/hdr_tpl.txt
  * extras/gtwvw/tests/ebtest7.prg
  * extras/gtwvw/tests/wvwtest9.prg
  * extras/guestbk/inifiles.prg
  * extras/hbvpdf/core.prg
  * extras/httpsrv/cgifunc.prg
  * tests/array16.prg
  * tests/bldtest/bldtest.c
  * tests/byref.prg
  * tests/dates.prg
  * tests/gfx.prg
  * tests/inifiles.prg
  * tests/initexit.prg
  * tests/longdev.prg
  * tests/parseini.ini
  * tests/parseini.prg
  * tests/usrrdd/exarr.prg
  * website/samples/byref.prg.html
  * website/samples/initexit.prg.html
  * website/samples/longdev.prg.html
  * website/samples/mousetst.prg.html
  * website/samples/parseini.ini.html
  * website/samples/parseini.prg.html
    * various cleanups
2012-11-17 22:20:13 +00:00

101 lines
3.4 KiB
C

/*
* $Id$
*/
#include "hbdefs.h"
int main( void )
{
char buf[ 16 ];
int n, i, l, f, iRet = 0;
printf( "\nStandard C types:\n" );
printf( "\t sizeof(void*)=%d\n", ( int ) sizeof( void * ) );
printf( "\t sizeof(char)=%d\n", ( int ) sizeof( char ) );
printf( "\t sizeof(short int)=%d\n", ( int ) sizeof( short int ) );
printf( "\t sizeof(int)=%d\n", ( int ) sizeof( int ) );
printf( "\t sizeof(long int)=%d\n", ( int ) sizeof( long int ) );
#if defined( HB_OS_WIN ) && ! defined( __GNUC__ )
printf( "\t sizeof(__int64)=%d\n", ( int ) sizeof( __int64 ) );
#else
printf( "\tsizeof(long long int)=%d\n", ( int ) sizeof( long long int ) );
#endif
printf( "\t sizeof(float)=%d\n", ( int ) sizeof( float ) );
printf( "\t sizeof(double)=%d\n", ( int ) sizeof( double ) );
printf( "\t sizeof(long double)=%d\n", ( int ) sizeof( long double ) );
printf( "\nHarbour types:\n" );
printf( "\t sizeof(HB_BYTE)=%d %s\n", ( int ) sizeof( HB_BYTE ), sizeof( HB_BYTE ) == 1 ? "OK" : "BAD" );
printf( "\t sizeof(HB_SHORT)=%d %s\n", ( int ) sizeof( HB_SHORT ), sizeof( HB_SHORT ) == 2 ? "OK" : "BAD" );
printf( "\t sizeof(HB_UINT)=%d %s\n", ( int ) sizeof( HB_UINT ), sizeof( HB_UINT ) == 4 || sizeof( HB_UINT ) == 8 ? "OK" : "BAD" );
printf( "\t sizeof(HB_LONG)=%d %s\n", ( int ) sizeof( HB_LONG ), sizeof( HB_LONG ) == 4 || sizeof( HB_LONG ) == 8 ? "OK" : "BAD" );
printf( "\tsizeof(HB_LONGLONG)=%d %s\n", ( int ) sizeof( HB_LONGLONG ), sizeof( HB_LONGLONG ) == 8 ? "OK" : "BAD" );
printf( "\t sizeof(double)=%d %s\n", ( int ) sizeof( double ), sizeof( double ) == 8 ? "OK" : "BAD" );
if( sizeof( HB_BYTE ) != 1 ||
sizeof( HB_SHORT ) != 2 ||
( sizeof( HB_LONG ) != 4 && sizeof( HB_LONG ) != 8 ) ||
sizeof( HB_LONGLONG ) != 8 ||
sizeof( double ) != 8 )
iRet = 1;
n = 0x31323334;
memcpy( buf, &n, sizeof( n ) );
buf[ sizeof( n ) ] = '\0';
i = atoi( buf );
#if defined( HB_PDP_ENDIAN )
l = 2143;
#elif defined( HB_BIG_ENDIAN )
l = 1234;
#else
l = 4321;
#endif
printf( "\nn=0x%x -> \"%s\" (%s endian) %s\n", n, buf,
i == 1234 ? "big" :
i == 2143 ? "pdp" :
i == 4321 ? "little" : "unknown",
i == l ? "OK" : "BAD" );
if( i != l )
iRet = 1;
buf[ 0 ] = 0x12;
buf[ 1 ] = 0x34;
buf[ 2 ] = 0x56;
buf[ 3 ] = 0x78;
buf[ 4 ] = 0x65;
i = ( HB_GET_BE_UINT32( buf ) == 0x12345678L &&
HB_GET_LE_UINT32( buf ) == 0x78563412L );
if( ! i )
iRet = 1;
printf( "byte order translation: %s\n", i ? "OK" : "BAD" );
for( l = 0; l < 4; l++ )
{
n = HB_GET_BE_UINT16( &buf[ l ] );
f = n == ( buf[ l ] * 256 + buf[ l + 1 ] ) ? 1 : 0;
if( ! f )
iRet = 1;
printf( "HB_GET_BE_UINT16(%x,%x) = %x -> %s\n", buf[ l ], buf[ l + 1 ], n,
f ? "OK" : "BAD" );
n = HB_GET_LE_UINT16( &buf[ l ] );
f = n == ( buf[ l ] + 256 * buf[ l + 1 ] ) ? 1 : 0;
if( ! f )
iRet = 1;
printf( "HB_GET_LE_UINT16(%x,%x) = %x -> %s\n", buf[ l ], buf[ l + 1 ], n,
f ? "OK" : "BAD" );
}
n = ( char ) 255;
printf( "n=%d -> (char) type is %ssigned\n", n, n < 0 ? "" : "un" );
if( iRet )
printf( "\nHarbour cannot be compiled !!!\n" );
else
printf( "\nBasic test is correct, try to compile Harbour.\n" );
return iRet;
}