Skip to content

Commit

Permalink
[v6.d REVIEW] Test type in gcd tests
Browse files Browse the repository at this point in the history
Orig: 8f856a780
  • Loading branch information
zoffixznet committed Jul 28, 2018
1 parent a60c4a9 commit c928f51
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions S03-operators/gcd.t
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 19;
plan 15;

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

Expand All @@ -10,26 +10,22 @@ Basic tests for the gcd operator
=end pod

is 10 gcd 5, 5, "The gcd of 10 and 5 is 5";
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-deeply 10 gcd 5, 5, "The gcd of 10 and 5 is 5";
is-deeply -432 gcd 63, 9, "The gcd of -432 and 63 is 9";
is-deeply 4342 gcd 65536, 2, "The gcd of 4342 and 65536 is 2";
is-deeply 0 gcd 42, 42, "The gcd of 0 and 42 is 42";
is-deeply 42 gcd 0, 42, "The gcd of 42 and 0 is 42";
is-deeply 0 gcd 0, 0, "The gcd of 0 and 0 is 0";

is ([gcd] 25..26), 1, '[gcd] Range works';
is-deeply ([gcd] 25..26), 1, '[gcd] Range works';
{
my @a = 50, 70, 100, 2005;
is ([gcd] @a), 5, '[gcd] array works';
is-deeply ([gcd] @a), 5, '[gcd] array works';
}

{
is 10.1 gcd 5.3, 5, "gcd converts Rats to Ints correctly";
isa-ok 10.1 gcd 5.3, Int, "and the result is an Int";
is 10.1e0 gcd 5.3e0, 5, "gcd converts Nums to Ints correctly";
isa-ok 10.1e0 gcd 5.3e0, Int, "and the result is an Int";
is-deeply 10.1 gcd 5.3, 5, "gcd converts Rats to Ints correctly";
is-deeply 10.1e0 gcd 5.3e0, 5, "gcd converts Nums to Ints correctly";
}

{
Expand Down

0 comments on commit c928f51

Please sign in to comment.