19991017-21:24 GMT+1
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
19991017-21:24 GMT+1 Victor Szel <info@szelvesz.hu>
|
||||
* source/rtl/samples.c
|
||||
! hb_SecToTimeStr() bug (typo) fixed.
|
||||
* tests/rtl_test.prg
|
||||
+ Tests added for new Samples functions.
|
||||
|
||||
19991017-20:46 GMT+1 Victor Szel <info@szelvesz.hu>
|
||||
+ source/rtl/samples.c
|
||||
source/rtl/Makefile
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* AMPM() function
|
||||
* Compatibility functions from the SAMPLES directory of Clipper.
|
||||
*
|
||||
* Copyright 1999 Victor Szel <info@szelvesz.hu>
|
||||
* www - http://www.harbour-project.org
|
||||
@@ -46,7 +46,7 @@ static char * hb_SecToTimeStr( char * pszTime, ULONG ulTime )
|
||||
pszTime[ 0 ] = ( char ) ( uiValue / 10 ) + '0';
|
||||
pszTime[ 1 ] = ( char ) ( uiValue % 10 ) + '0';
|
||||
pszTime[ 2 ] = ':';
|
||||
uiValue = ( ulTime / 60 ) % 64;
|
||||
uiValue = ( ulTime / 60 ) % 60;
|
||||
pszTime[ 3 ] = ( char ) ( uiValue / 10 ) + '0';
|
||||
pszTime[ 4 ] = ( char ) ( uiValue % 10 ) + '0';
|
||||
pszTime[ 5 ] = ':';
|
||||
@@ -54,7 +54,7 @@ static char * hb_SecToTimeStr( char * pszTime, ULONG ulTime )
|
||||
pszTime[ 6 ] = ( char ) ( uiValue / 10 ) + '0';
|
||||
pszTime[ 7 ] = ( char ) ( uiValue % 10 ) + '0';
|
||||
pszTime[ 8 ] = '\0';
|
||||
|
||||
|
||||
return pszTime;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ static ULONG hb_TimeStrToSec( char * pszTime )
|
||||
|
||||
if( ulLen >= 7 )
|
||||
ulTime += ( ULONG ) hb_strVal( pszTime + 6 );
|
||||
|
||||
|
||||
return ulTime;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ HARBOUR HB_ELAPTIME( void )
|
||||
ULONG ulStart = hb_TimeStrToSec( hb_parc( 1 ) );
|
||||
ULONG ulEnd = hb_TimeStrToSec( hb_parc( 2 ) );
|
||||
char szTime[ 9 ];
|
||||
|
||||
|
||||
hb_retc( hb_SecToTimeStr( szTime, ( ulEnd < ulStart ? 86400 : 0 ) + ulEnd - ulStart ) );
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ HARBOUR HB_LENNUM( void )
|
||||
hb_xfree( pszString );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
hb_retnl( ulLen );
|
||||
}
|
||||
|
||||
@@ -162,6 +162,6 @@ HARBOUR HB_SECS( void )
|
||||
HARBOUR HB_TSTRING( void )
|
||||
{
|
||||
char szTime[ 9 ];
|
||||
|
||||
|
||||
hb_retc( hb_SecToTimeStr( szTime, hb_parnl( 1 ) ) );
|
||||
}
|
||||
|
||||
@@ -1679,7 +1679,7 @@ STATIC FUNCTION Long_STRINGS()
|
||||
|
||||
STATIC FUNCTION Main_MISC()
|
||||
|
||||
/* AMPM() */
|
||||
/* "Samples" function tests (AMPM(), DAYS(), ELAPTIME(), ... ) */
|
||||
|
||||
TEST_LINE( AMPM( "" ) , "12 am" )
|
||||
TEST_LINE( AMPM( "HELLO" ) , "12LLO am" )
|
||||
@@ -1695,6 +1695,20 @@ STATIC FUNCTION Main_MISC()
|
||||
TEST_LINE( AMPM( "02:23" ) , "02:23 am" )
|
||||
TEST_LINE( AMPM( "02:23:45.10" ) , "02:23:45.10 am" )
|
||||
|
||||
TEST_LINE( DAYS( 100000 ) , 1 )
|
||||
|
||||
TEST_LINE( ELAPTIME("24:12:34","12:34:57") , "12:22:23" )
|
||||
TEST_LINE( ELAPTIME("12:34:57","24:12:34") , "11:37:37" )
|
||||
|
||||
TEST_LINE( LENNUM( 10 ) , 2 )
|
||||
TEST_LINE( LENNUM( 10.9 ) , 4 )
|
||||
TEST_LINE( LENNUM( 10.90 ) , 5 )
|
||||
|
||||
TEST_LINE( SECS("24:12:34") , 87154 )
|
||||
TEST_LINE( SECS("12:34:57") , 45297 )
|
||||
|
||||
TEST_LINE( TSTRING(1000) , "00:16:40" )
|
||||
|
||||
/* FOR/NEXT */
|
||||
|
||||
TEST_LINE( TFORNEXT( .F., .T., NIL ) , "E BASE 1086 Argument error ++ F:S" )
|
||||
@@ -2379,7 +2393,7 @@ STATIC FUNCTION Main_MISC()
|
||||
#ifdef __HARBOUR__
|
||||
|
||||
STATIC FUNCTION Main_OPOVERL()
|
||||
LOCAL oString := TString()
|
||||
LOCAL oString := HB_TString()
|
||||
|
||||
oString:cValue := "Hello"
|
||||
|
||||
@@ -2395,19 +2409,19 @@ STATIC FUNCTION Main_OPOVERL()
|
||||
TEST_LINE( oString <= "Hello" , .T. )
|
||||
TEST_LINE( oString + "Hello" , "HelloHello" )
|
||||
TEST_LINE( oString - "Hello" , "HelloHello" )
|
||||
TEST_LINE( oString++ , "TSTRING Object" )
|
||||
TEST_LINE( oString++ , "HB_TSTRING Object" )
|
||||
TEST_LINE( oString:cValue , "Hello " )
|
||||
TEST_LINE( oString-- , "TSTRING Object" )
|
||||
TEST_LINE( oString-- , "HB_TSTRING Object" )
|
||||
TEST_LINE( oString:cValue , "Hello" )
|
||||
|
||||
RETURN NIL
|
||||
|
||||
STATIC FUNCTION TString()
|
||||
STATIC FUNCTION HB_TString()
|
||||
|
||||
STATIC oClass
|
||||
|
||||
IF oClass == NIL
|
||||
oClass = TClass():New( "TSTRING" )
|
||||
oClass = TClass():New( "HB_TSTRING" )
|
||||
|
||||
oClass:AddData( "cValue" )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user