20000403-01:26 GMT+1 Victor Szakats <info@szelvesz.hu>

This commit is contained in:
Viktor Szakats
2000-04-02 23:26:02 +00:00
parent bde6da7fa3
commit 6ac91e4f1a
5 changed files with 35 additions and 10 deletions

View File

@@ -1,3 +1,19 @@
20000403-01:26 GMT+1 Victor Szakats <info@szelvesz.hu>
* source/vm/itemapi.c
! hb_itemStr() 9 character limit on decimals removed.
Now seven more tests pass.
* source/vm/hvm.c
! hb_vmPushDouble() 9 character limit on decimals removed.
Now newly added tests pass.
* utils/hbtest/rt_str.prg
+ New STR() tests added.
* utils/hbtest/hbtest.prg
+ Shows the percentage of the passes compared to the number of tests.
20000402-23:44 GMT+2 Maurilio Longo <maurilio.longo@libero.it>
* source/rtl/gtos2/gtos2.c

View File

@@ -1189,7 +1189,7 @@ static void hb_vmNegate( void )
else if( HB_IS_DOUBLE( pItem ) )
{
pItem->item.asDouble.value = -pItem->item.asDouble.value;
pItem->item.asDouble.length = pItem->item.asDouble.value >= 10000000000.0 ? 20 : 10;
pItem->item.asDouble.length = ( pItem->item.asDouble.value >= 10000000000.0 || pItem->item.asDouble.value <= -10000000000.0 ) ? 20 : 10;
}
else
{
@@ -2820,11 +2820,11 @@ void hb_vmPushDouble( double dNumber, int iDec )
hb_stack.pPos->type = HB_IT_DOUBLE;
hb_stack.pPos->item.asDouble.value = dNumber;
hb_stack.pPos->item.asDouble.length = ( dNumber > 10000000000.0 ) ? 20 : 10;
hb_stack.pPos->item.asDouble.length = ( dNumber > 10000000000.0 || dNumber <= -10000000000.0 ) ? 20 : 10;
if( iDec == HB_DEFAULT_DECIMALS )
hb_stack.pPos->item.asDouble.decimal = hb_set.HB_SET_DECIMALS;
else
hb_stack.pPos->item.asDouble.decimal = ( iDec > 9 ) ? 9 : iDec;
hb_stack.pPos->item.asDouble.decimal = iDec;
hb_stackPush();
}

View File

@@ -1155,8 +1155,7 @@ char * hb_itemStr( PHB_ITEM pNumber, PHB_ITEM pWidth, PHB_ITEM pDec )
if( pNumber )
{
/* Default to the width and number of decimals specified by the item,
with a limit of 20 integer places and 9 decimal places, plus one
space for the sign. */
with a limit of 20 integer places, plus one space for the sign. */
int iWidth;
int iDec;
@@ -1164,8 +1163,7 @@ char * hb_itemStr( PHB_ITEM pNumber, PHB_ITEM pWidth, PHB_ITEM pDec )
if( iWidth > 20 )
iWidth = 20;
if( iDec > 9 )
iDec = 9;
if( hb_set.HB_SET_FIXED )
iDec = hb_set.HB_SET_DECIMALS;
@@ -1176,7 +1174,7 @@ char * hb_itemStr( PHB_ITEM pNumber, PHB_ITEM pWidth, PHB_ITEM pDec )
int iWidthPar = hb_itemGetNI( pWidth );
if( iWidthPar < 1 )
iWidth = 10; /* If 0 or negative, use default */
iWidth = 10; /* If 0 or negative, use default */
else
iWidth = iWidthPar;

View File

@@ -355,7 +355,7 @@ STATIC FUNCTION TEST_END()
s_nEndTime := Seconds()
FWrite( s_nFhnd, "===========================================================================" + HB_OSNewLine() +;
"Test calls passed: " + Str( s_nPass ) + HB_OSNewLine() +;
"Test calls passed: " + Str( s_nPass ) + " ( " + LTrim( Str( ( 1 - ( s_nFail / s_nPass ) ) * 100, 6, 2 ) ) + " % )" + HB_OSNewLine() +;
"Test calls failed: " + Str( s_nFail ) + " ( " + LTrim( Str( ( s_nFail / s_nPass ) * 100, 6, 2 ) ) + " % )" + HB_OSNewLine() +;
" ----------" + HB_OSNewLine() +;
" Total: " + Str( s_nPass + s_nFail ) +;

View File

@@ -689,9 +689,20 @@ FUNCTION Main_STR()
TEST_LINE( Str( w_TEST->TYPE_N_D ) , " 101.127" )
TEST_LINE( Str( w_TEST->TYPE_N_DE ) , " 0.000" )
TEST_LINE( Str(5000000000.0) , "5000000000.0" )
TEST_LINE( Str(50000000) , " 50000000" )
TEST_LINE( Str(500000000) , " 500000000" )
TEST_LINE( Str(5000000000) , " 5000000000" )
TEST_LINE( Str(50000000000) , " 50000000000" )
TEST_LINE( Str(-5000000000.0) , " -5000000000.0" )
TEST_LINE( Str(-5000000000) , " -5000000000" )
TEST_LINE( Str(-5000000000) , " -5000000000" )
TEST_LINE( Str(2.0000000000000001) , " 2.0000000000000000" )
TEST_LINE( Str(2.0000000000000009) , " 2.0000000000000010" )
TEST_LINE( Str(2.000000000000001) , " 2.000000000000001" )
TEST_LINE( Str(2.000000000000009) , " 2.000000000000009" )
TEST_LINE( Str(2.00000000000001) , " 2.00000000000001" )
TEST_LINE( Str(2.00000000000009) , " 2.00000000000009" )
TEST_LINE( Str(2.000000000001) , " 2.000000000001" )
TEST_LINE( Str(2.00000000001) , " 2.00000000001" )
TEST_LINE( Str(10) , " 10" )
TEST_LINE( Str(10.0) , " 10.0" )
TEST_LINE( Str(10.00) , " 10.00" )