Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: ba69da82ed
Fetching contributors…

Cannot retrieve contributors at this time

18 lines (12 sloc) 0.533 kb
use Test::More 'no_plan';
use Number::Fraction;
my $f = eval { Number::Fraction->new('1/0') };
ok($@, "Denominator of zero should not allowed in string" );
$f = eval { Number::Fraction->new(1 , 0 ) };
ok($@, "Denominator of zero should not allowed in two ints" );
my $zero = Number::Fraction->new (0);
cmp_ok($zero, '==', 0, "created a \'zero\' fraction");
my $qrtr = Number::Fraction->new('1/4');
cmp_ok($qrtr, '==', 0.25, "Created 1/4");
my $divz = eval { $qrtr / $zero };
ok($@, "Division by zero should cause FATAL ERROR");
Jump to Line
Something went wrong with that request. Please try again.