Skip to content

Commit

Permalink
gcd operator with zeros
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDaniel committed Nov 13, 2016
1 parent 1f31490 commit 8f856a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion S03-operators/gcd.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 16;
plan 19;

# L<S32::Numeric/Numeric/"=item gcd">

Expand All @@ -15,6 +15,9 @@ isa-ok 10 gcd 5, Int, "The gcd of 10 and 5 is an Int";
is -432 gcd 63, 9, "The gcd of -432 and 63 is 9";
is 4342 gcd 65536, 2, "The gcd of 4342 and 65536 is 2";
isa-ok 4342 gcd 65536, Int, "The gcd of 4342 and 65536 is an Int";
is 0 gcd 42, 42, "The gcd of 0 and 42 is 42";
is 42 gcd 0, 42, "The gcd of 42 and 0 is 42";
is 0 gcd 0, 0, "The gcd of 0 and 0 is 0";

is ([gcd] 25..26), 1, '[gcd] Range works';
{
Expand Down
4 changes: 3 additions & 1 deletion S32-num/int.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 162;
plan 164;

# L<S32::Numeric/Real/=item truncate>
# truncate and .Int are synonynms.
Expand Down Expand Up @@ -226,6 +226,8 @@ subtest 'Int.new' => { # coverage; 2016-10-05
is-deeply $i3 gcd $i2, $i1, 'int(3) gcd int(2) returns int(1)';
is-deeply $i8 gcd $i2, $i2, 'int(8) gcd int(2) returns int(2)';
is-deeply $i8 gcd $i0, $i8, 'int(8) gcd int(0) returns int(8)';
is-deeply $i0 gcd $i8, $i0, 'int(0) gcd int(8) returns int(8)';
is-deeply $i0 gcd $i0, $i0, 'int(0) gcd int(0) returns int(0)';
is-deeply $iu gcd $i0, $i0, 'int(uninitialized) gcd int(0) returns int(0)';

is-deeply $i8 === $i8, Bool::True, 'int === int (True)';
Expand Down

0 comments on commit 8f856a7

Please sign in to comment.