@@ -65,93 +65,37 @@ sub gen_hash {
65
65
{
66
66
my @ a = gen_array;
67
67
is @ a . elems , 10 , " basic sanity" ;
68
- } # 1
69
-
70
- { # single element
71
- my @ a = gen_array;
72
- my $ b = @ a [3 ];
73
-
74
- # ?pugs 3 skip "no adverbials"
75
- # ?niecza 3 skip "no adverbials"
76
- is @ a [3 ]: delete, $ b , " Test for delete single element" ;
77
- # ?rakudo todo "not being destructively read yet"
78
- is @ a [3 ], $ default , " 3 should be deleted now" ;
79
- is + @ a , 10 , " array still has same length" ;
80
-
81
- # ?pugs 11 skip "no adverbials"
82
- # ?niecza 11 skip "no adverbials"
83
- my $ c = @ a [9 ];
84
- is @ a [9 ]:! delete , $ c , " Test non-deletion with ! single elem" ;
85
- is @ a [9 ], $ c , " 9 should not have been deleted" ;
86
- is @ a [9 ]: delete(0 ), $ c , " Test non-deletion with (0) single elem" ;
87
- is @ a [9 ], $ c , " 9 should not have been deleted" ;
88
- is @ a [9 ]: delete(False ), $ c , " Test non-deletion with (False) single elem" ;
89
- is @ a [9 ], $ c , " 9 should not have been deleted" ;
90
- is @ a [9 ]: delete($ dont ), $ c , " Test non-deletion with (\$dont) single elem" ;
91
- is @ a [9 ], $ c , " 9 should not have been deleted" ;
92
- is @ a [9 ]: delete(1 ), $ c , " Test deletion with (1) single elem" ;
93
- # ?rakudo 2 todo "not being destructively read yet"
94
- is @ a [9 ], $ default , " 9 should be deleted now" ;
95
- is + @ a , 9 , " array should be shortened now" ;
96
- } # 14
97
-
98
- { # multiple elements
99
- my @ a = gen_array;
100
- my @ b = @ a [1 ,3 ];
101
-
102
- # ?pugs 3 skip "no adverbials"
103
- # ?niecza 3 skip "no adverbials"
104
- is @ a [1 ,3 ]: delete, @ b , " Test for delete multiple elements" ;
105
- # ?rakudo todo "not being destructively read yet"
106
- is @ a [1 ,3 ], $ default , " 1 3 should be deleted now" ;
107
- is + @ a , 10 , " 1 3 should be deleted now" ;
108
-
109
- # ?pugs 11 skip "no adverbials"
110
- # ?niecza 11 skip "no adverbials"
111
- my @ c = @ a [2 ,4 ,9 ];
112
- is @ a [2 ,4 ,9 ]:! delete , @ c , " Test non-deletion with ! multiple" ;
113
- is @ a [2 ,4 ,9 ], @ c , " 2 4 9 should not have been deleted" ;
114
- is @ a [2 ,4 ,9 ]: delete(0 ), @ c , " Test non-deletion with (0) multiple" ;
115
- is @ a [2 ,4 ,9 ], @ c , " 2 4 9 should not have been deleted" ;
116
- is @ a [2 ,4 ,9 ]: delete(False ), @ c , " Test non-deletion with (False) multiple" ;
117
- is @ a [2 ,4 ,9 ], @ c , " 2 4 9 should not have been deleted" ;
118
- is @ a [2 ,4 ,9 ]: delete($ dont ), @ c , " Test non-deletion with (\$dont) multiple" ;
119
- is @ a [2 ,4 ,9 ], @ c , " 2 4 9 should not have been deleted" ;
120
- is @ a [2 ,4 ,9 ]: delete(1 ), @ c , " Test deletion with (1) multiple" ;
121
- # ?rakudo 2 todo "not being destructively read yet"
122
- ok ! any (@ a [2 ,4 ,9 ]), " 2 4 9 should be deleted now" ;
123
- is + @ a , 9 , " array should be shortened now" ;
124
- } # 14
125
-
126
- { # whatever
127
- my @ a = gen_array;
128
- my @ all = @ a [^ 10 ];
129
68
130
69
# ?pugs 2 skip "no adverbials"
131
70
# ?niecza 2 skip "no adverbials"
132
- is @ a [* ]: delete, @ all , " Test deletion with whatever" ;
133
- # ?rakudo todo "not being destructively read yet"
134
- is + @ a , 0 , " * should be deleted now" ;
135
- } # 2
136
-
137
- {
138
- my @ a = gen_array;
139
- my @ all = @ a [^ 10 ];
71
+ ok @ a [3 ]: exists , " Test for exists single element" ;
72
+ ok ! (@ a [10 ]: exists ), " Test for non-exists single element" ;
140
73
141
74
# ?pugs 10 skip "no adverbials"
142
75
# ?niecza 10 skip "no adverbials"
143
- is @ a [* ]:! delete , @ all , " Test non-deletion with ! whatever" ;
144
- is + @ a , 10 , " * should not be deleted now" ;
145
- is @ a [* ]: delete(0 ), @ all , " Test non-deletion with (0) whatever" ;
146
- is + @ a , 10 , " * should not be deleted now" ;
147
- is @ a [* ]: delete(False ), @ all , " Test non-deletion with (False) whatever" ;
148
- is + @ a , 10 , " * should not be deleted now" ;
149
- is @ a [* ]: delete($ dont ), @ all , " Test non-deletion with (\$dont) whatever" ;
150
- is + @ a , 10 , " * should not be deleted now" ;
151
- is @ a [* ]: delete(1 ), @ all , " Test deletion with (1) whatever" ;
152
- # ?rakudo todo "not being destructively read yet"
153
- is + @ a , 0 , " * should be deleted now" ;
154
- } # 10
76
+ ok @ a [9 ]:! exists , " Test non-exists with ! single elem 9" ;
77
+ ok ! (@ a [10 ]:! exists ), " Test non-exists with ! single elem 10" ;
78
+ ok @ a [9 ]: exists (0 ), " Test non-exists with (0) single elem 9" ;
79
+ ok ! (@ a [10 ]: exists (0 )), " Test non-exists with (0) single elem 10" ;
80
+ ok @ a [9 ]: exists (False ), " Test non-exists with (False) single elem 9" ;
81
+ ok ! (@ a [10 ]: exists (False )), " Test non-exists with (False) single elem 10" ;
82
+ ok @ a [9 ]: exists ($ dont ), " Test non-exists with (\$dont) single elem 9" ;
83
+ ok ! (@ a [10 ]: exists ($ dont )), " Test non-exists with (\$dont) single elem 10" ;
84
+ ok @ a [9 ]: exists (1 ), " Test exists with (1) single elem 9" ;
85
+ ok ! (@ a [10 ]: exists (1 )), " Test exists with (1) single elem 10" ;
86
+
87
+ # ?pugs 6 skip "no adverbials"
88
+ # ?rakudo 6 skip "oh noes, it dies"
89
+ is @ a [1 ,2 ,4 ]: exists , (True , True , True ), " Test for exists TTT" ;
90
+ is @ a [1 ,2 ,10 ]: exists , (True , True , False ), " Test for exists TTF" ;
91
+ is @ a1 [* ]>: exists , (True xx 26 ), " Test for non-exists T*" ;
92
+ # ?niezca 3 todo "adverbial pairs only used as True"
93
+ is @ a [1 ,2 ,4 ]:! exists , (False ,False ,False ), " Test for non-exists FFF" ;
94
+ is @ a [1 ,2 ,10 ]:! exists , (False ,False ,True ), " Test for non-exists FFT" ;
95
+ is % h1 [* ]>:! exists , (False xx 26 ), " Test for non-exists F*" ;
96
+
97
+ is + @ a , 10 , " * should be deleted now" ;
98
+ } # 20
155
99
156
100
# -------------------------------------------------------------------------------
157
101
# Scalar
0 commit comments