[svn:parrot] r40588 - trunk/t/op
dukeleto at svn.parrot.org
dukeleto at svn.parrot.org
Sun Aug 16 09:00:19 UTC 2009
Author: dukeleto
Date: Sun Aug 16 09:00:17 2009
New Revision: 40588
URL: https://trac.parrot.org/parrot/changeset/40588
Log:
[t] Add various tests for NaN/Inf handling
Modified:
trunk/t/op/arithmetics.t
Modified: trunk/t/op/arithmetics.t
==============================================================================
--- trunk/t/op/arithmetics.t Sun Aug 16 07:49:55 2009 (r40587)
+++ trunk/t/op/arithmetics.t Sun Aug 16 09:00:17 2009 (r40588)
@@ -7,7 +7,7 @@
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 23;
+use Parrot::Test tests => 26;
# test for GMP
use Parrot::Config;
@@ -600,9 +600,73 @@
say $N0
$N0 -= $N0
say $N0
+ $N0 *= -1
+ say $N0
+ $N0 *= 0
+ say $N0
+ $N0 += 5
+ say $N0
+ $N0 -= 42
+ say $N0
+.end
+CODE
+Inf
+NaN
+NaN
+NaN
+NaN
+NaN
+OUTPUT
+
+pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - exp" );
+.sub 'test' :main
+ $N0 = 'Inf'
+ $N1 = exp $N0
+ say $N1
+ $N0 = '-Inf'
+ $N1 = exp $N0
+ say $N1
+ $N0 = 'NaN'
+ $N1 = exp $N0
+ say $N1
.end
CODE
Inf
+0
+NaN
+OUTPUT
+
+pir_output_is( <<'CODE', <<OUTPUT, "Inf - ln" );
+.sub 'test' :main
+ $N0 = 'Inf'
+ $N1 = ln $N0
+ say $N1
+ $N0 = '-Inf'
+ $N1 = ln $N0
+ say $N1
+.end
+CODE
+Inf
+NaN
+OUTPUT
+
+pir_output_is( <<'CODE', <<OUTPUT, "Mixing NaN and Inf should give NaN" );
+.sub 'test' :main
+ $N0 = 'NaN'
+ $N1 = 'Inf'
+ $N0 *= $N1
+ say $N0
+ $N0 /= $N1
+ say $N0
+ $N0 -= $N1
+ say $N0
+ $N0 += $N1
+ say $N0
+.end
+CODE
+NaN
+NaN
+NaN
NaN
OUTPUT
More information about the parrot-commits
mailing list