Browse files

div by 0 soft-failure tests for Rat, Num.

  • Loading branch information...
1 parent 956f9fc commit dea51d09b2580e8d8fafa5ca1724d21de5e0164e @timo timo committed Jun 19, 2013
Showing with 14 additions and 5 deletions.
  1. +1 −4 S02-magicals/dollar_bang.t
  2. +10 −0 S03-operators/div.t
  3. +3 −1 S32-num/rat.t
View
5 S02-magicals/dollar_bang.t
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 16;
+plan 15;
=begin desc
@@ -28,9 +28,6 @@ try { eval 'foo(@a,@a)' };
ok $!.defined, 'Calling a subroutine with a nonmatching signature sets $!';
ok !$called, 'The subroutine also was not called';
-try { 1 div 0 };
-ok $!.defined, 'Dividing one by zero sets $!';
-
sub incr ( $a is rw ) { $a++ };
try { incr(19) };
ok $!.defined, 'Modifying a constant sets $!';
View
10 S03-operators/div.t
@@ -0,0 +1,10 @@
+use Test;
+
+plan 6;
+
+isa_ok 10 div 0 , Failure, "10 div 0 softfails";
+isa_ok 10 / 0 , Rat, "10 / 0 is a Rat.";
+isa_ok 10 / 0.0 , Rat, "10 / 0.0 is a rat";
+isa_ok 10 / 0e0 , Failure, "10 / 0e0 softfails";
+isa_ok (1/1) / 0e0, Failure, "(1/1) / 0e0 softfails";
+isa_ok 1e0 / (0/1), Failure, "1e0 / (0/1) softfails";
View
4 S32-num/rat.t
@@ -153,11 +153,13 @@ is((2 / (2 / 3)).nude, (3, 1), "2 / 2/3 = 3 is simplified internally");
is_approx sin(5.0e0), sin(10/2), 'sin(Rat) works';
-# SHOULD: Add divide by zero / zero denominator tests
+# SHOULD: Add zero denominator tests
# Added three constructor tests above. Unsure about the
# wisdom of allowing math with zero denominator Rats,
# so I'm holding off on writing tests for it.
+# there are a few division by zero tests in S03-operator/div.t
+
#?niecza todo
#?pugs todo 'NaN.Rat'
is NaN.Rat, NaN, "NaN.Rat == NaN";

0 comments on commit dea51d0

Please sign in to comment.