@@ -193,19 +193,27 @@ quickcheck! {
193
193
}
194
194
195
195
fn duplicates( v: Vec <u8 >) -> ( ) {
196
- test_specializations( & v. iter( ) . duplicates( ) ) ;
196
+ let it = v. iter( ) . duplicates( ) ;
197
+ test_specializations( & it) ;
198
+ test_double_ended_specializations( & it) ;
197
199
}
198
200
199
201
fn duplicates_by( v: Vec <u8 >) -> ( ) {
200
- test_specializations( & v. iter( ) . duplicates_by( |x| * x % 10 ) ) ;
202
+ let it = v. iter( ) . duplicates_by( |x| * x % 10 ) ;
203
+ test_specializations( & it) ;
204
+ test_double_ended_specializations( & it) ;
201
205
}
202
206
203
207
fn unique( v: Vec <u8 >) -> ( ) {
204
- test_specializations( & v. iter( ) . unique( ) ) ;
208
+ let it = v. iter( ) . unique( ) ;
209
+ test_specializations( & it) ;
210
+ test_double_ended_specializations( & it) ;
205
211
}
206
212
207
213
fn unique_by( v: Vec <u8 >) -> ( ) {
208
- test_specializations( & v. iter( ) . unique_by( |x| * x % 50 ) ) ;
214
+ let it = v. iter( ) . unique_by( |x| * x % 50 ) ;
215
+ test_specializations( & it) ;
216
+ test_double_ended_specializations( & it) ;
209
217
}
210
218
211
219
fn take_while_inclusive( v: Vec <u8 >) -> ( ) {
@@ -218,19 +226,25 @@ quickcheck! {
218
226
219
227
fn pad_using( v: Vec <u8 >) -> ( ) {
220
228
use std:: convert:: TryFrom ;
221
- test_specializations( & v. iter( ) . copied( ) . pad_using( 10 , |i| u8 :: try_from( 5 * i) . unwrap_or( u8 :: MAX ) ) ) ;
229
+ let it = v. iter( ) . copied( ) . pad_using( 10 , |i| u8 :: try_from( 5 * i) . unwrap_or( u8 :: MAX ) ) ;
230
+ test_specializations( & it) ;
231
+ test_double_ended_specializations( & it) ;
222
232
}
223
233
224
234
fn with_position( v: Vec <u8 >) -> ( ) {
225
235
test_specializations( & v. iter( ) . with_position( ) ) ;
226
236
}
227
237
228
238
fn positions( v: Vec <u8 >) -> ( ) {
229
- test_specializations( & v. iter( ) . positions( |x| x % 5 == 0 ) ) ;
239
+ let it = v. iter( ) . positions( |x| x % 5 == 0 ) ;
240
+ test_specializations( & it) ;
241
+ test_double_ended_specializations( & it) ;
230
242
}
231
243
232
244
fn update( v: Vec <u8 >) -> ( ) {
233
- test_specializations( & v. iter( ) . copied( ) . update( |x| * x = x. wrapping_mul( 7 ) ) ) ;
245
+ let it = v. iter( ) . copied( ) . update( |x| * x = x. wrapping_mul( 7 ) ) ;
246
+ test_specializations( & it) ;
247
+ test_double_ended_specializations( & it) ;
234
248
}
235
249
236
250
fn tuple_combinations( v: Vec <u8 >) -> TestResult {
@@ -284,16 +298,19 @@ quickcheck! {
284
298
}
285
299
286
300
fn zip_longest( a: Vec <u8 >, b: Vec <u8 >) -> ( ) {
287
- test_specializations( & a. into_iter( ) . zip_longest( b) )
301
+ let it = a. into_iter( ) . zip_longest( b) ;
302
+ test_specializations( & it) ;
303
+ test_double_ended_specializations( & it) ;
288
304
}
289
305
290
306
fn zip_eq( a: Vec <u8 >) -> ( ) {
291
307
test_specializations( & a. iter( ) . zip_eq( a. iter( ) . rev( ) ) )
292
308
}
293
309
294
310
fn multizip( a: Vec <u8 >) -> ( ) {
295
- let its = ( a. iter( ) , a. iter( ) . rev( ) , a. iter( ) . take( 50 ) ) ;
296
- test_specializations( & itertools:: multizip( its) ) ;
311
+ let it = itertools:: multizip( ( a. iter( ) , a. iter( ) . rev( ) , a. iter( ) . take( 50 ) ) ) ;
312
+ test_specializations( & it) ;
313
+ test_double_ended_specializations( & it) ;
297
314
}
298
315
299
316
fn izip( a: Vec <u8 >, b: Vec <u8 >) -> ( ) {
@@ -307,6 +324,12 @@ quickcheck! {
307
324
test_specializations( & itertools:: iproduct!( a, b. iter( ) , c) ) ;
308
325
TestResult :: passed( )
309
326
}
327
+
328
+ fn repeat_n( element: i8 , n: u8 ) -> ( ) {
329
+ let it = itertools:: repeat_n( element, n as usize ) ;
330
+ test_specializations( & it) ;
331
+ test_double_ended_specializations( & it) ;
332
+ }
310
333
}
311
334
312
335
quickcheck ! {
@@ -400,11 +423,15 @@ quickcheck! {
400
423
401
424
quickcheck ! {
402
425
fn map_into( v: Vec <u8 >) -> ( ) {
403
- test_specializations( & v. into_iter( ) . map_into:: <u32 >( ) ) ;
426
+ let it = v. into_iter( ) . map_into:: <u32 >( ) ;
427
+ test_specializations( & it) ;
428
+ test_double_ended_specializations( & it) ;
404
429
}
405
430
406
431
fn map_ok( v: Vec <Result <u8 , char >>) -> ( ) {
407
- test_specializations( & v. into_iter( ) . map_ok( |u| u. checked_add( 1 ) ) ) ;
432
+ let it = v. into_iter( ) . map_ok( |u| u. checked_add( 1 ) ) ;
433
+ test_specializations( & it) ;
434
+ test_double_ended_specializations( & it) ;
408
435
}
409
436
410
437
fn filter_ok( v: Vec <Result <u8 , char >>) -> ( ) {
@@ -417,7 +444,9 @@ quickcheck! {
417
444
418
445
// `Option<u8>` because `Vec<u8>` would be very slow!! And we can't give `[u8; 3]`.
419
446
fn flatten_ok( v: Vec <Result <Option <u8 >, char >>) -> ( ) {
420
- test_specializations( & v. into_iter( ) . flatten_ok( ) ) ;
447
+ let it = v. into_iter( ) . flatten_ok( ) ;
448
+ test_specializations( & it) ;
449
+ test_double_ended_specializations( & it) ;
421
450
}
422
451
}
423
452
0 commit comments