Skip to content

Commit 484d409

Browse files
committed
Rewrite file test to match current I/O spec. Fudge for niecza.
1 parent b8f2553 commit 484d409

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

S32-list/minmax.t

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ is min(:by({ $^a.abs }), @array), 0,
3737
"subroutine form of min taking a comparison block works";
3838

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

@@ -53,6 +54,7 @@ is (@array.max: { $^a <=> $^b }), 7,
5354
is max(@array), 7, 'sub form of max';
5455

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

@@ -73,6 +75,7 @@ is max(:by({ $^a.abs }), @array), -9,
7375
"subroutine form of max taking a modifier block works";
7476

7577
#?rakudo skip "Range.max not fully implemented yet (RT #105118)"
78+
#?niecza skip "Range.min not fully implemented yet"
7679
is ((1..10).max: { ($_-3) * ($_-5) }), 10,
7780
"method form of max taking an arity-1 comparison block works";
7881

@@ -104,32 +107,40 @@ is ((1..10).minmax: { ($_-3) * ($_-5) }), 4..10,
104107

105108
# Error cases:
106109
#?pugs 2 todo 'bug'
110+
#?niecza 2 skip "Unable to resolve method min/max in class Int"
107111
is 42.min, 42, ".min should work on scalars";
108112
is 42.max, 42, ".max should work on scalars";
113+
#?niecza 2 skip "Unable to resolve method min/max in class Parcel"
109114
is (42,).min, 42, ".min should work on one-elem arrays";
110115
is (42,).max, 42, ".max should work on one-elem arrays";
111116

112117
# Tests with literals:
118+
#?niecza 2 skip "Unable to resolve method min/max in class Parcel"
113119
is (1,2,3).max, 3, "method form of max with literals works";
114120
is (1,2,3).min, 1, "method form of min with literals works";
115121
is max(:by({$^a <=> $^b}), 1,2,3), 3, "subroutine form of max with literals works";
116122
is min(:by({$^a <=> $^b}), 1,2,3), 1, "subroutine form of min with literals works";
117123

118124
# Try to read numbers from a file
119-
@array = lines("t/spec/S32-list/numbers.data");
120-
#?rakudo todo 'nom regression'
121-
is @array.max, 5, "max of strings read from a file works";
122-
#?rakudo todo 'nom regression'
123-
is @array.min, -1, "min of strings read from a file works";
124-
125-
# Same, but numifying the numbers first
126-
#?rakudo skip 'nom regression'
127125
{
128-
@array = map { +$_ }, @array;
129-
is @array.max, 28, "max of strings read from a file works";
130-
is @array.min, -80, "min of strings read from a file works";
126+
my $fh = open "t/spec/S32-list/numbers.data";
127+
@array = $fh.lines();
128+
#?rakudo todo 'nom regression'
129+
is @array.max, 5, "max of strings read from a file works";
130+
#?rakudo todo 'nom regression'
131+
is @array.min, -1, "min of strings read from a file works";
132+
133+
# Same, but numifying the numbers first
134+
#?rakudo skip 'nom regression'
135+
{
136+
@array = map { +$_ }, @array;
137+
is @array.max, 28, "max of strings read from a file works";
138+
is @array.min, -80, "min of strings read from a file works";
139+
}
140+
131141
}
132142

143+
#?niecza 4 skip 'Unable to resolve method max in class Parcel'
133144
is (1, Inf).max, Inf,"Inf is greater than 1";
134145
is (-1, -Inf).min, -Inf,"-Inf is less than -1";
135146
is (-Inf, Inf).min, -Inf,"-Inf is less than Inf";
@@ -150,6 +161,7 @@ is (-Inf, Inf).max, Inf,"Inf is greater than -Inf";
150161
#is (0, NaN).max, NaN, "max(0,NaN)=NaN";
151162
#is (Inf, NaN).max, NaN, "max(Inf,NaN)=NaN";
152163

164+
#?niecza 4 skip "Excess arguments to infix:<min>"
153165
is ([min] (5,10,-15,20)), -15, 'reduce min int';
154166
is ([max] (5,10,-15,20)), 20, 'reduce max int';
155167

0 commit comments

Comments
 (0)