Permalink
Browse files

Tests for rounding NaN and Inf

git-svn-id: http://svn.pugscode.org/pugs@25511 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 54fdac8 commit 76f901d43496eebb7820b1d029557f64f5844439 leto committed Feb 24, 2009
Showing with 16 additions and 2 deletions.
  1. +16 −2 S29-num/rounders.t
View
@@ -1,6 +1,6 @@
use v6;
use Test;
-plan 42;
+plan 50;
# L<S29/Num/"=item round">
# L<S29/Num/"=item floor">
@@ -9,10 +9,24 @@ plan 42;
=begin pod
-Basic tests for the round(), floor(), truncate() and ceil() built-ins
+Basic tests for the round(), floor(), truncate() and ceiling() built-ins
=end pod
+#?rakudo 4 skip 'Rounding NaN should give NaN'
+
+is( floor(NaN), NaN, 'floor(NaN) is NaN');
+is( round(NaN), NaN, 'round(NaN) is NaN');
+is( ceiling(NaN), NaN, 'ceiling(NaN) is NaN');
+is( truncate(NaN), NaN, 'truncate(NaN) is NaN');
+
+#?rakudo 4 skip 'Rounding Inf should give Inf'
+
+is( floor(Inf), Inf, 'floor(Inf) is Inf');
+is( round(Inf), Inf, 'round(Inf) is Inf');
+is( ceiling(Inf), Inf, 'ceiling(Inf) is Inf');
+is( truncate(Inf), Inf, 'truncate(Inf) is Inf');
+
my %tests =
( ceiling => [ [ 1.5, 2 ], [ 2, 2 ], [ 1.4999, 2 ],
[ -0.1, 0 ], [ -1, -1 ], [ -5.9, -5 ],

0 comments on commit 76f901d

Please sign in to comment.