Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[S32] remove more tests for now-gone calling-positionals-by-named tests
  • Loading branch information
moritz committed May 23, 2011
1 parent 87efb8a commit c5fa27b
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 80 deletions.
4 changes: 1 addition & 3 deletions S32-hash/keys_values.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 16;
plan 14;

=begin pod
Expand All @@ -15,13 +15,11 @@ my %hash = (a => 1, b => 2, c => 3, d => 4);
# L<S32::Containers/"Hash"/=item keys>
is(~%hash.keys.sort, "a b c d", '%hash.keys works');
is(~sort(keys(%hash)), "a b c d", 'keys(%hash) on hashes');
is(~sort(keys(:array(%hash))), 'a b c d', 'keys(:array(%hash)) works with named args');
is(+%hash.keys, +%hash, 'we have the same number of keys as elements in the hash');

# L<S32::Containers/"Hash"/=item values>
is(~%hash.values.sort, "1 2 3 4", '%hash.values works');
is(~sort(values(%hash)), "1 2 3 4", 'values(%hash) works');
is(~sort(values(:array(%hash))), '1 2 3 4', 'values(:array(%hash)) works with named args');
is(+%hash.values, +%hash, 'we have the same number of keys as elements in the hash');

# keys and values on Pairs
Expand Down
1 change: 0 additions & 1 deletion S32-io/path.t
Expand Up @@ -3,7 +3,6 @@ use Test;

plan 4;

#?rakudo: 4 eval "Rakudo doesn't parse Path literals yet."
isa_ok qp{foo}, Path, 'qp{foo} creates a Path object.';
isa_ok qp{/foo}, Path, 'qp{/foo} creates a Path object.';
isa_ok qp{foo/bar}, Path, 'qp{foo/bar} creates a Path object.';
Expand Down
3 changes: 1 addition & 2 deletions S32-list/end.t
Expand Up @@ -9,7 +9,7 @@ use Test;
Array .end tests
=end docs

plan 15;
plan 14;

# basic array .end tests

Expand Down Expand Up @@ -41,7 +41,6 @@ plan 15;
is(end(@array), 42, 'index of last element is 42 after assignment');

@array.pop;
is(end(:array(@array)), 41, 'index of last element is 41 after pop');
is((end @array), 41, 'index of last element is 41 after pop');

shift @array;
Expand Down
8 changes: 1 addition & 7 deletions S32-list/first.t
Expand Up @@ -3,7 +3,7 @@ use Test;

# L<S32::Containers/"List"/"=item first">

plan 23;
plan 21;

my @list = (1 ... 10);

Expand All @@ -19,12 +19,6 @@ my @list = (1 ... 10);
is($result, 1, "returned value by first() is correct");
}

#?rakudo skip 'RT 74344'
{
my $result = first({ ($^a % 2) }, :values(@list));
ok($result ~~ Int, "first() returns an Int");
is($result, 1, "returned value by first() is correct");
}

{
my $result = @list.first( { ($^a == 4)});
Expand Down
13 changes: 1 addition & 12 deletions S32-list/grep.t
Expand Up @@ -9,7 +9,7 @@ built-in grep tests
=end pod

plan 44;
plan 38;

my @list = (1 .. 10);

Expand All @@ -23,17 +23,6 @@ my @list = (1 .. 10);
is(@result[4], 9, 'got the value we expected');
}

#?rakudo skip 'calling a slurpy by name, RT 74344'
{
my @result = grep({ ($_ % 2) }, :values(@list));
is(+@result, 5, 'we got a list back');
is(@result[0], 1, 'got the value we expected');
is(@result[1], 3, 'got the value we expected');
is(@result[2], 5, 'got the value we expected');
is(@result[3], 7, 'got the value we expected');
is(@result[4], 9, 'got the value we expected');
}

