Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 101 lines (77 sloc) 3.156 kB
9096947 [t/spec] Create zip-metaop.t to test the new Zop.
colomon authored
1 use v6;
2
3 use Test;
eed14ff @TimToady add tests for [Z] and [Z<] on indirect lols
TimToady authored
4 plan 31;
9096947 [t/spec] Create zip-metaop.t to test the new Zop.
colomon authored
5
bb5077a @FROGGS eval => EVAL in S03 and S04
FROGGS authored
6 ok EVAL('<a b> Z <c d>'), 'zip non-meta operator parses';
9096947 [t/spec] Create zip-metaop.t to test the new Zop.
colomon authored
7
665a134 Additions and unfudging for arguments ending with * to hypers and zips.
Kodi Arfer authored
8 is (<a b> Z <1 2>), <a 1 b 2>, 'non-meta zip produces expected result';
9096947 [t/spec] Create zip-metaop.t to test the new Zop.
colomon authored
9
da0c6f2 [t/spec] Improve descriptions for zip-metaop tests a bit.
colomon authored
10 is (1, 2, 3 Z** 2, 4), (1, 16), 'zip-power works';
9096947 [t/spec] Create zip-metaop.t to test the new Zop.
colomon authored
11
bb5077a @FROGGS eval => EVAL in S03 and S04
FROGGS authored
12 ok EVAL('<a b> Z, <c d>'), 'zip metaoperator parses';
9096947 [t/spec] Create zip-metaop.t to test the new Zop.
colomon authored
13
14 is (<a b> Z~ <1 2>), <a1 b2>, 'zip-concat produces expected result';
15
16 is (1,2 Z* 3,4), (3,8), 'zip-product works';
17
3a5af16 @lizmat Increase/Decrease -> Less/More migration
lizmat authored
18 is (1,2 Zcmp 3,2,0), (Order::Less, Order::Same), 'zip-cmp works';
9096947 [t/spec] Create zip-metaop.t to test the new Zop.
colomon authored
19
20 # tests for laziness
9e9686f [t/spec] replace .batch($x) with .[^$x]
moritz authored
21 is (1..* Z** 1..*).[^5], (1**1, 2**2, 3**3, 4**4, 5**5), 'zip-power with lazy lists';
22 is (1..* Z+ (3, 2 ... *)).[^5], (1+3, 2+2, 3+1, 4+0, 5-1), 'zip-plus with lazy lists';
9096947 [t/spec] Create zip-metaop.t to test the new Zop.
colomon authored
23
6397bb6 [t/spec] Tests for Xop and Zop which only have a single scalar on one…
colomon authored
24 # tests for non-list arguments
25 is (1 Z* 3,4), (3), 'zip-product works with scalar left side';
26 is (1, 2 Z* 3), (3), 'zip-product works with scalar right side';
27 is (1 Z* 3), (3), 'zip-product works with scalar both sides';
28
53704ce [t/spec/S03-operators/series*.t] Deleted redundant tests, reorganized…
Kodi authored
29 # L<S03/"Hyper operators"/is assumed to be infinitely extensible>
665a134 Additions and unfudging for arguments ending with * to hypers and zips.
Kodi Arfer authored
30
8b6048b @moritz Revert "Remove # chars from fudge messages"
moritz authored
31 #?rakudo todo 'nom regression RT #122230'
db85667 @coke reflect current rakudo/nom state
coke authored
32 {
e8eb581 @coke niecza fudging
coke authored
33 #?niecza todo
665a134 Additions and unfudging for arguments ending with * to hypers and zips.
Kodi Arfer authored
34 is (<a b c d> Z 'x', 'z', *), <a x b z c z d z>, 'non-meta zip extends right argument ending with *';
e8eb581 @coke niecza fudging
coke authored
35 #?niecza todo
665a134 Additions and unfudging for arguments ending with * to hypers and zips.
Kodi Arfer authored
36 is (1, 2, 3, * Z 10, 20, 30, 40, 50),
37 (1, 10, 2, 20, 3, 30, 3, 40, 3, 50), 'non-meta zip extends left argument ending with *';
e8eb581 @coke niecza fudging
coke authored
38 #?niecza skip 'Unable to resolve method munch in class List'
665a134 Additions and unfudging for arguments ending with * to hypers and zips.
Kodi Arfer authored
39 is (2, 10, * Z 3, 4, 5, *).munch(10),
40 (2, 3, 10, 4, 10, 5, 10, 5, 10, 5),
41 'non-meta zip extends two arguments ending with *';
e8eb581 @coke niecza fudging
coke authored
42 #?niecza todo
665a134 Additions and unfudging for arguments ending with * to hypers and zips.
Kodi Arfer authored
43 is (<a b c d> Z~ 'x', 'z', *), <ax bz cz dz>, 'zip-concat extends right argument ending with *';
db85667 @coke reflect current rakudo/nom state
coke authored
44 }
45
8b6048b @moritz Revert "Remove # chars from fudge messages"
moritz authored
46 #?rakudo skip 'nom regression RT #122230'
e8eb581 @coke niecza fudging
coke authored
47 #?niecza skip 'Cannot use value like Whatever as a number'
db85667 @coke reflect current rakudo/nom state
coke authored
48 {
665a134 Additions and unfudging for arguments ending with * to hypers and zips.
Kodi Arfer authored
49 is (1, 2, 3, * Z+ 10, 20, 30, 40, 50), (11, 22, 33, 43, 53), 'zip-plus extends left argument ending with *';
50 is (2, 10, * Z* 3, 4, 5, *).munch(5),
51 (6, 40, 50, 50, 50), 'zip-product extends two arguments ending with *';
db85667 @coke reflect current rakudo/nom state
coke authored
52 }
53704ce [t/spec/S03-operators/series*.t] Deleted redundant tests, reorganized…
Kodi authored
53
e8eb581 @coke niecza fudging
coke authored
54 #?niecza todo
37d1b61 @moritz test [Z+] (RT #92652)
moritz authored
55 {
13d65fe @TimToady list infix reductions no longer flatten
TimToady authored
56 is join(',', [Z+] (1, 2), (20, 10), (100, 200)),
57 '121,212', '[Z+] with three lists';
37d1b61 @moritz test [Z+] (RT #92652)
moritz authored
58 }
59
64bc53d @moritz test that infix Z returns a list of parcels (RT #75818
moritz authored
60 # RT #75818
bb0a8fa @lizmat Use isa-ok instead of isa_ok
lizmat authored
61 isa-ok (1 Z 2)[0], Parcel, 'zip returns a list of parcels';
9ab47bb @pmichaud Add tests for proper list associativity with Z, (RT #113800).
pmichaud authored
62
63 # RT #113800 - multiple Z operators work with list associative
f3372db @colomon Fudge for Niecza.
colomon authored
64 #?niecza skip "Unable to resolve method lol in type Parcel"
64bc53d @moritz test that infix Z returns a list of parcels (RT #75818
moritz authored
65 {
9ab47bb @pmichaud Add tests for proper list associativity with Z, (RT #113800).
pmichaud authored
66 my $l = (1,2,3 Z, 4,5,6 Z, 7,8,9);
67 is $l.[0].lol.elems, 3, 'Z, retains list associativity';
68 is $l.[1].lol.elems, 3, 'Z, retains list associativity';
69 is $l.[2].lol.elems, 3, 'Z, retains list associativity';
64bc53d @moritz test that infix Z returns a list of parcels (RT #75818
moritz authored
70 }
60042a9 @moritz RT #73948: Z, flattens in list context
moritz authored
71
72 # RT #73948
5da4536 @lizmat /._join/.flat.join/
lizmat authored
73 is (1, 2 Z, 3, 4).flat.join('|'), '1|3|2|4', 'Z, flattens in list context';
9096947 [t/spec] Create zip-metaop.t to test the new Zop.
colomon authored
74
5f9f92c @TimToady test that Zop= and Xop= work
TimToady authored
75 {
76 my @a = 1,2,3;
77 @a Z+= 3,2,1;
78 is ~@a, '4 4 4', 'zip can modify containers on the left'
79 }
80
42c8533 @FROGGS RT #116036 test for <a b> Z=> []
FROGGS authored
81 # RT #116036
82 {
83 is (<a b> Z=> []), (a => []), 'zip does not flatten itemized list';
84 }
85
3f00b5b @peschwa Add tests for RT #77114 and related cases.
peschwa authored
86 # RT #77114
87 {
0cbc065 @lizmat s/eval_dies_ok/eval-dies-ok/g
lizmat authored
88 eval-dies-ok 'my @a Z= 1,2,3', "zip doesn't handle assignment";
3f00b5b @peschwa Add tests for RT #77114 and related cases.
peschwa authored
89 }
eed14ff @TimToady add tests for [Z] and [Z<] on indirect lols
TimToady authored
90
91 {
92 is [Z](1,2,3;4,5,6;7,8,9), '1 4 7 2 5 8 3 6 9', 'can reduce-zip a direct lol';
93 is [Z<](1,2,3;4,5,6;7,8,9), 'True True True', 'can reduce-zip-< a direct lol';
94
95 my \lol = ((1..*),(4..6),(7..*));
96 is [Z](|lol), '1 4 7 2 5 8 3 6 9', 'can reduce-zip an indirect lol';
97 is [Z<](|lol), 'True True True', 'can reduce-zip-< an indirect lol';
98 }
99
9096947 [t/spec] Create zip-metaop.t to test the new Zop.
colomon authored
100 # vim: ft=perl6
Something went wrong with that request. Please try again.