Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 792 lines (654 sloc) 28.437 kb
79583ce [t] moved operators/hyper.t to spec/
moritz authored
1 use v6;
2
3 use Test;
4
5 =begin pod
6
7 Hyper operators L<S03/"Hyper operators">
8
9 =end pod
10
11 # L<S03/Hyper operators>
57c1095 [t/spec] clean up hyper.t a bit, and fudge some tests for rakudo
moritz authored
12 # binary infix
13 my @r;
14 my @e;
15 {
79583ce [t] moved operators/hyper.t to spec/
moritz authored
16 @r = (1, 2, 3) »+« (2, 4, 6);
57c1095 [t/spec] clean up hyper.t a bit, and fudge some tests for rakudo
moritz authored
17 @e = (3, 6, 9);
79583ce [t] moved operators/hyper.t to spec/
moritz authored
18 is(~@r, ~@e, "hyper-sum two arrays");
dcb67c2 [t/spec] group tests in hyper.t by Unicodeness to avoid too many fudge m...
moritz authored
19
79583ce [t] moved operators/hyper.t to spec/
moritz authored
20 @r = (1, 2, 3) »-« (2, 4, 6);
21 @e = (-1, -2, -3);
22 is(~@r, ~@e, "hyper-subtract two arrays");
dcb67c2 [t/spec] group tests in hyper.t by Unicodeness to avoid too many fudge m...
moritz authored
23
24 @r = (1, 2, 3) »*« (2, 4, 6);
25 @e = (2, 8, 18);
26 is(~@r, ~@e, "hyper-multiply two arrays");
27
28 @r = (1, 2, 3) »x« (3, 2, 1);
29 @e = ('111', '22', '3');
30 is(~@r, ~@e, "hyper-x two arrays");
31
32 @r = (1, 2, 3) »xx« (3, 2, 1);
33 @e = ((1,1,1), (2,2), (3));
34 is(~@r, ~@e, "hyper-xx two arrays");
35
a4ba5fd [t/spec] correct meaning of infix:<div> and infix:</>. Patch courtesy (m...
moritz authored
36 @r = (20, 40, 60) »div« (2, 5, 10);
dcb67c2 [t/spec] group tests in hyper.t by Unicodeness to avoid too many fudge m...
moritz authored
37 @e = (10, 8, 6);
38 is(~@r, ~@e, "hyper-divide two arrays");
39
40 @r = (1, 2, 3) »+« (10, 20, 30) »*« (2, 3, 4);
41 @e = (21, 62, 123);
42 is(~@r, ~@e, "precedence - »+« vs »*«");
57c1095 [t/spec] clean up hyper.t a bit, and fudge some tests for rakudo
moritz authored
43 }
79583ce [t] moved operators/hyper.t to spec/
moritz authored
44
57c1095 [t/spec] clean up hyper.t a bit, and fudge some tests for rakudo
moritz authored
45 {
79583ce [t] moved operators/hyper.t to spec/
moritz authored
46 @r = (1, 2, 3) >>+<< (2, 4, 6);
47 @e = (3, 6, 9);
48 is(~@r, ~@e, "hyper-sum two arrays ASCII notation");
49
50 @r = (1, 2, 3) >>-<< (2, 4, 6);
51 @e = (-1, -2, -3);
52 is(~@r, ~@e, "hyper-subtract two arrays ASCII notation");
53
54 @r = (1, 2, 3) >>*<< (2, 4, 6);
55 @e = (2, 8, 18);
56 is(~@r, ~@e, "hyper-multiply two arrays ASCII notation");
57
58 @r = (1, 2, 3) >>x<< (3, 2, 1);
59 @e = ('111', '22', '3');
60 is(~@r, ~@e, "hyper-x two arrays ASCII notation");
61
62 @r = (1, 2, 3) >>xx<< (3, 2, 1);
63 @e = ((1,1,1), (2,2), (3));
64 is(~@r, ~@e, "hyper-xx two arrays ASCII notation");
65
a4ba5fd [t/spec] correct meaning of infix:<div> and infix:</>. Patch courtesy (m...
moritz authored
66 @r = (20, 40, 60) >>div<< (2, 5, 10);
79583ce [t] moved operators/hyper.t to spec/
moritz authored
67 @e = (10, 8, 6);
68 is(~@r, ~@e, "hyper-divide two arrays ASCII notation");
69
70 @r = (1, 2, 3) >>+<< (10, 20, 30) >>*<< (2, 3, 4);
71 @e = (21, 62, 123);
72 is(~@r, ~@e, "precedence - >>+<< vs >>*<< ASCII notation");
73 };
74
75 { # unary postfix
76 my @r = (1, 2, 3);
84d84f4 [t/spec] Refudging and tweaks for nested hyper.
colomon authored
77 @r»++;
79583ce [t] moved operators/hyper.t to spec/
moritz authored
78 my @e = (2, 3, 4);
7347a84 [t/spec] Change more Pugs todo flags to fudge commands
kyle authored
79 #?pugs todo
80 is(~@r, ~@e, "hyper auto increment an array");
79583ce [t] moved operators/hyper.t to spec/
moritz authored
81
82 @r = (1, 2, 3);
84d84f4 [t/spec] Refudging and tweaks for nested hyper.
colomon authored
83 @r>>++;
79583ce [t] moved operators/hyper.t to spec/
moritz authored
84 @e = (2, 3, 4);
7347a84 [t/spec] Change more Pugs todo flags to fudge commands
kyle authored
85 #?pugs todo
86 is(~@r, ~@e, "hyper auto increment an array ASCII notation");
79583ce [t] moved operators/hyper.t to spec/
moritz authored
87 };
88
89 { # unary prefix
90 my @r;
91 @r = -« (3, 2, 1);
92 my @e = (-3, -2, -1);
93 is(~@r, ~@e, "hyper op on assignment/pipeline");
94
95 @r = -<< (3, 2, 1);
96 @e = (-3, -2, -1);
97 is(~@r, ~@e, "hyper op on assignment/pipeline ASCII notation");
98 };
99
3159006 [t/spec] Correct some and unfudge some hyper spec tests.
jnthn authored
100 { # dimension upgrade - ASCII
101 my @r;
102 @r = (1, 2, 3) >>+>> 1;
103 my @e = (2, 3, 4);
104 is(~@r, ~@e, "auto dimension upgrade on rhs ASCII notation");
105
106 @r = 2 <<*<< (10, 20, 30);
107 @e = (20, 40, 60);
108 is(~@r, ~@e, "auto dimension upgrade on lhs ASCII notation");
109 }
110
fe872b9 [t/spec] Update hyper tests to match new spec.
colomon authored
111 { # extension
0739929 [t/spec] Fix up for new hyper rules, unfudge tests that now work.
colomon authored
112 @r = (1,2,3,4) >>~>> <A B C D E>;
113 @e = <1A 2B 3C 4D>;
114 is(~@r, ~@e, "list-level element truncate on rhs ASCII notation");
115
116 @r = (1,2,3,4,5) <<~<< <A B C D>;
117 @e = <1A 2B 3C 4D>;
118 is(~@r, ~@e, "list-level element truncate on lhs ASCII notation");
119
fe872b9 [t/spec] Update hyper tests to match new spec.
colomon authored
120 @r = (1,2,3,4) >>~>> <A B C>;
121 @e = <1A 2B 3C 4A>;
122 is(~@r, ~@e, "list-level element extension on rhs ASCII notation");
123
124 @r = (1,2,3) <<~<< <A B C D>;
125 @e = <1A 2B 3C 1D>;
126 is(~@r, ~@e, "list-level element extension on lhs ASCII notation");
127
128 @r = (1,2,3,4) >>~>> <A B>;
129 @e = <1A 2B 3A 4B>;
3159006 [t/spec] Correct some and unfudge some hyper spec tests.
jnthn authored
130 is(~@r, ~@e, "list-level element extension on rhs ASCII notation");
131
fe872b9 [t/spec] Update hyper tests to match new spec.
colomon authored
132 @r = (1,2) <<~<< <A B C D>;
133 @e = <1A 2B 1C 2D>;
3159006 [t/spec] Correct some and unfudge some hyper spec tests.
jnthn authored
134 is(~@r, ~@e, "list-level element extension on lhs ASCII notation");
135
fe872b9 [t/spec] Update hyper tests to match new spec.
colomon authored
136 @r = (1,2,3,4) >>~>> <A>;
137 @e = <1A 2A 3A 4A>;
3159006 [t/spec] Correct some and unfudge some hyper spec tests.
jnthn authored
138 is(~@r, ~@e, "list-level element extension on rhs ASCII notation");
139
fe872b9 [t/spec] Update hyper tests to match new spec.
colomon authored
140 @r = (1,) <<~<< <A B C D>;
141 @e = <1A 1B 1C 1D>;
3159006 [t/spec] Correct some and unfudge some hyper spec tests.
jnthn authored
142 is(~@r, ~@e, "list-level element extension on lhs ASCII notation");
143
fe872b9 [t/spec] Update hyper tests to match new spec.
colomon authored
144 @r = (1,2,3,4) >>~>> 'A';
145 @e = <1A 2A 3A 4A>;
146 is(~@r, ~@e, "scalar element extension on rhs ASCII notation");
79583ce [t] moved operators/hyper.t to spec/
moritz authored
147
fe872b9 [t/spec] Update hyper tests to match new spec.
colomon authored
148 @r = 1 <<~<< <A B C D>;
149 @e = <1A 1B 1C 1D>;
150 is(~@r, ~@e, "scalar element extension on lhs ASCII notation");
151 };
79583ce [t] moved operators/hyper.t to spec/
moritz authored
152
fe872b9 [t/spec] Update hyper tests to match new spec.
colomon authored
153 { # dimension upgrade - unicode
0739929 [t/spec] Fix up for new hyper rules, unfudge tests that now work.
colomon authored
154 @r = (1,2,3,4) »~» <A B C D E>;
155 @e = <1A 2B 3C 4D>;
156 is(~@r, ~@e, "list-level element truncate on rhs unicode notation");
157
158 @r = (1,2,3,4,5) «~« <A B C D>;
159 @e = <1A 2B 3C 4D>;
160 is(~@r, ~@e, "list-level element truncate on lhs unicode notation");
161
fe872b9 [t/spec] Update hyper tests to match new spec.
colomon authored
162 @r = (1,2,3,4) »~» <A B C>;
163 @e = <1A 2B 3C 4A>;
164 is(~@r, ~@e, "list-level element extension on rhs unicode notation");
165
166 @r = (1,2,3) «~« <A B C D>;
167 @e = <1A 2B 3C 1D>;
168 is(~@r, ~@e, "list-level element extension on lhs unicode notation");
169
170 @r = (1,2,3,4) »~» <A B>;
171 @e = <1A 2B 3A 4B>;
172 is(~@r, ~@e, "list-level element extension on rhs unicode notation");
173
174 @r = (1,2) «~« <A B C D>;
175 @e = <1A 2B 1C 2D>;
176 is(~@r, ~@e, "list-level element extension on lhs unicode notation");
177
178 @r = (1,2,3,4) »~» <A>;
179 @e = <1A 2A 3A 4A>;
180 is(~@r, ~@e, "list-level element extension on rhs unicode notation");
181
182 @r = (1,) «~« <A B C D>;
183 @e = <1A 1B 1C 1D>;
184 is(~@r, ~@e, "list-level element extension on lhs unicode notation");
185
186 @r = (1,2,3,4) »~» 'A';
187 @e = <1A 2A 3A 4A>;
188 is(~@r, ~@e, "scalar element extension on rhs unicode notation");
189
190 @r = 1 «~« <A B C D>;
191 @e = <1A 1B 1C 1D>;
192 is(~@r, ~@e, "scalar element extension on lhs unicode notation");
79583ce [t] moved operators/hyper.t to spec/
moritz authored
193 };
194
195 { # unary postfix with integers
196 my @r;
245fd38 [t/spec] correct and fudge @array>>++ tests in hyper.t
moritz authored
197 @r = (1, 4, 9)».sqrt;
79583ce [t] moved operators/hyper.t to spec/
moritz authored
198 my @e = (1, 2, 3);
199 is(~@r, ~@e, "method call on integer list elements");
200
245fd38 [t/spec] correct and fudge @array>>++ tests in hyper.t
moritz authored
201 @r = (1, 4, 9)>>.sqrt;
1e0f570 [t/spec]: Eliminate some "Redeclared variable" warnings in tests
pmichaud authored
202 @e = (1, 2, 3);
79583ce [t] moved operators/hyper.t to spec/
moritz authored
203 is(~@r, ~@e, "method call on integer list elements (ASCII)");
245fd38 [t/spec] correct and fudge @array>>++ tests in hyper.t
moritz authored
204 }
f7dc0d5 added more missing test cases from S03
jimmy authored
205
82ab11f @pmichaud Some hyper.t de-fudging.
pmichaud authored
206 {
207 my (@r, @e);
208 (@r = (1, 4, 9))»++;
209 @e = (2, 5, 10);
210 is(~@r, ~@e, "operator call on integer list elements");
211 }
212
213 #?rakudo skip 'dotted postfix'
245fd38 [t/spec] correct and fudge @array>>++ tests in hyper.t
moritz authored
214 {
00f085f [hyper.t] missing semi
lwall authored
215 my (@r, @e);
245fd38 [t/spec] correct and fudge @array>>++ tests in hyper.t
moritz authored
216 (@r = (1, 4, 9))»++;
217 @e = (2, 5, 10);
f7dc0d5 added more missing test cases from S03
jimmy authored
218 is(~@r, ~@e, "operator call on integer list elements");
219
245fd38 [t/spec] correct and fudge @array>>++ tests in hyper.t
moritz authored
220 (@r = (1, 4, 9)).»++;
f7dc0d5 added more missing test cases from S03
jimmy authored
221 is(~@r, ~@e, "operator call on integer list elements (Same thing, dot form)");
222
245fd38 [t/spec] correct and fudge @array>>++ tests in hyper.t
moritz authored
223 (@r = (1, 4, 9))».++;
47f2ea2 @sorear Fudge S03-metaops/hyper.t for niecza
sorear authored
224 @e = (2, 5, 10);
f7dc0d5 added more missing test cases from S03
jimmy authored
225 is(~@r, ~@e, "operator call on integer list elements (Same thing, dot form)");
226
245fd38 [t/spec] correct and fudge @array>>++ tests in hyper.t
moritz authored
227 (@r = (1, 4, 9)).».++;
f7dc0d5 added more missing test cases from S03
jimmy authored
228 is(~@r, ~@e, "operator call on integer list elements (Same thing, dot form)");
229
245fd38 [t/spec] correct and fudge @array>>++ tests in hyper.t
moritz authored
230 (@r = (1, 4, 9))\ .»\ .++;
47f2ea2 @sorear Fudge S03-metaops/hyper.t for niecza
sorear authored
231 @e = (2, 5, 10);
f7dc0d5 added more missing test cases from S03
jimmy authored
232 is(~@r, ~@e, "operator call on integer list elements (Same thing, upspace form)");
79583ce [t] moved operators/hyper.t to spec/
moritz authored
233 };
234
235 { # unary postfix again, but with a twist
236 my @r;
237 eval '@r = ("f", "oo", "bar")».chars';
238 my @e = (1, 2, 3);
239 is(~@r, ~@e, "method call on list elements");
240
7acf591 [/t/spec/S03-operators/hyper.t] added missing dot
jimmy authored
241 eval '@r = ("f", "oo", "bar").».chars';
f7dc0d5 added more missing test cases from S03
jimmy authored
242 @e = (1, 2, 3);
243 is(~@r, ~@e, "method call on list elements (Same thing, dot form)");
244
245
79583ce [t] moved operators/hyper.t to spec/
moritz authored
246 eval '@r = ("f", "oo", "bar")>>.chars';
247 @e = (1, 2, 3);
248 is(~@r, ~@e, "method call on list elements (ASCII)");
f7dc0d5 added more missing test cases from S03
jimmy authored
249
250 eval '@r = ("f", "oo", "bar").>>.chars';
251 @e = (1, 2, 3);
252 is(~@r, ~@e, "method call on list elements (ASCII, Same thing, dot form)");
253
79583ce [t] moved operators/hyper.t to spec/
moritz authored
254 };
255
256 { # unary postfix on a user-defined object
257 my $t;
57c1095 [t/spec] clean up hyper.t a bit, and fudge some tests for rakudo
moritz authored
258 class FooTest { method bar { 42 } }; $t = FooTest.new.bar;
79583ce [t] moved operators/hyper.t to spec/
moritz authored
259 is($t, 42, 'plain method call works OK');
260
261 my @r;
10f7c47 [hyper.t] dedup class
lwall authored
262 class FooTest2 { method bar { 42 } }; @r = (FooTest2.new)>>.bar;
79583ce [t] moved operators/hyper.t to spec/
moritz authored
263 my @e = (42);
b7e4ed5 [t/spec] Unfudge some parallel dispatch tests in S03-operators/hyper.t a...
jnthn authored
264 is(~@r, ~@e, "hyper-method-call on list of user-defined objects");
79583ce [t] moved operators/hyper.t to spec/
moritz authored
265 };
266
267 { # distribution for unary prefix
268 my @r;
269 @r = -« ([1, 2], [3, [4, 5]]);
270 my @e = ([-1, -2], [-3, [-4, -5]]);
05f901a [t/spec] some s/is_deeply/is/ in hyper.t. azawawi++ for noticing
moritz authored
271 is(~@r, ~@e, "distribution for unary prefix");
84d84f4 [t/spec] Refudging and tweaks for nested hyper.
colomon authored
272 is_deeply(@r, @e, "distribution for unary prefix, deep comparison");
79583ce [t] moved operators/hyper.t to spec/
moritz authored
273
274 @r = -<< ([1, 2], [3, [4, 5]]);
275 @e = ([-1, -2], [-3, [-4, -5]]);
05f901a [t/spec] some s/is_deeply/is/ in hyper.t. azawawi++ for noticing
moritz authored
276 is(~@r, ~@e, "distribution for unary prefix, ASCII");
84d84f4 [t/spec] Refudging and tweaks for nested hyper.
colomon authored
277 is_deeply(@r, @e, "distribution for unary prefix, ASCII, deep comparison");
79583ce [t] moved operators/hyper.t to spec/
moritz authored
278 };
279
280 { # distribution for unary postfix autoincrement
281 my @r;
282 @r = ([1, 2], [3, [4, 5]]);
84d84f4 [t/spec] Refudging and tweaks for nested hyper.
colomon authored
283 @r»++;
79583ce [t] moved operators/hyper.t to spec/
moritz authored
284 my @e = ([2, 3], [4, [5, 6]]);
7347a84 [t/spec] Change more Pugs todo flags to fudge commands
kyle authored
285 #?pugs todo
286 is(~@r, ~@e, "distribution for unary postfix autoincr");
84d84f4 [t/spec] Refudging and tweaks for nested hyper.
colomon authored
287 is_deeply(@r, @e, "distribution for unary postfix autoincr, deep comparison");
79583ce [t] moved operators/hyper.t to spec/
moritz authored
288
289 @r = ([1, 2], [3, [4, 5]]);
84d84f4 [t/spec] Refudging and tweaks for nested hyper.
colomon authored
290 @r>>++;
79583ce [t] moved operators/hyper.t to spec/
moritz authored
291 @e = ([2, 3], [4, [5, 6]]);
7347a84 [t/spec] Change more Pugs todo flags to fudge commands
kyle authored
292 #?pugs todo
293 is(~@r, ~@e, "distribution for unary postfix autoincr, ASCII");
84d84f4 [t/spec] Refudging and tweaks for nested hyper.
colomon authored
294 is_deeply(@r, @e, "distribution for unary postfix autoincr, ASCII, deep comparison");
79583ce [t] moved operators/hyper.t to spec/
moritz authored
295 };
296
0aedd5b [t/spec] Fudge hyper.t for Rakudo.
colomon authored
297 #?DOES 3
3159006 [t/spec] Correct some and unfudge some hyper spec tests.
jnthn authored
298 { # distribution for binary infix - ASCII
299 my @r;
300 @r = (1, 2, [3, 4]) >>+<< (4, 5, [6, 7]);
301 my @e = (5, 7, [9, 11]);
302 is(~@r, ~@e, "distribution for binary infix, same shape, ASCII");
4a30726 @Util Fix more typos.
Util authored
303 is_deeply(@r, @e, "distribution for binary infix, same shape, ASCII, deep comparison");
3159006 [t/spec] Correct some and unfudge some hyper spec tests.
jnthn authored
304
305 @r = (1, 2, [3, 4]) >>+>> (5, 6, 7);
306 @e = (6, 8, [10, 11]);
307 is(~@r, ~@e, "distribution for binary infix, dimension upgrade, ASCII");
84d84f4 [t/spec] Refudging and tweaks for nested hyper.
colomon authored
308 is_deeply(@r, @e, "distribution for binary infix, dimension upgrade, ASCII, deep comparison");
3159006 [t/spec] Correct some and unfudge some hyper spec tests.
jnthn authored
309
310 @r = ([1, 2], 3) <<+>> (4, [5, 6]);
311 @e = ([5, 6], [8, 9]);
312 is(~@r, ~@e, "distribution for binary infix, S03 cross-upgrade, ASCII");
84d84f4 [t/spec] Refudging and tweaks for nested hyper.
colomon authored
313 is_deeply(@r, @e, "distribution for binary infix, S03 cross-upgrade, ASCII, deep comparison");
3159006 [t/spec] Correct some and unfudge some hyper spec tests.
jnthn authored
314 };
315
316 #?DOES 3
317 { # distribution for binary infix - unicode
79583ce [t] moved operators/hyper.t to spec/
moritz authored
318 my @r;
319 @r = (1, 2, [3, 4]) »+« (4, 5, [6, 7]);
320 my @e = (5, 7, [9, 11]);
05f901a [t/spec] some s/is_deeply/is/ in hyper.t. azawawi++ for noticing
moritz authored
321 is(~@r, ~@e, "distribution for binary infix, same shape");
84d84f4 [t/spec] Refudging and tweaks for nested hyper.
colomon authored
322 is_deeply(@r, @e, "distribution for binary infix, same shape, deep comparison");
79583ce [t] moved operators/hyper.t to spec/
moritz authored
323
84d84f4 [t/spec] Refudging and tweaks for nested hyper.
colomon authored
324 @r = (1, 2, [3, 4]) »+» (5, 6, 7);
79583ce [t] moved operators/hyper.t to spec/
moritz authored
325 @e = (6, 8, [10, 11]);
05f901a [t/spec] some s/is_deeply/is/ in hyper.t. azawawi++ for noticing
moritz authored
326 is(~@r, ~@e, "distribution for binary infix, dimension upgrade");
84d84f4 [t/spec] Refudging and tweaks for nested hyper.
colomon authored
327 is_deeply(@r, @e, "distribution for binary infix, dimension upgrade, deep comparison");
79583ce [t] moved operators/hyper.t to spec/
moritz authored
328
84d84f4 [t/spec] Refudging and tweaks for nested hyper.
colomon authored
329 @r = ([1, 2], 3) «+» (4, [5, 6]);
79583ce [t] moved operators/hyper.t to spec/
moritz authored
330 @e = ([5, 6], [8, 9]);
05f901a [t/spec] some s/is_deeply/is/ in hyper.t. azawawi++ for noticing
moritz authored
331 is(~@r, ~@e, "distribution for binary infix, S03 cross-upgrade");
84d84f4 [t/spec] Refudging and tweaks for nested hyper.
colomon authored
332 is_deeply(@r, @e, "distribution for binary infix, S03 cross-upgrade, deep comparison");
79583ce [t] moved operators/hyper.t to spec/
moritz authored
333 };
334
335 { # regression test, ensure that hyper works on arrays
336 my @r1;
337 my @r2;
338 my @e1 = (2, 4, 6);
339 my @a = (1, 2, 3);
340 @r1 = @a >>+<< @a;
341 is(~@r1, ~@e1, "hyper op works on variables, too.");
57c1095 [t/spec] clean up hyper.t a bit, and fudge some tests for rakudo
moritz authored
342 }
343 {
344 my @a = (1, 2, 3);
345 my @e2 = (2, 3, 4);
3159006 [t/spec] Correct some and unfudge some hyper spec tests.
jnthn authored
346 my @r2 = @a >>+>> 1;
79583ce [t] moved operators/hyper.t to spec/
moritz authored
347 is(~@r2, ~@e2, "hyper op and correctly promotes scalars");
348 };
349
350
351 # mixed hyper and reduce metaops -
352 # this unveils a spec bug as << recurses into arrays and [+] never gets applied,
353 # so we disable the entire chunk for now.
efd5f21 @tadzik Remove pieces of invalid Pod
tadzik authored
354 =begin todo_unspecced
79583ce [t] moved operators/hyper.t to spec/
moritz authored
355
356 is ~([+]<< ([1,2,3], [4,5,6])), "6 15", "mixed hyper and reduce metaop ([+]<<) works";
357 ## XXX: Test for [+]<<<< - This is unspecced, commenting it out
358 #is ~([+]<<<< ([[1,2],[3,4]],[[5,6],[7,8]])), "3 7 11 15",
359 # "mixed double hyper and reduce metaop ([+]<<<<) works";
360
361 is ~([+]« [1,2,3], [4,5,6]), "6 15",
362 "mixed Unicode hyper and reduce metaop ([+]«) works";
363
efd5f21 @tadzik Remove pieces of invalid Pod
tadzik authored
364 =end todo_unspecced
79583ce [t] moved operators/hyper.t to spec/
moritz authored
365
05f901a [t/spec] some s/is_deeply/is/ in hyper.t. azawawi++ for noticing
moritz authored
366 #?pugs todo 'hyper ops'
7ad8b9d @sorear [S03-metaops/hyper] remove a lot of niecza fudges; rearrange the >>+++<<...
sorear authored
367 #?niecza skip 'does not work; recurses into hash'
1c7477c @sorear Add a few #?DOES to hyper.t and move it to done; for good measure
sorear authored
368 #?DOES 2
79583ce [t] moved operators/hyper.t to spec/
moritz authored
369 { # hyper dereferencing
370 my @array = (
371 { key => 'val' },
372 { key => 'val' },
373 { key => 'val' }
374 );
375
376 my $full = join '', eval '@array>>.<key>';
05f901a [t/spec] some s/is_deeply/is/ in hyper.t. azawawi++ for noticing
moritz authored
377 is($full, 'valvalval', 'hyper-dereference an array');
79583ce [t] moved operators/hyper.t to spec/
moritz authored
378
379 my $part = join '', eval '@array[0,1]>>.<key>';
05f901a [t/spec] some s/is_deeply/is/ in hyper.t. azawawi++ for noticing
moritz authored
380 is($part, 'valval', 'hyper-dereference an array slice');
79583ce [t] moved operators/hyper.t to spec/
moritz authored
381 }
382
57c1095 [t/spec] clean up hyper.t a bit, and fudge some tests for rakudo
moritz authored
383 #?pugs todo 'feature'
47f2ea2 @sorear Fudge S03-metaops/hyper.t for niecza
sorear authored
384 #?niecza skip 'junctions'
1c7477c @sorear Add a few #?DOES to hyper.t and move it to done; for good measure
sorear authored
385 #?DOES 4
79583ce [t] moved operators/hyper.t to spec/
moritz authored
386 { # junction hyper -- regression?
387 my @a = 1..3;
388 my @b = 4..6;
57c1095 [t/spec] clean up hyper.t a bit, and fudge some tests for rakudo
moritz authored
389 ok ?(@a »|« @b), '»|« hyperjunction evals';
390 ok ?(@a >>|<< @b), '>>|<< hyperjunction evals, ASCII';
391 ok ?(@a »&« @b), '»&« hyperjunction evals';
84d84f4 [t/spec] Refudging and tweaks for nested hyper.
colomon authored
392 ok ?(@a >>&<< @b), '>>&<< hyperjunction evals, ASCII';
79583ce [t] moved operators/hyper.t to spec/
moritz authored
393 }
8ba3aa4 [t/spec] Tests for symmetric cases of hyper operatorss on hashes.
jnthn authored
394
395 # test hypers on hashes
396 {
397 my %a = a => 1, b => 2, c => 3;
398 my %b = a => 5, b => 6, c => 7;
399 my %c = a => 1, b => 2;
400 my %d = a => 5, b => 6;
401
402 my %r;
403 %r = %a >>+<< %b;
404 is +%r, 3, 'hash - >>+<< result has right number of keys (same keys)';
1661645 @sorear Fix more typos.
sorear authored
405 is %r<a>, 6, 'hash - correct result from >>+<< (same keys)';
406 is %r<b>, 8, 'hash - correct result from >>+<< (same keys)';
407 is %r<c>, 10, 'hash - correct result from >>+<< (same keys)';
8ba3aa4 [t/spec] Tests for symmetric cases of hyper operatorss on hashes.
jnthn authored
408
ec15c52 [t/spec] Single-op hyper hash tests.
colomon authored
409 %r = %a »+« %d;
410 is +%r, 3, 'hash - »+« result has right number of keys (union test)';
1661645 @sorear Fix more typos.
sorear authored
411 is %r<a>, 6, 'hash - correct result from »+« (union test)';
412 is %r<b>, 8, 'hash - correct result from »+« (union test)';
413 is %r<c>, 3, 'hash - correct result from »+« (union test)';
8ba3aa4 [t/spec] Tests for symmetric cases of hyper operatorss on hashes.
jnthn authored
414
415 %r = %c >>+<< %b;
416 is +%r, 3, 'hash - >>+<< result has right number of keys (union test)';
1661645 @sorear Fix more typos.
sorear authored
417 is %r<a>, 6, 'hash - correct result from >>+<< (union test)';
418 is %r<b>, 8, 'hash - correct result from >>+<< (union test)';
419 is %r<c>, 7, 'hash - correct result from >>+<< (union test)';
8ba3aa4 [t/spec] Tests for symmetric cases of hyper operatorss on hashes.
jnthn authored
420
421 %r = %a <<+>> %b;
422 is +%r, 3, 'hash - <<+>> result has right number of keys (same keys)';
1661645 @sorear Fix more typos.
sorear authored
423 is %r<a>, 6, 'hash - correct result from <<+>> (same keys)';
424 is %r<b>, 8, 'hash - correct result from <<+>> (same keys)';
425 is %r<c>, 10, 'hash - correct result from <<+>> (same keys)';
8ba3aa4 [t/spec] Tests for symmetric cases of hyper operatorss on hashes.
jnthn authored
426
427 %r = %a <<+>> %d;
428 is +%r, 2, 'hash - <<+>> result has right number of keys (intersection test)';
1661645 @sorear Fix more typos.
sorear authored
429 is %r<a>, 6, 'hash - correct result from <<+>> (intersection test)';
430 is %r<b>, 8, 'hash - correct result from <<+>> (intersection test)';
8ba3aa4 [t/spec] Tests for symmetric cases of hyper operatorss on hashes.
jnthn authored
431
432 %r = %c <<+>> %b;
433 is +%r, 2, 'hash - <<+>> result has right number of keys (intersection test)';
1661645 @sorear Fix more typos.
sorear authored
434 is %r<a>, 6, 'hash - correct result from <<+>> (intersection test)';
435 is %r<b>, 8, 'hash - correct result from <<+>> (intersection test)';
b87c0d8 [t/spec] Tests for asymmetric variants of hypers on hashes.
jnthn authored
436
437 %r = %a >>+>> %c;
438 is +%r, 3, 'hash - >>+>> result has right number of keys';
439 is %r<a>, 2, 'hash - correct result from >>+>>';
440 is %r<b>, 4, 'hash - correct result from >>+>>';
441 is %r<c>, 3, 'hash - correct result from >>+>>';
442
443 %r = %c >>+>> %b;
444 is +%r, 2, 'hash - >>+>> result has right number of keys';
445 is %r<a>, 6, 'hash - correct result from >>+>>';
446 is %r<b>, 8, 'hash - correct result from >>+>>';
447
448 %r = %c <<+<< %a;
449 is +%r, 3, 'hash - <<+<< result has right number of keys';
450 is %r<a>, 2, 'hash - correct result from <<+<<';
451 is %r<b>, 4, 'hash - correct result from <<+<<';
452 is %r<c>, 3, 'hash - correct result from <<+<<';
453
454 %r = %b <<+<< %c;
455 is +%r, 2, 'hash - <<+<< result has right number of keys';
456 is %r<a>, 6, 'hash - correct result from <<+<<';
457 is %r<b>, 8, 'hash - correct result from <<+<<';
8ba3aa4 [t/spec] Tests for symmetric cases of hyper operatorss on hashes.
jnthn authored
458 }
5adc2df [t/spec] fix hyper as-latin-1 tests
moritz authored
459
ec15c52 [t/spec] Single-op hyper hash tests.
colomon authored
460 {
461 my %a = a => 1, b => 2, c => 3;
462 my %r = -<<%a;
463 is +%r, 3, 'hash - -<< result has right number of keys';
464 is %r<a>, -1, 'hash - correct result from -<<';
465 is %r<b>, -2, 'hash - correct result from -<<';
466 is %r<c>, -3, 'hash - correct result from -<<';
467
468 %r = --<<%a;
469 is +%r, 3, 'hash - --<< result has right number of keys';
470 is %r<a>, 0, 'hash - correct result from --<<';
471 is %r<b>, 1, 'hash - correct result from --<<';
472 is %r<c>, 2, 'hash - correct result from --<<';
473 is +%a, 3, 'hash - --<< result has right number of keys';
474 is %a<a>, 0, 'hash - correct result from --<<';
475 is %a<b>, 1, 'hash - correct result from --<<';
476 is %a<c>, 2, 'hash - correct result from --<<';
477
478 %r = %a>>++;
479 is +%r, 3, 'hash - >>++ result has right number of keys';
480 is %r<a>, 0, 'hash - correct result from >>++';
481 is %r<b>, 1, 'hash - correct result from >>++';
482 is %r<c>, 2, 'hash - correct result from >>++';
483 is +%a, 3, 'hash - >>++ result has right number of keys';
484 is %a<a>, 1, 'hash - correct result from >>++';
485 is %a<b>, 2, 'hash - correct result from >>++';
486 is %a<c>, 3, 'hash - correct result from >>++';
487 }
488
47f2ea2 @sorear Fudge S03-metaops/hyper.t for niecza
sorear authored
489 #?niecza skip 'our sub'
82ab11f @pmichaud Some hyper.t de-fudging.
pmichaud authored
490 #?rakudo skip 'nom regression: user-defined ops'
1c7477c @sorear Add a few #?DOES to hyper.t and move it to done; for good measure
sorear authored
491 #?DOES 4
ec15c52 [t/spec] Single-op hyper hash tests.
colomon authored
492 {
493 our sub postfix:<!>($a) {
494 [*] 1..$a;
495 }
496
497 my %a = a => 1, b => 2, c => 3;
498 my %r = %a>>!;
499 is +%r, 3, 'hash - >>! result has right number of keys';
500 is %r<a>, 1, 'hash - correct result from >>!';
501 is %r<b>, 2, 'hash - correct result from >>!';
502 is %r<c>, 6, 'hash - correct result from >>!';
503 }
504
e57d81e [t/spec] Tests for mixed hash / scalar hypers.
colomon authored
505 {
506 my %a = a => 1, b => 2, c => 3;
507
508 my %r = %a >>*>> 4;
509 is +%r, 3, 'hash - >>*>> result has right number of keys';
510 is %r<a>, 4, 'hash - correct result from >>*>>';
511 is %r<b>, 8, 'hash - correct result from >>*>>';
512 is %r<c>, 12, 'hash - correct result from >>*>>';
513
514 %r = 2 <<**<< %a ;
515 is +%r, 3, 'hash - <<**<< result has right number of keys';
516 is %r<a>, 2, 'hash - correct result from <<**<<';
517 is %r<b>, 4, 'hash - correct result from <<**<<';
518 is %r<c>, 8, 'hash - correct result from <<**<<';
519
520 %r = %a <<*>> 4;
521 is +%r, 3, 'hash - <<*>> result has right number of keys';
522 is %r<a>, 4, 'hash - correct result from <<*>>';
523 is %r<b>, 8, 'hash - correct result from <<*>>';
524 is %r<c>, 12, 'hash - correct result from <<*>>';
525
526 %r = 2 <<**>> %a ;
527 is +%r, 3, 'hash - <<**>> result has right number of keys';
528 is %r<a>, 2, 'hash - correct result from <<**>>';
529 is %r<b>, 4, 'hash - correct result from <<**>>';
530 is %r<c>, 8, 'hash - correct result from <<**>>';
531 }
5adc2df [t/spec] fix hyper as-latin-1 tests
moritz authored
532
cdd392f [t/spec] Add fudged test for >>. on hash.
colomon authored
533 #?rakudo skip '>>. NYI on hashes'
534 {
535 my %a = a => 1, b => -2, c => 3;
536 my %r = %a>>.abs;
537 is +%r, 3, 'hash - >>.abs result has right number of keys';
538 is %r<a>, 1, 'hash - correct result from >>.abs';
539 is %r<b>, 2, 'hash - correct result from >>.abs';
540 is %r<c>, 3, 'hash - correct result from >>.abs';
541 }
542
41b6853 [t/spec] Tests for hypers on arrays containing hashes.
colomon authored
543 {
544 my @a = (1, { a => 2, b => 3 }, 4);
545 my @b = <a b c>;
546 my @c = ('z', { a => 'y', b => 'x' }, 'w');
547 my @d = 'a'..'f';
548
549 my @r = @a <<~>> @b;
550 is +@r, 3, 'hash in array - result array is the correct length';
551 is @r[0], "1a", 'hash in array - correct result from <<~>>';
552 is @r[1]<a>, "2b", 'hash in array - correct result from <<~>>';
553 is @r[1]<b>, "3b", 'hash in array - correct result from <<~>>';
554 is @r[2], "4c", 'hash in array - correct result from <<~>>';
555
556 @r = @a >>~<< @c;
557 is +@r, 3, 'hash in array - result array is the correct length';
558 is @r[0], "1z", 'hash in array - correct result from >>~<<';
559 is @r[1]<a>, "2y", 'hash in array - correct result from >>~<<';
560 is @r[1]<b>, "3x", 'hash in array - correct result from >>~<<';
561 is @r[2], "4w", 'hash in array - correct result from >>~<<';
562
563 @r = @a >>~>> @d;
564 is +@r, 3, 'hash in array - result array is the correct length';
565 is @r[0], "1a", 'hash in array - correct result from >>~>>';
566 is @r[1]<a>, "2b", 'hash in array - correct result from >>~>>';
567 is @r[1]<b>, "3b", 'hash in array - correct result from >>~>>';
568 is @r[2], "4c", 'hash in array - correct result from >>~>>';
569
570 @r = @d <<R~<< @a;
571 is +@r, 3, 'hash in array - result array is the correct length';
572 is @r[0], "1a", 'hash in array - correct result from <<R~<<';
573 is @r[1]<a>, "2b", 'hash in array - correct result from <<R~<<';
574 is @r[1]<b>, "3b", 'hash in array - correct result from <<R~<<';
575 is @r[2], "4c", 'hash in array - correct result from <<R~<<';
576
577 @r = @a <<~>> @d;
578 is +@r, 6, 'hash in array - result array is the correct length';
579 is @r[0], "1a", 'hash in array - correct result from <<~>>';
580 is @r[1]<a>, "2b", 'hash in array - correct result from <<~>>';
581 is @r[1]<b>, "3b", 'hash in array - correct result from <<~>>';
582 is @r[2], "4c", 'hash in array - correct result from <<~>>';
583 is @r[3], "1d", 'hash in array - correct result from <<~>>';
584 is @r[4]<a>, "2e", 'hash in array - correct result from <<~>>';
585 is @r[4]<b>, "3e", 'hash in array - correct result from <<~>>';
586 is @r[5], "4f", 'hash in array - correct result from <<~>>';
587 }
588
589 {
590 my @a = (1, { a => 2, b => 3 }, 4);
591 my @b = <a b c>;
592 my @c = ('z', { a => 'y', b => 'x' }, 'w');
593 my @d = 'a'..'f';
594
595 my @r = @a «~» @b;
596 is +@r, 3, 'hash in array - result array is the correct length';
597 is @r[0], "1a", 'hash in array - correct result from «~»';
598 is @r[1]<a>, "2b", 'hash in array - correct result from «~»';
599 is @r[1]<b>, "3b", 'hash in array - correct result from «~»';
600 is @r[2], "4c", 'hash in array - correct result from «~»';
601
602 @r = @a »~« @c;
603 is +@r, 3, 'hash in array - result array is the correct length';
604 is @r[0], "1z", 'hash in array - correct result from »~«';
605 is @r[1]<a>, "2y", 'hash in array - correct result from »~«';
606 is @r[1]<b>, "3x", 'hash in array - correct result from »~«';
607 is @r[2], "4w", 'hash in array - correct result from »~«';
608
609 @r = @a »~» @d;
610 is +@r, 3, 'hash in array - result array is the correct length';
611 is @r[0], "1a", 'hash in array - correct result from »~»';
612 is @r[1]<a>, "2b", 'hash in array - correct result from »~»';
613 is @r[1]<b>, "3b", 'hash in array - correct result from »~»';
614 is @r[2], "4c", 'hash in array - correct result from »~»';
615
616 @r = @d «R~« @a;
617 is +@r, 3, 'hash in array - result array is the correct length';
618 is @r[0], "1a", 'hash in array - correct result from «R~«';
619 is @r[1]<a>, "2b", 'hash in array - correct result from «R~«';
620 is @r[1]<b>, "3b", 'hash in array - correct result from «R~«';
621 is @r[2], "4c", 'hash in array - correct result from «R~«';
622
623 @r = @a «~» @d;
624 is +@r, 6, 'hash in array - result array is the correct length';
625 is @r[0], "1a", 'hash in array - correct result from «~»';
626 is @r[1]<a>, "2b", 'hash in array - correct result from «~»';
627 is @r[1]<b>, "3b", 'hash in array - correct result from «~»';
628 is @r[2], "4c", 'hash in array - correct result from «~»';
629 is @r[3], "1d", 'hash in array - correct result from «~»';
630 is @r[4]<a>, "2e", 'hash in array - correct result from «~»';
631 is @r[4]<b>, "3e", 'hash in array - correct result from «~»';
632 is @r[5], "4f", 'hash in array - correct result from «~»';
633 }
634
60d1184 [t/spec] Tests for prefix and postfix array hypers with nested hashes.
colomon authored
635 {
636 my @a = (1, { a => 2, b => 3 }, 4);
637 my @r = -<<@a;
638 is +@r, 3, 'hash in array - result array is the correct length';
639 is @r[0], -1, 'hash in array - correct result from -<<';
640 is @r[1]<a>, -2, 'hash in array - correct result from -<<';
641 is @r[1]<b>, -3, 'hash in array - correct result from -<<';
642 is @r[2], -4, 'hash in array - correct result from -<<';
643
644 @r = ++<<@a;
645 is +@r, 3, 'hash in array - result array is the correct length';
646 is @r[0], 2, 'hash in array - correct result from ++<<';
647 is @r[1]<a>, 3, 'hash in array - correct result from ++<<';
648 is @r[1]<b>, 4, 'hash in array - correct result from ++<<';
649 is @r[2], 5, 'hash in array - correct result from ++<<';
650
651 @r = @a>>--;
652 is +@r, 3, 'hash in array - result array is the correct length';
653 is @r[0], 2, 'hash in array - correct result from ++<<';
654 is @r[1]<a>, 3, 'hash in array - correct result from ++<<';
655 is @r[1]<b>, 4, 'hash in array - correct result from ++<<';
656 is @r[2], 5, 'hash in array - correct result from ++<<';
657 is +@a, 3, 'hash in array - result array is the correct length';
658 is @a[0], 1, 'hash in array - correct result from ++<<';
659 is @a[1]<a>, 2, 'hash in array - correct result from ++<<';
660 is @a[1]<b>, 3, 'hash in array - correct result from ++<<';
661 is @a[2], 4, 'hash in array - correct result from ++<<';
662 }
663
664 {
665 my @a = (1, { a => 2, b => 3 }, 4);
666 my @r = -«@a;
667 is +@r, 3, 'hash in array - result array is the correct length';
668 is @r[0], -1, 'hash in array - correct result from -«';
669 is @r[1]<a>, -2, 'hash in array - correct result from -«';
670 is @r[1]<b>, -3, 'hash in array - correct result from -«';
671 is @r[2], -4, 'hash in array - correct result from -«';
672
673 @r = ++«@a;
674 is +@r, 3, 'hash in array - result array is the correct length';
675 is @r[0], 2, 'hash in array - correct result from ++«';
676 is @r[1]<a>, 3, 'hash in array - correct result from ++«';
677 is @r[1]<b>, 4, 'hash in array - correct result from ++«';
678 is @r[2], 5, 'hash in array - correct result from ++«';
679
680 @r = @a»--;
681 is +@r, 3, 'hash in array - result array is the correct length';
682 is @r[0], 2, 'hash in array - correct result from ++«';
683 is @r[1]<a>, 3, 'hash in array - correct result from ++«';
684 is @r[1]<b>, 4, 'hash in array - correct result from ++«';
685 is @r[2], 5, 'hash in array - correct result from ++«';
686 is +@a, 3, 'hash in array - result array is the correct length';
687 is @a[0], 1, 'hash in array - correct result from ++«';
688 is @a[1]<a>, 2, 'hash in array - correct result from ++«';
689 is @a[1]<b>, 3, 'hash in array - correct result from ++«';
690 is @a[2], 4, 'hash in array - correct result from ++«';
691 }
41b6853 [t/spec] Tests for hypers on arrays containing hashes.
colomon authored
692
5adc2df [t/spec] fix hyper as-latin-1 tests
moritz authored
693 # test non-UTF-8 input
47f2ea2 @sorear Fudge S03-metaops/hyper.t for niecza
sorear authored
694 #?niecza skip 'nonsensical test'
5adc2df [t/spec] fix hyper as-latin-1 tests
moritz authored
695 #?pugs skip 'eval(Buf)'
696 #?rakudo skip 'eval(Buf)'
01ba23e [t/spec] fudge gets confused with some tests counts, so add a #?DOES lin...
moritz authored
697 #?DOES 1
5adc2df [t/spec] fix hyper as-latin-1 tests
moritz authored
698 {
699 my $t = '(1, 2, 3) »+« (4, 3, 2)';
700 ok !eval($t.encode('ISO-8859-1')),
701 'Latin-1 »+« without pre-declaration is an error';
702 }
703
c941342 [hyper.t] Added a test for a bug fixed in Rakudo f0e270f.
Kodi Arfer authored
704 # Test for 'my @a = <a b c> »~» "z";' wrongly
705 # setting @a to [['az', 'bz', 'cz']].
706 {
707 my @a = <a b c> »~» 'z';
708 is "{@a[0]}, {@a[1]}, {@a[2]}", 'az, bz, cz', "dwimmy hyper doesn't return an itemized list";
709 }
710
53704ce [t/spec/S03-operators/series*.t] Deleted redundant tests, reorganized an...
Kodi authored
711 # L<S03/"Hyper operators"/is assumed to be infinitely extensible>
82ab11f @pmichaud Some hyper.t de-fudging.
pmichaud authored
712 #?rakudo skip 'nom regression - whatever extension'
0c47be1 [t/spec] Fudge hyper.t to work in Rakudo again.
colomon authored
713 {
714 @r = <A B C D E> »~» (1, 2, 3, *);
715 @e = <A1 B2 C3 D3 E3>;
716 is ~@r, ~@e, 'dwimmy hyper extends lists ending with * by copying the last element';
1e8a059 [t/spec] Add a few more tests for hypers and ", *".
colomon authored
717
718 @r = <A B C D E> «~» (1, 2, 3, *);
719 @e = <A1 B2 C3 D3 E3>;
720 is ~@r, ~@e, 'dwimmy hyper extends lists ending with * by copying the last element';
721
722 @r = (1, 2, 3, *) «~« <A B C D E>;
723 @e = <1A 2B 3C 3D 3E>;
724 is ~@r, ~@e, 'dwimmy hyper extends lists ending with * by copying the last element';
725
726 @r = (1, 2, 3, *) «~» <A B C D E>;
727 @e = <1A 2B 3C 3D 3E>;
728 is ~@r, ~@e, 'dwimmy hyper extends lists ending with * by copying the last element';
f471cc0 [hyper.t] Tests for RT #77876.
Kodi Arfer authored
729
730 @r = (1, 2, *) «~» (4, 5, *);
731 @e = <14 25>;
732 is ~@r, ~@e, 'dwimmy hyper omits * when both arguments of same length have one';
733
734 @r = (1, 2, *) «~» (4, 5, 6, *);
735 @e = <14 25 26>;
736 is ~@r, ~@e, 'dwimmy hyper takes longer length given two arguments ending with *';
0c47be1 [t/spec] Fudge hyper.t to work in Rakudo again.
colomon authored
737 }
53704ce [t/spec/S03-operators/series*.t] Deleted redundant tests, reorganized an...
Kodi authored
738
bf4ca71 [t/spec] Added test for RT 77010 use hypers with local scoped user defin...
radus authored
739 # RT #77010
740
741 #?rakudo skip 'RT 77010 - use hypers with local scoped user-defined operators'
742 {
7ad8b9d @sorear [S03-metaops/hyper] remove a lot of niecza fudges; rearrange the >>+++<<...
sorear authored
743 # niecza doesn't propagate slangs into &eval yet
744 eval_lives_ok 'sub infix:<+++>($a, $b) { ($a + $b) div 2 }; 10 >>+++<< 14', 'can use hypers with local scoped user-defined operators';
bf4ca71 [t/spec] Added test for RT 77010 use hypers with local scoped user defin...
radus authored
745 }
746
7c91846 [t/spec] test for RT #74530, hyper ops and ranges should mix
moritz authored
747 # RT #74530
748 {
71fdf1d [hyper.t] Added tests for RT #77800.
Kodi Arfer authored
749 is ~(-<<(1..3)), '-1 -2 -3', 'ranges and hyper ops mix';
750 }
751
752 # RT #77800
753 # Parsing hyper-subtraction
754 {
755 is ((9, 8) <<-<< (1, 2, 3, 4)), (8, 6, 6, 4), '<<-<<';
756 is ((9, 8, 10, 12) >>->> (1, 2)), (8, 6, 9, 10), '>>->>';
757 is ((9, 8) >>-<< (1, 2)), (8, 6), '>>-<<';
758 is ((9, 8) <<->> (1, 2, 5)), (8, 6, 4), '<<->>';
7c91846 [t/spec] test for RT #74530, hyper ops and ranges should mix
moritz authored
759 }
760
f471cc0 [hyper.t] Tests for RT #77876.
Kodi Arfer authored
761 # RT #77876
762 # L<S03/Hyper operators/'@array »+=»'>
763 # Hyper assignment operators
47f2ea2 @sorear Fudge S03-metaops/hyper.t for niecza
sorear authored
764 #?niecza skip 'fails horribly'
82ab11f @pmichaud Some hyper.t de-fudging.
pmichaud authored
765 #?rakudo skip 'nom regression -- cannot assign to readonly'
f471cc0 [hyper.t] Tests for RT #77876.
Kodi Arfer authored
766 {
767 my @array = 3, 8, 2, 9, 3, 8;
768 @r = @array »+=« (1, 2, 3, 4, 5, 6);
769 @e = 4, 10, 5, 13, 8, 14;
770 is @r, @e, '»+=« returns the right value';
771 is @array, @e, '»+=« changes its lvalue';
772
773 @array = 3, 8, 2, 9, 3, 8;
774 @r = @array »*=» (1, 2, 3);
775 @e = 3, 16, 6, 9, 6, 24;
776 is @r, @e, '»*=» returns the right value';
777 is @array, @e, '»*=» changes its lvalue';
778
779 my $a = 'apple';
780 my $b = 'blueberry';
781 my $c = 'cherry';
782 @r = ($a, $b, $c) »~=» <pie tart>;
783 @e = <applepie blueberrytart cherrypie>;
784 is @r, @e, '»~=» with list of scalars on the left returns the right value';
785 my $e = 'applepie, blueberrytart, cherrypie';
786 is "$a, $b, $c", $e, '»~=» changes each scalar';
787 }
788
e76dd4c @moritz s/done_testing/done/ as per recent S24 changes
moritz authored
789 done;
0aedd5b [t/spec] Fudge hyper.t for Rakudo.
colomon authored
790
5adc2df [t/spec] fix hyper as-latin-1 tests
moritz authored
791 # vim: ft=perl6
Something went wrong with that request. Please try again.