#?rakudo skip "adverbial block"
{
my @result = @list.grep():{ ($_ % 2) };
Expand Down
5 changes: 1 addition & 4 deletions S32-list/join.t
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 35;
plan 34;

# L<S32::Containers/"List"/"=item join">

Expand All @@ -15,9 +15,6 @@ my @list = ("a", "b", "c");

is(@list.join("|"), "a|b|c", '@list.join("|") works');

#?rakudo skip 'calling positional params by name'
is(join("|", :values(@list)), "a|b|c", 'join("|", :values(@list)) works');

my $joined2 = join("|", @list);
is($joined2, "a|b|c", 'join("|", @list) works');

Expand Down
9 changes: 1 addition & 8 deletions S32-list/map.t
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 54;
plan 52;

# L<S32::Containers/"List"/"=item map">

Expand All @@ -13,13 +13,6 @@ plan 54;

my @list = (1 .. 5);

#?rakudo skip "Named value argument NYI"
{
my @result = map( { $_ * 2 }, :values(@list) );
is(+@result, 5, 'named :values: we got a list back');
is @result.join(', '), '2, 4, 6, 8, 10', 'got the values we expected';
}

{
my @result = map { $_ * 2 }, @list;
is(+@result, 5, 'sub form: we got a list back');
Expand Down
8 changes: 1 addition & 7 deletions S32-list/minmax.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 54;
plan 51;

# L<S32::Containers/List/=item min>
# L<S32::Containers/List/=item max>
Expand All @@ -19,8 +19,6 @@ my @array = (5,-3,7,0,1,-9); #NOTICE! The <> don't work like they should, rakudo
# Tests for C<min>:
is @array.min, -9, "basic method form of min works";
is min(@array), -9, 'min(list)';
#?rakudo skip 'named args'
is min(:by({$^a <=> $^b }), :values(@array)), -9, "basic subroutine form of min works with named args";

is (@array.min: { $^a <=> $^b }), -9,
"method form of min with identity comparison block works";
Expand Down Expand Up @@ -48,8 +46,6 @@ is ((1..10).min: { ($_-3) * ($_-5) }), 4,
# Tests for C<max>:
is (@array.max), 7, "basic method form of max works";
is max(:by({ $^a <=> $^b }), @array), 7, "basic subroutine form of max works";
#?rakudo skip 'named args'
is max(:values(@array)), 7, "basic subroutine form of max works with named args";

is (@array.max: { $^a <=> $^b }), 7,
"method form of max with identity comparison block works";
Expand Down Expand Up @@ -79,8 +75,6 @@ is ((1..10).max: { ($_-3) * ($_-5) }), 10,
# Tests for C<minmax>:
is @array.minmax, -9..7, "basic method form of minmax works";
is minmax(@array), -9..7, 'minmax(list)';
#?rakudo skip 'named args'
is minmax(:by({$^a <=> $^b }), :values(@array)), -9..7, "basic subroutine form of minmax works with named args";

is (@array.minmax: { $^a <=> $^b }), -9..7,
"method form of minmax with identity comparison block works";
Expand Down
4 changes: 1 addition & 3 deletions S32-list/pick.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 28;
plan 27;

=begin description
Expand Down Expand Up @@ -31,8 +31,6 @@ ok ~(@arr.pick(4)) eq 'z z z', 'method pick with $num > +@values';
#?pugs 2 todo 'feature'
is pick(2, @arr), <z z>, 'sub pick with $num < +@values, implicit no-replace';
is pick(4, @arr), <z z z>, 'sub pick with $num > +@values';
#?rakudo skip "Calling values by name fails hard"
is pick(2, :values(@arr)), <z z>, 'sub pick with $num < +@values and named args';

is (<a b c d>.pick(*).sort).Str, 'a b c d', 'pick(*) returns all the items in the array (but maybe not in order)';

Expand Down
7 changes: 1 addition & 6 deletions S32-list/reverse.t
Expand Up @@ -3,7 +3,7 @@ use Test;

# L<S32::Containers/List/"=item reverse">

plan 22;
plan 21;



Expand All @@ -19,11 +19,6 @@ my @a = reverse(1, 2, 3, 4);
my @e = (4, 3, 2, 1);

is(@a, @e, "list was reversed");
#?rakudo skip 'named args'
{
@a = reverse(:values(1, 2, 3, 4));
is(@a, @e, "list was reversed");
}

{
my $a = reverse("foo");
Expand Down
4 changes: 1 addition & 3 deletions S32-list/roll.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 24;
plan 23;

=begin description
Expand All @@ -27,8 +27,6 @@ ok ~(@arr.roll(4)) eq 'z z z z', 'method roll with $num > +@values';
#?pugs 2 todo 'feature'
is roll(2, @arr), <z z>, 'sub roll with $num < +@values, implicit no-replace';
is roll(4, @arr), <z z z z>, 'sub roll with $num > +@values';
#?rakudo skip "Calling values by name fails hard"
is roll(2, :values(@arr)), <z z>, 'sub roll with $num < +@values and named args';

is <a b c d>.roll(*)[^10].elems, 10, 'roll(*) generates at least ten elements';

Expand Down
6 changes: 1 addition & 5 deletions S32-num/abs.t
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 50;
plan 48;

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

Expand All @@ -17,8 +17,6 @@ Basic tests for the abs() builtin
for 0, 0 / 1, 0.0e0, 1, 50, 60.0e0, 99.99 {
is(abs($_), $_, "got the right absolute value for $_");
is(.abs, $_, 'got the right absolute value for $_='~$_);
#?rakudo skip 'named args'
is(abs(:x($_)), $_, "got the right absolute value for $_");

unless $_ ~~ Int {
ok(abs($_) ~~ $_.WHAT, "got the right data type (" ~ $_.WHAT ~ ") of absolute value for $_");
Expand All @@ -29,8 +27,6 @@ for 0, 0 / 1, 0.0e0, 1, 50, 60.0e0, 99.99 {
for -1, -50, -60.0e0, -9999 / 100 {
is(abs($_), -$_, "got the right absolute value for $_");
is(.abs, -$_, 'got the right absolute value for $_='~$_);
#?rakudo skip 'named args'
is(abs(:x($_)), -$_, "got the right absolute value for $_");

unless $_ ~~ Int {
ok(abs($_) ~~ $_.WHAT, "got the right data type (" ~ $_.WHAT ~ ") of absolute value for $_");
Expand Down
20 changes: 1 addition & 19 deletions S32-num/exp.t
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 83;
plan 71;

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

Expand All @@ -15,24 +15,6 @@ Basic tests for the exp() builtin
my $e_to_the_fifth = 5497075/37039;
my $pi = 312689/99532;

{
is_approx(exp(:exponent(5)), $e_to_the_fifth, 'got the exponent of 5');
is_approx(exp(:exponent(0)), 1, 'exp(:exponent(0)) == 1');

is_approx(exp(:exponent(1i*$pi)), -1, 'exp(:exponent(i $pi)) == -1');
is_approx(exp(:exponent(-1i*$pi)), -1, 'exp(:exponent(-i $pi)) == -1');

is_approx(exp(:exponent(5), :base(10)), 100000, 'got the base-10 exponent of 5');
is_approx(exp(:exponent(0), :base(10)), 1, 'exp(:exponent(0), :base(10)) == 1');

is_approx(exp(:exponent(1i*$pi), :base(2)), 2 ** (1i * pi), 'exp(:exponent(i pi), :base(2)) == 2 ** (i * pi)');
is_approx(exp(:base(1i*$pi), :exponent(2)), (1i * pi) ** 2, 'exp(:exponent(2), :base(i pi)) == (i * pi) ** 2');
is_approx(exp(:exponent(1i*$pi), :base(2.Rat)), 2 ** (1i * pi), 'exp(:exponent(i pi), :base(2)) == 2 ** (i * pi)');
is_approx(exp(:base(1i*$pi), :exponent(2.Rat)), (1i * pi) ** 2, 'exp(:exponent(2), :base(i pi)) == (i * pi) ** 2');
is_approx(exp(:exponent(1i*$pi), :base(2.Num)), 2 ** (1i * pi), 'exp(:exponent(i pi), :base(2)) == 2 ** (i * pi)');
is_approx(exp(:base(1i*$pi), :exponent(2.Num)), (1i * pi) ** 2, 'exp(:exponent(2), :base(i pi)) == (i * pi) ** 2');
}

{
is_approx(5.exp, $e_to_the_fifth, '5.exp == e to the fifth');
is_approx(5.Rat.exp, $e_to_the_fifth, '5.Rat.exp == e to the fifth');
Expand Down

0 comments on commit c5fa27b

Please sign in to comment.