Skip to content

Commit b07b0ad

Browse files
Use test_double_ended_specializations
I previously forgot `repeat_n`.
1 parent 996d86e commit b07b0ad

File tree

1 file changed

+42
-13
lines changed

1 file changed

+42
-13
lines changed

tests/specializations.rs

+42-13
Original file line numberDiff line numberDiff line change
@@ -193,19 +193,27 @@ quickcheck! {
193193
}
194194

195195
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);
197199
}
198200

199201
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);
201205
}
202206

203207
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);
205211
}
206212

207213
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);
209217
}
210218

211219
fn take_while_inclusive(v: Vec<u8>) -> () {
@@ -218,19 +226,25 @@ quickcheck! {
218226

219227
fn pad_using(v: Vec<u8>) -> () {
220228
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);
222232
}
223233

224234
fn with_position(v: Vec<u8>) -> () {
225235
test_specializations(&v.iter().with_position());
226236
}
227237

228238
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);
230242
}
231243

232244
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);
234248
}
235249

236250
fn tuple_combinations(v: Vec<u8>) -> TestResult {
@@ -284,16 +298,19 @@ quickcheck! {
284298
}
285299

286300
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);
288304
}
289305

290306
fn zip_eq(a: Vec<u8>) -> () {
291307
test_specializations(&a.iter().zip_eq(a.iter().rev()))
292308
}
293309

294310
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);
297314
}
298315

299316
fn izip(a: Vec<u8>, b: Vec<u8>) -> () {
@@ -307,6 +324,12 @@ quickcheck! {
307324
test_specializations(&itertools::iproduct!(a, b.iter(), c));
308325
TestResult::passed()
309326
}
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+
}
310333
}
311334

312335
quickcheck! {
@@ -400,11 +423,15 @@ quickcheck! {
400423

401424
quickcheck! {
402425
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);
404429
}
405430

406431
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);
408435
}
409436

410437
fn filter_ok(v: Vec<Result<u8, char>>) -> () {
@@ -417,7 +444,9 @@ quickcheck! {
417444

418445
// `Option<u8>` because `Vec<u8>` would be very slow!! And we can't give `[u8; 3]`.
419446
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);
421450
}
422451
}
423452

0 commit comments

Comments
 (0)