Skip to content
Browse files

[GH #828] Fix most tests for non-double floatval

Add more needed precisions to numeric tests, tested with intel long double.

Change a magic number in t/library/test_more.t 888.81<=>888.82 1e-2
  was not stable enough for intel long double

Fix src/dynoplibs/sys.ops doublesize to numvalsize. This only works for double.
  • Loading branch information...
1 parent fdc00fa commit db2f6277643f76e9aec452971958f0ab53c9247c @rurban rurban committed
Showing with 12 additions and 12 deletions.
  1. +1 −1 runtime/parrot/library/Test/More.pir
  2. +2 −2 src/dynoplibs/sys.ops
  3. +2 −2 t/dynoplibs/sysinfo.t
  4. +2 −2 t/dynpmc/rational.t
  5. +4 −4 t/library/test_more.t
  6. +1 −1 t/pmc/integer.t
View
2 runtime/parrot/library/Test/More.pir
@@ -30,7 +30,7 @@ Test::More - Parrot extension for testing modules
is( 200, 100, 'failing integer compare with diagnostic' )
is( 1.001, 1.001, 'passing float compare with diagnostic' )
- is( 8.008, 4.004 )
+ is( 8.008, 4.004, 'compare float up to 6 digits precision', 1e-6 )
is( 'foo', 'foo', 'passing string compare with diagnostic' )
is( 'foo', 'bar', 'failing string compare with diagnostic' )
View
4 src/dynoplibs/sys.ops
@@ -132,9 +132,9 @@ ask. They are:
=over 4
-=item C<PARROT_INTSIZE> The size of a platform integer
+=item C<PARROT_INTSIZE> The size of the platform integer
-=item C<PARROT_FLOATSIZE> The size of a platform float
+=item C<PARROT_FLOATSIZE> The size of the platform floatval
=item C<PARROT_POINTERSIZE> The size of a platform pointer (Largest possible data pointer)
View
4 t/dynoplibs/sysinfo.t
@@ -68,10 +68,10 @@ my @setup = (
desc => 'integer size',
reg_type => 'I',
},
- { pconfig_key => 'doublesize',
+ { pconfig_key => 'numvalsize',
pasm_key => 17,
pir_key => 'SYSINFO_PARROT_FLOATSIZE',
- desc => 'float size',
+ desc => 'floatval size',
reg_type => 'I',
},
{ pconfig_key => 'ptrsize',
View
4 t/dynpmc/rational.t
@@ -1,5 +1,5 @@
#!./parrot
-# Copyright (C) 2008-2010, Parrot Foundation.
+# Copyright (C) 2008-2012, Parrot Foundation.
=head1 NAME
@@ -643,7 +643,7 @@ CODE
$N0 = 11.1
$P0 = $N0
$N1 = $P0
- is($N1,11.1,'set and get a native float')
+ is($N1,11.1,'set and get a native float',1e-6)
.end
.sub test_set_get_native_string
View
8 t/library/test_more.t
@@ -300,10 +300,10 @@ CODE
test_fail( 'comparing Float PMC and a float with precision, failure' )
$P0 = new 'Float'
- $P0 = 888.81
- is( $P0, 888.82, 'comparing Float PMC and a float with precision, failure', 1e-2)
- test_diag( 'Have: 888.81' )
- test_diag( 'Want: 888.82' )
+ $P0 = 888.82
+ is( $P0, 888.83, 'comparing Float PMC and a float with precision, failure', 1e-2)
+ test_diag( 'Have: 888.82' )
+ test_diag( 'Want: 888.83' )
test_test( 'failing test is() for comparing a Float PMC and float with precision')
test_pass( 'comparing Float PMC and a float with precision, success' )
View
2 t/pmc/integer.t
@@ -552,7 +552,7 @@ fin:
$P1 = new ['Integer']
$P1 = 10
sub $P1, $P1, $P0
- is($P1, 6.9, 'DEFAULT sub')
+ is($P1, 6.9, 'DEFAULT sub', 1e-5)
$P0 = new ['Integer']
$P0 = 5

0 comments on commit db2f627

Please sign in to comment.
Something went wrong with that request. Please try again.