Ticket #370: passing-nan-tests.patch

File passing-nan-tests.patch, 1.0 KB (added by dukeleto, 13 years ago)

Passing NaN-rounding-related tests

  • t/op/arithmetics.t

     
    77use lib qw( . lib ../lib ../../lib ); 
    88 
    99use Test::More; 
    10 use Parrot::Test tests => 29; 
     10use Parrot::Test tests => 31; 
    1111 
    1212# test for GMP 
    1313use Parrot::Config; 
     
    359359-124 
    360360OUTPUT 
    361361 
     362 
     363pir_output_is( <<'CODE', <<OUTPUT, "rounding NaN gives NaN" ); 
     364.sub main 
     365       $N0 = 'NaN' 
     366       $N2 = floor $N0 
     367       say $N2 
     368       $N1 = 'NaN' 
     369       $N3 = ceil $N1 
     370       say $N3 
     371.end 
     372CODE 
     373NaN 
     374NaN 
     375OUTPUT 
     376 
     377pir_output_is( <<'CODE', <<OUTPUT, "rounding Inf gives Inf"); 
     378.sub main 
     379       $N0 = 'Inf' 
     380       $N1 = floor $N0 
     381       say $N1 
     382       $N2 = 'Inf' 
     383       $N3 = ceil $N2 
     384       say $N3 
     385 
     386       $N0 = '-Inf' 
     387       $N1 = floor $N0 
     388       say $N1 
     389       $N2 = '-Inf' 
     390       $N3 = ceil $N2 
     391       say $N3 
     392.end 
     393CODE 
     394Inf 
     395Inf 
     396-Inf 
     397-Inf 
     398OUTPUT 
    362399# 
    363400# FLOATVAL and INTVAL tests 
    364401#