From 2f75be79b149c2304369cf4a22f2730d7d7e546c Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 17 Nov 2009 16:30:09 +0000 Subject: [PATCH] 2009-11-17 17:29 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/utils/hbtest/rt_str.prg * modified code which tries to replicate Clipper behavior with ULONG values also in 64bit systems where ULONG is not 32bit integer --- harbour/ChangeLog | 5 ++++ harbour/utils/hbtest/rt_str.prg | 50 ++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d0c2870ab0..3bdc7a8933 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,11 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-11-17 17:29 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/utils/hbtest/rt_str.prg + * modified code which tries to replicate Clipper behavior with ULONG + values also in 64bit systems where ULONG is not 32bit integer + 2009-11-17 15:40 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) * harbour/contrib/rddsql/sddodbc/tests/test2.prg diff --git a/harbour/utils/hbtest/rt_str.prg b/harbour/utils/hbtest/rt_str.prg index f6e0163770..9cbb920282 100644 --- a/harbour/utils/hbtest/rt_str.prg +++ b/harbour/utils/hbtest/rt_str.prg @@ -60,6 +60,13 @@ #endif PROCEDURE Main_STR() + LOCAL l64 + +#ifdef __HARBOUR__ + l64 := hb_version( HB_VERSION_BITWIDTH ) >= 64 +#else + l64 := .F. +#endif /* VAL() */ @@ -67,19 +74,36 @@ PROCEDURE Main_STR() TEST_LINE( Val( 10 ) , "E 1 BASE 1098 Argument error (VAL) OS:0 #:0 A:1:N:10 F:S" ) #ifndef RT_NO_C - TEST_LINE( Str(R_PASSENL( 1860637360 )) , " 1860637360" ) - TEST_LINE( Str(R_PASSENL( 100 )) , " 100" ) - TEST_LINE( Str(R_PASSENL( 999999999 )) , " 999999999" ) - TEST_LINE( Str(R_PASSENL( 1000000000 )) , " 1000000000" ) - TEST_LINE( Str(R_PASSENL( 2147483647 )) , " 2147483647" ) - TEST_LINE( Str(R_PASSENL( 2147483648 )) , " -2147483648" ) - TEST_LINE( Str(R_PASSENL( -1 )) , " -1" ) - TEST_LINE( Str(R_PASSENL( -999999999 )) , "-999999999" ) - TEST_LINE( Str(R_PASSENL( -1000000000 )) , " -1000000000" ) - TEST_LINE( Str(R_PASSENL( -99999999 )) , " -99999999" ) - TEST_LINE( Str(R_PASSENL( -100000000 )) , "-100000000" ) - TEST_LINE( Str(R_PASSENLC()) , " 1000000000" ) + IF l64 + TEST_LINE( Str(R_PASSENL( 1860637360 )) , "1860637360" ) + TEST_LINE( Str(R_PASSENL( 100 )) , " 100" ) + TEST_LINE( Str(R_PASSENL( 999999999 )) , " 999999999" ) + TEST_LINE( Str(R_PASSENL( 1000000000 )) , "1000000000" ) + TEST_LINE( Str(R_PASSENL( 2147483647 )) , "2147483647" ) + TEST_LINE( Str(R_PASSENL( 2147483648 )) , "2147483648" ) + TEST_LINE( Str(R_PASSENL( -1 )) , " -1" ) + TEST_LINE( Str(R_PASSENL( -999999999 )) , "-999999999" ) + TEST_LINE( Str(R_PASSENL( -1000000000 )) , " -1000000000" ) + TEST_LINE( Str(R_PASSENL( -99999999 )) , " -99999999" ) + TEST_LINE( Str(R_PASSENL( -100000000 )) , "-100000000" ) + + TEST_LINE( Str(R_PASSENLC()) , "1000000000" ) + ELSE + TEST_LINE( Str(R_PASSENL( 1860637360 )) , " 1860637360" ) + TEST_LINE( Str(R_PASSENL( 100 )) , " 100" ) + TEST_LINE( Str(R_PASSENL( 999999999 )) , " 999999999" ) + TEST_LINE( Str(R_PASSENL( 1000000000 )) , " 1000000000" ) + TEST_LINE( Str(R_PASSENL( 2147483647 )) , " 2147483647" ) + TEST_LINE( Str(R_PASSENL( 2147483648 )) , " -2147483648" ) + TEST_LINE( Str(R_PASSENL( -1 )) , " -1" ) + TEST_LINE( Str(R_PASSENL( -999999999 )) , "-999999999" ) + TEST_LINE( Str(R_PASSENL( -1000000000 )) , " -1000000000" ) + TEST_LINE( Str(R_PASSENL( -99999999 )) , " -99999999" ) + TEST_LINE( Str(R_PASSENL( -100000000 )) , "-100000000" ) + + TEST_LINE( Str(R_PASSENLC()) , " 1000000000" ) + ENDIF #endif TEST_LINE( Str(Val("")) , " 0" ) @@ -534,7 +558,7 @@ PROCEDURE Main_STR() /* REPLICATE() */ #ifdef __HARBOUR__ - IF hb_version( HB_VERSION_BITWIDTH ) >= 64 + IF l64 TEST_LINE( Replicate("XXX", 9000000000000000000) , "E 3 BASE 1234 String overflow (REPLICATE) OS:0 #:0 A:2:C:XXX;N:9000000000000000000 F:S" ) ELSE TEST_LINE( Replicate("XXX", 2000000000) , "E 3 BASE 1234 String overflow (REPLICATE) OS:0 #:0 A:2:C:XXX;N:2000000000 F:S" )