Skip to content

Commit 39f2806

Browse files
committed
[minmax.t] do not rely on abs being a prefix op
1 parent f1cb2cc commit 39f2806

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

S32-list/minmax.t

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ is (@array.min:{ $^a <=> $^b }), -9,
2929
is min(:by({ $^a <=> $^b }), @array), -9,
3030
"subroutine form of min with identity comparison block works";
3131

32-
is (@array.min: { abs $^a <=> abs $^b }), 0,
32+
is (@array.min: { abs($^a) <=> abs($^b) }), 0,
3333
"method form of min taking a comparison block works";
34-
is min(:by({ abs $^a <=> abs $^b }), @array), 0,
34+
is min(:by({ abs($^a) <=> abs($^b) }), @array), 0,
3535
"subroutine form of min taking a comparison block works";
3636

3737
is (@array.min: { abs $^a }), 0,
@@ -41,7 +41,7 @@ is min(:by({ $^a.abs }), @array), 0,
4141

4242
#?rakudo 2 skip "Range.min not fully implemented yet (RT #105118)"
4343
#?niecza 2 skip "Range.min not fully implemented yet"
44-
is ((-10..10).min: { abs $^a <=> abs $^b }), 0,
44+
is ((-10..10).min: { abs($^a) <=> abs($^b) }), 0,
4545
"method form of min on Ranges taking a comparison block works";
4646

4747
is ((1..10).min: { ($_-3) * ($_-5) }), 4,
@@ -58,15 +58,15 @@ is max(@array), 7, 'sub form of max';
5858

5959
#?rakudo skip "Range.max not fully implemented yet (RT #105118)"
6060
#?niecza 2 skip "Range.max not fully implemented yet"
61-
is ((-10..9).max: { abs $^a <=> abs $^b }), -10,
61+
is ((-10..9).max: { abs($^a) <=> abs $^b }), -10,
6262
"method form of max on Ranges taking a comparison block works";
6363

6464
is max(:by({ $^a <=> $^b }), @array), 7,
6565
"subroutine form of max with identity comparison block works";
6666

67-
is (@array.max: { abs $^a <=> abs $^b }), -9,
67+
is (@array.max: { $^a.abs <=> $^b.abs }), -9,
6868
"method form of max taking a comparison block works";
69-
is max(:by({ abs $^a <=> abs $^b }), @array), -9,
69+
is max(:by({ $^a.abs <=> $^b.abs }), @array), -9,
7070
"subroutine form of max taking a comparison block works";
7171
is (@array.max: { $^a.abs }), -9,
7272
"method form of max taking a modifier block works";
@@ -88,16 +88,16 @@ is (@array.minmax: { $^a <=> $^b }), -9..7,
8888
is minmax(:by({ $^a <=> $^b }), @array), -9..7,
8989
"subroutine form of minmax with identity comparison block works";
9090

91-
is (@array.minmax: { abs $^a <=> abs $^b }), 0..-9,
91+
is (@array.minmax: { $^a.abs <=> $^b.abs }), 0..-9,
9292
"method form of minmax taking a comparison block works";
93-
is minmax(:by({ abs $^a <=> abs $^b }), @array), 0..-9,
93+
is minmax(:by({ $^a.abs <=> $^b.abs }), @array), 0..-9,
9494
"subroutine form of minmax taking a comparison block works";
9595
is (@array.minmax: { abs $^a }), 0..-9,
9696
"method form of minmax taking a comparison block works";
9797
is minmax(:by({ $^a.abs }), @array), 0..-9,
9898
"subroutine form of minmax taking a comparison block works";
9999

100-
is ((-10..9).minmax: { abs $^a <=> abs $^b }), 0..-10,
100+
is ((-10..9).minmax: { $^a.abs <=> $^b.abs }), 0..-10,
101101
"method form of minmax on Ranges taking a comparison block works";
102102

103103
is ((1..10).minmax: { ($_-3) * ($_-5) }), 4..10,

0 commit comments

Comments
 (0)