@@ -202,43 +202,43 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
202
202
// yield ("op index: " + ind) |: areEqual(t.flatMap(f), coll.flatMap(f))).reduceLeft(_ && _)
203
203
// }
204
204
205
- // property("filters must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
206
- // (for ((p, ind) <- filterPredicates.zipWithIndex) yield {
207
- // val tf = t.filter(p)
208
- // val cf = coll.filter(p)
209
- // val invs = checkDataStructureInvariants(tf, cf)
210
- // if (tf != cf || cf != tf || !invs) {
211
- // printDebugInfo(coll)
212
- // println("Operator: " + ind)
213
- // println("sz: " + t.size)
214
- // println(t)
215
- // println
216
- // println("sz: " + coll.size)
217
- // println(coll)
218
- // println
219
- // println("filtered to:")
220
- // println
221
- // println(cf)
222
- // println
223
- // println(tf)
224
- // println
225
- // println("tf == cf - " + (tf == cf ))
226
- // println("cf == tf - " + (cf == tf ))
227
- // printDataStructureDebugInfo(cf)
228
- // println("valid: " + invs)
229
- // }
230
- // ("op index: " + ind) |: tf == cf && cf == tf && invs
231
- // }).reduceLeft(_ && _)
232
- // }
205
+ property(" filters must be equal" ) = forAllNoShrink(collectionPairs) { case (t, coll) =>
206
+ (for ((p, ind) <- filterPredicates.zipWithIndex) yield {
207
+ val tf = t.filter(p)
208
+ val cf = coll.filter(p)
209
+ val invs = checkDataStructureInvariants(tf, cf)
210
+ if (! tf.iterator.sameElements(cf) || ! cf.sameElements(tf) || ! invs) {
211
+ printDebugInfo(coll)
212
+ println(" Operator: " + ind)
213
+ println(" sz: " + t.size)
214
+ println(t)
215
+ println
216
+ println(" sz: " + coll.size)
217
+ println(coll)
218
+ println
219
+ println(" filtered to:" )
220
+ println
221
+ println(cf)
222
+ println
223
+ println(tf)
224
+ println
225
+ println(" tf sameElements cf - " + (tf.iterator.sameElements(cf) ))
226
+ println(" cf sameElements tf - " + (cf.sameElements(tf) ))
227
+ printDataStructureDebugInfo(cf)
228
+ println(" valid: " + invs)
229
+ }
230
+ (" op index: " + ind) |: (tf.iterator.sameElements(cf) && cf.sameElements(tf) && invs)
231
+ }).reduceLeft(_ && _)
232
+ }
233
233
234
- // property("filterNots must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
235
- // (for ((p, ind) <- filterNotPredicates.zipWithIndex) yield {
236
- // val tf = t.filterNot(p)
237
- // val cf = coll.filterNot(p)
238
- // if (tf != cf || cf != tf ) printComparison(t, coll, tf, cf, ind)
239
- // ("op index: " + ind) |: tf == cf && cf == tf
240
- // }).reduceLeft(_ && _)
241
- // }
234
+ property(" filterNots must be equal" ) = forAllNoShrink(collectionPairs) { case (t, coll) =>
235
+ (for ((p, ind) <- filterNotPredicates.zipWithIndex) yield {
236
+ val tf = t.filterNot(p)
237
+ val cf = coll.filterNot(p)
238
+ if (! tf.iterator.sameElements(cf) || ! cf.sameElements(tf) ) printComparison(t, coll, tf, cf, ind)
239
+ (" op index: " + ind) |: tf.iterator.sameElements(cf) && cf.sameElements(tf)
240
+ }).reduceLeft(_ && _)
241
+ }
242
242
243
243
if (! isCheckingViews) property(" partitions must be equal" ) = forAllNoShrink(collectionPairs) { case (t, coll) =>
244
244
(for ((p, ind) <- partitionPredicates.zipWithIndex) yield {
@@ -254,37 +254,37 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
254
254
}).reduceLeft(_ && _)
255
255
}
256
256
257
- // if (hasStrictOrder) property("takes must be equal") = forAllNoShrink(collectionPairsWithLengths) { case (t, coll, n) =>
258
- // ("take " + n + " elements") |: t.take(n) == coll.take(n)
259
- // }
257
+ if (hasStrictOrder) property(" takes must be equal" ) = forAllNoShrink(collectionPairsWithLengths) { case (t, coll, n) =>
258
+ (" take " + n + " elements" ) |: t.take(n).iterator.sameElements( coll.take(n) )
259
+ }
260
260
261
- // if (hasStrictOrder) property("drops must be equal") = forAllNoShrink(collectionPairsWithLengths) { case (t, coll, n) =>
262
- // ("drop " + n + " elements") |: t.drop(n) == coll.drop(n)
263
- // }
261
+ if (hasStrictOrder) property(" drops must be equal" ) = forAllNoShrink(collectionPairsWithLengths) { case (t, coll, n) =>
262
+ (" drop " + n + " elements" ) |: t.drop(n).iterator.sameElements( coll.drop(n) )
263
+ }
264
264
265
- // if (hasStrictOrder) property("slices must be equal") = forAllNoShrink(collectionPairsWith2Indices)
266
- // { case (t, coll, fr, slicelength) =>
267
- // val from = if (fr < 0) 0 else fr
268
- // val until = if (from + slicelength > t.size) t.size else from + slicelength
269
- // val tsl = t.slice(from, until)
270
- // val collsl = coll.slice(from, until)
271
- // if (tsl != collsl) {
272
- // println("---------------------- " + from + ", " + until)
273
- // println("from: " + t)
274
- // println("and: " + coll)
275
- // println(tsl)
276
- // println(collsl)
277
- // println("as list: " + collsl.toList)
278
- // println(collsl.iterator.hasNext)
279
- // println(collsl.iterator.next)
280
- // println(collsl.iterator.hasNext)
281
- // println(collsl.iterator.next)
282
- // println(collsl.iterator.hasNext)
283
- // println(collsl.iterator.next)
284
- // println(collsl.iterator.hasNext)
285
- // }
286
- // ("slice from " + from + " until " + until) |: tsl == collsl
287
- // }
265
+ if (hasStrictOrder) property(" slices must be equal" ) = forAllNoShrink(collectionPairsWith2Indices)
266
+ { case (t, coll, fr, slicelength) =>
267
+ val from = if (fr < 0 ) 0 else fr
268
+ val until = if (from + slicelength > t.size) t.size else from + slicelength
269
+ val tsl = t.slice(from, until)
270
+ val collsl = coll.slice(from, until)
271
+ if (! tsl.iterator.sameElements( collsl) ) {
272
+ println(" ---------------------- " + from + " , " + until)
273
+ println(" from: " + t)
274
+ println(" and: " + coll)
275
+ println(tsl)
276
+ println(collsl)
277
+ println(" as list: " + collsl.toList)
278
+ println(collsl.iterator.hasNext)
279
+ println(collsl.iterator.next)
280
+ println(collsl.iterator.hasNext)
281
+ println(collsl.iterator.next)
282
+ println(collsl.iterator.hasNext)
283
+ println(collsl.iterator.next)
284
+ println(collsl.iterator.hasNext)
285
+ }
286
+ (" slice from " + from + " until " + until) |: tsl.iterator.sameElements( collsl)
287
+ }
288
288
289
289
if (hasStrictOrder) property(" splits must be equal" ) = forAllNoShrink(collectionPairsWithLengths) { case (t, coll, n) =>
290
290
val tspl @ (tspl1, tspl2) = t.splitAt(n)
@@ -299,20 +299,20 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
299
299
(" splitAt " + n) |: (tspl1.iterator.sameElements(cspl1) && tspl2.iterator.sameElements(cspl2))
300
300
}
301
301
302
- // if (hasStrictOrder) property("takeWhiles must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
303
- // (for ((pred, ind) <- takeWhilePredicates.zipWithIndex) yield {
304
- // val tt = t.takeWhile(pred)
305
- // val ct = coll.takeWhile(pred)
306
- // if (tt != ct ) {
307
- // println("from: " + t)
308
- // println("and: " + coll)
309
- // println("taking while...")
310
- // println(tt)
311
- // println(ct)
312
- // }
313
- // ("operator " + ind) |: tt == ct
314
- // }).reduceLeft(_ && _)
315
- // }
302
+ if (hasStrictOrder) property(" takeWhiles must be equal" ) = forAllNoShrink(collectionPairs) { case (t, coll) =>
303
+ (for ((pred, ind) <- takeWhilePredicates.zipWithIndex) yield {
304
+ val tt = t.takeWhile(pred)
305
+ val ct = coll.takeWhile(pred)
306
+ if (! tt.iterator.sameElements(ct) ) {
307
+ println(" from: " + t)
308
+ println(" and: " + coll)
309
+ println(" taking while..." )
310
+ println(tt)
311
+ println(ct)
312
+ }
313
+ (" operator " + ind) |: tt.iterator.sameElements(ct)
314
+ }).reduceLeft(_ && _)
315
+ }
316
316
317
317
if (hasStrictOrder) property(" spans must be equal" ) = forAllNoShrink(collectionPairs) { case (t, coll) =>
318
318
(for ((pred, ind) <- spanPredicates.zipWithIndex) yield {
@@ -332,11 +332,11 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
332
332
}).reduceLeft(_ && _)
333
333
}
334
334
335
- // if (hasStrictOrder) property("dropWhiles must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
336
- // (for ((pred, ind) <- dropWhilePredicates.zipWithIndex) yield {
337
- // ("operator " + ind) |: t.dropWhile(pred) == coll.dropWhile(pred)
338
- // }).reduceLeft(_ && _)
339
- // }
335
+ if (hasStrictOrder) property(" dropWhiles must be equal" ) = forAllNoShrink(collectionPairs) { case (t, coll) =>
336
+ (for ((pred, ind) <- dropWhilePredicates.zipWithIndex) yield {
337
+ (" operator " + ind) |: t.dropWhile(pred).iterator.sameElements( coll.dropWhile(pred) )
338
+ }).reduceLeft(_ && _)
339
+ }
340
340
341
341
property(" folds must be equal for assoc. operators" ) = forAllNoShrink(collectionPairs) { case (t, coll) =>
342
342
(for (((first, op), ind) <- foldArguments.zipWithIndex) yield {
@@ -399,21 +399,21 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
399
399
tarr.toSeq == collarr.toSeq
400
400
}
401
401
402
- // if (hasStrictOrder) property("scans must be equal") = forAllNoShrink(collectionPairs) {
403
- // case (t, coll) =>
404
- // (for (((first, op), ind) <- foldArguments.zipWithIndex) yield {
405
- // val tscan = t.scanLeft(first)(op)
406
- // val cscan = coll.scan(first)(op)
407
- // if (tscan != cscan || cscan != tscan) {
408
- // println("from: " + t)
409
- // println("and: " + coll)
410
- // println("scans are: ")
411
- // println(tscan)
412
- // println(cscan)
413
- // }
414
- // ("operator " + ind) |: tscan == cscan && cscan == tscan
415
- // }).reduceLeft(_ && _)
416
- // }
402
+ if (hasStrictOrder) property(" scans must be equal" ) = forAllNoShrink(collectionPairs) {
403
+ case (t, coll) =>
404
+ (for (((first, op), ind) <- foldArguments.zipWithIndex) yield {
405
+ val tscan = t.scanLeft(first)(op)
406
+ val cscan = coll.scan(first)(op)
407
+ if (! tscan.iterator.sameElements( cscan) || ! cscan.sameElements( tscan) ) {
408
+ println(" from: " + t)
409
+ println(" and: " + coll)
410
+ println(" scans are: " )
411
+ println(tscan)
412
+ println(cscan)
413
+ }
414
+ (" operator " + ind) |: tscan.iterator.sameElements( cscan) && cscan.sameElements( tscan)
415
+ }).reduceLeft(_ && _)
416
+ }
417
417
418
418
// property("groupBy must be equal") = forAllNoShrink(collectionPairs) {
419
419
// case (t, coll) =>
0 commit comments