Skip to content

Commit

Permalink
S29-num/roots.t: update error message, avoid needless eval.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@20931 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
pmichaud committed Jun 21, 2008
1 parent 3f9e109 commit 5fa47b5
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions S29-num/roots.t
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use v6;
use Test;
plan 10;
plan 8;

# L<S29/Num/"=item roots">

#?rakudo skip 'parsefail'
#?rakudo skip 'roots not implemented'
{
sub has_approx($n, @list) {
for @list -> $i {
Expand All @@ -17,21 +17,19 @@ plan 10;
}

#?pugs todo 'feature'
#?rakudo skip 'parsefail'
#?rakudo skip 'roots not implemented'
{
my @l = eval('roots(-1, 2)');
ok(!$!, 'roots($x, $n) compiles');
my @l = roots(-1, 2);
ok(@l.elems == 2, 'roots(-1, 2) returns 2 elements');
ok(has_approx(1i, @l), 'roots(-1, 2) contains 1i');
ok(has_approx(-1i, @l), 'roots(-1, 2) contains -1i');
}

#?pugs todo 'feature'
#?rakudo skip 'parsefail'
#?rakudo skip 'roots not implemented'
{
my @l = eval('16.roots(4)');
ok(!$!, '$x.roots($n) compiles');
ok(@l.elems == 2, 'roots(16, 4) returns 4 elements');
my @l = 16.roots(4);
ok(@l.elems == 4, 'roots(16, 4) returns 4 elements');
ok(has_approx(2, @l), 'roots(16, 4) contains 2');
ok(has_approx(2i, @l), 'roots(16, 4) contains 2i');
ok(has_approx(-2, @l), 'roots(16, 4) contains -2');
Expand Down

0 comments on commit 5fa47b5

Please sign in to comment.