Skip to content

Commit

Permalink
rakudo nom fudging.
Browse files Browse the repository at this point in the history
  • Loading branch information
coke committed Sep 21, 2011
1 parent 3c9d437 commit 91a5e7a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
16 changes: 13 additions & 3 deletions S32-list/minmax.t
Expand Up @@ -59,12 +59,16 @@ is ((-10..9).max: { abs $^a <=> abs $^b }), -10,
is max(:by({ $^a <=> $^b }), @array), 7,
"subroutine form of max with identity comparison block works";

#?rakudo todo 'nom regression'
is (@array.max: { abs $^a <=> abs $^b }), -9,
"method form of max taking a comparison block works";
#?rakudo todo 'nom regression'
is max(:by({ abs $^a <=> abs $^b }), @array), -9,
"subroutine form of max taking a comparison block works";
#?rakudo todo 'nom regression'
is (@array.max: { $^a.abs }), -9,
"method form of max taking a modifier block works";
#?rakudo todo 'nom regression'
is max(:by({ $^a.abs }), @array), -9,
"subroutine form of max taking a modifier block works";

Expand Down Expand Up @@ -94,6 +98,7 @@ is minmax(:by({ $^a.abs }), @array), 0..-9,
is ((-10..9).minmax: { abs $^a <=> abs $^b }), 0..-10,
"method form of minmax on Ranges taking a comparison block works";

#?rakudo todo 'nom regression'
is ((1..10).minmax: { ($_-3) * ($_-5) }), 4..10,
"method form of minmax taking an arity-1 comparison block works";

Expand All @@ -112,13 +117,18 @@ is min(:by({$^a <=> $^b}), 1,2,3), 1, "subroutine form of min with literals wor

# Try to read numbers from a file
@array = lines("t/spec/S32-list/numbers.data");
#?rakudo todo 'nom regression'
is @array.max, 5, "max of strings read from a file works";
#?rakudo todo 'nom regression'
is @array.min, -1, "min of strings read from a file works";

# Same, but numifying the numbers first
@array = map { +$_ }, @array;
is @array.max, 28, "max of strings read from a file works";
is @array.min, -80, "min of strings read from a file works";
#?rakudo skip 'nom regression'
{
@array = map { +$_ }, @array;
is @array.max, 28, "max of strings read from a file works";
is @array.min, -80, "min of strings read from a file works";
}

is (1, Inf).max, Inf,"Inf is greater than 1";
is (-1, -Inf).min, -Inf,"-Inf is less than -1";
Expand Down
10 changes: 10 additions & 0 deletions S32-list/sort.t
Expand Up @@ -35,6 +35,7 @@ plan 35;
is(@s, @e, 'array of numbers was sorted (using invocant form)');
}

#?rakudo skip 'nom regression'
{
my @a = (2, 45, 6, 1, 3);
my @e = (1, 2, 3, 6, 45);
Expand Down Expand Up @@ -69,6 +70,7 @@ plan 35;
is(@s, @e, '... with explicit spaceship (using invocant form)');
}

#?rakudo skip 'nom regression'
{
my @a = (2, 45, 6, 1, 3);
my @e = (45, 6, 3, 2, 1);
Expand Down Expand Up @@ -109,6 +111,7 @@ plan 35;
is(@s, @e, 'array of strings was sorted (using invocant form)');
}

#?rakudo skip 'nom regression'
{
my @a = <daa boo gaa aaa>;
my @e = <aaa boo daa gaa>;
Expand All @@ -117,6 +120,7 @@ plan 35;
is(@s, @e, '... with explicit cmp');
}

#?rakudo skip 'nom regression'
{
my @a = <daa boo gaa aaa>;
my @e = <aaa boo daa gaa>;
Expand All @@ -126,6 +130,7 @@ plan 35;
}


#?rakudo skip 'nom regression'
{
my %a = (4 => 'a', 1 => 'b', 2 => 'c', 5 => 'd', 3 => 'e');
my @e = (4, 1, 2, 5, 3);
Expand All @@ -134,6 +139,7 @@ plan 35;
is(@s, @e, '... sort keys by string value');
}

#?rakudo skip 'nom regression'
{
my %a = (4 => 'a', 1 => 'b', 2 => 'c', 5 => 'd', 3 => 'e');
my @e = (4, 1, 2, 5, 3);
Expand All @@ -142,6 +148,7 @@ plan 35;
is(@s, @e, '... sort keys by string value (using invocant form)');
}

#?rakudo skip 'nom regression'
{
my %a = ('a' => 4, 'b' => 1, 'c' => 2, 'd' => 5, 'e' => 3);
my @e = <b c e a d>;
Expand Down Expand Up @@ -225,6 +232,7 @@ plan 35;

my @sorted;

#?rakudo todo 'nom regression'
lives_ok { @sorted = (RT71258_1.new, RT71258_1.new).sort },
'sorting by stringified class instance (name and memory address)';

Expand All @@ -240,6 +248,7 @@ plan 35;
$a.x <=> $b.x;
}

#?rakudo todo 'nom regression'
lives_ok {
@sorted = (
RT71258_2.new(x => 2),
Expand All @@ -248,6 +257,7 @@ plan 35;
).sort
}, 'sorting stringified class instance with custom cmp';

#?rakudo todo 'nom regression'
is ~@sorted, '1 2 3',
'checking sort order with custom cmp';
}
Expand Down

0 comments on commit 91a5e7a

Please sign in to comment.