summaryrefslogtreecommitdiff
path: root/test/scalacheck/parallel-collections/ParallelArrayTest.scala
diff options
context:
space:
mode:
authorSeth Tisue <seth@tisue.net>2017-01-23 14:35:47 -0800
committerSeth Tisue <seth@tisue.net>2017-01-27 09:29:53 -0800
commit4386b948a0b597cc78e4f3b22b51e0588a5b6d60 (patch)
treeeca8cea41d110d8b14d27a83ae06a90e966f9621 /test/scalacheck/parallel-collections/ParallelArrayTest.scala
parent27c10db549e6f43571663d0162b58fc04fbb34bf (diff)
downloadscala-4386b948a0b597cc78e4f3b22b51e0588a5b6d60.tar.gz
scala-4386b948a0b597cc78e4f3b22b51e0588a5b6d60.tar.bz2
scala-4386b948a0b597cc78e4f3b22b51e0588a5b6d60.zip
run ScalaCheck tests directly, not through partest
ScalaCheck ever being under partest in the first place is ancient history, from back in the Ant build days (shudder) ScalaCheck support was removed from partest 1.1.0, which we already upgraded to in a recent commit also upgrades ScalaCheck from 1.11.6 to 1.13.4, since we might as well. no source changes were necessary.
Diffstat (limited to 'test/scalacheck/parallel-collections/ParallelArrayTest.scala')
-rw-r--r--test/scalacheck/parallel-collections/ParallelArrayTest.scala112
1 files changed, 112 insertions, 0 deletions
diff --git a/test/scalacheck/parallel-collections/ParallelArrayTest.scala b/test/scalacheck/parallel-collections/ParallelArrayTest.scala
new file mode 100644
index 0000000000..db2b1ea01e
--- /dev/null
+++ b/test/scalacheck/parallel-collections/ParallelArrayTest.scala
@@ -0,0 +1,112 @@
+// package test.scala.collection.parallel.mutable
+
+// import org.scalatest.FunSuite
+// import collection.parallel.mutable.ParallelArray
+
+// /**
+// * Notes:
+// */
+// class ParallelArrayTest extends FunSuite {
+
+// test("create new parallel array with a bad initial capacity"){
+// intercept[IllegalArgumentException]{
+// new ParallelArray(-5)
+// }
+
+// /**
+// * this currently passes, but do we want it to?
+// * does it have meaning to have an empty parallel array?
+// */
+// new ParallelArray(0)
+// ()
+// }
+
+// test("compare identical ParallelArrays"){
+// assert(new ParallelArray(5) === new ParallelArray(5))
+// assert(ParallelArray(1,2,3,4,5) === ParallelArray(1,2,3,4,5))
+// }
+
+// /**
+// * this test needs attention. how is equality defined on ParallelArrays?
+// * Well, the same way it is for normal collections, I guess. For normal arrays its reference equality.
+// * I do not think it should be that way in the case of ParallelArray-s. I'll check this with Martin.
+// */
+// test("compare non-identical ParallelArrays"){
+// assert(ParallelArray(1,2,3,4,5) != ParallelArray(1,2,3,4),
+// "compared PA's that I expect to not be identical, but they were!")
+// }
+
+// test("creation via PA object [String]"){
+// val paFromApply: ParallelArray[String] = ParallelArray("x", "1", "true", "etrijwejiorwer")
+// val paFromHandoff: ParallelArray[String] = ParallelArray.handoff(Array("x", "1", "true", "etrijwejiorwer"))
+// val paFromCopy: ParallelArray[String] = ParallelArray.createFromCopy(Array("x", "1", "true", "etrijwejiorwer"))
+// assert( paFromApply === paFromCopy )
+// assert( paFromApply === paFromCopy )
+// }
+
+// // // handoffs dont work for primitive types...
+// // test("creation via PA object [Boolean]"){
+// // val paFromApply: ParallelArray[Boolean] = ParallelArray(true, false, true, false)
+// // val paFromCopy: ParallelArray[Boolean] = ParallelArray.createFromCopy(Array(true, false, true, false))
+// // assert( paFromApply === paFromCopy )
+// // }
+// //
+// // // handoffs dont work for primitive types...
+// // test("creation via PA object [Int]"){
+// // val paFromApply: ParallelArray[Int] = ParallelArray(1, 2, 4, 3)
+// // val paFromCopy: ParallelArray[Int] = ParallelArray.createFromCopy(Array(1, 2, 4, 3))
+// // assert( paFromApply === paFromCopy )
+// // }
+
+// /**
+// * This fails because handoff is really doing a copy.
+// * TODO: look at handoff
+// */
+// test("Handoff Is Really A Handoff"){
+// val arrayToHandOff = Array("a", "x", "y", "z")
+// val paFromHandoff: ParallelArray[String] = ParallelArray.handoff(arrayToHandOff)
+// arrayToHandOff(0) = "w"
+// assert(paFromHandoff(0) === "w")
+// }
+
+// test("simple reduce"){
+// assert( ParallelArray(1,2,3,4,5).reduce(_+_) === 15 )
+// }
+
+// test("simple count"){
+// assert( ParallelArray[Int]().count(_ > 7) === 0 )
+// assert( ParallelArray(1,2,3).count(_ > 7) === 0 )
+// assert( ParallelArray(1,2,3).count(_ <= 3) === 3 )
+// assert( ParallelArray(1,2,3,4,5,6,7,8,9,10).count(_ > 7 ) === 3 )
+// }
+
+// test("simple forall"){
+// assert( ParallelArray[Int]().forall(_ > 7) === true )
+// assert( ParallelArray(1,2,3).forall(_ > 3) === false )
+// assert( ParallelArray(1,2,3).forall(_ <= 3) === true )
+// assert( ParallelArray(1,2,3,4,5,6,7,8,9,10).forall(_ > 0) === true )
+// assert( ParallelArray(1,2,3,4,5,6,7,8,9,10).forall(_ < 5) === false )
+// }
+
+// /**
+// */
+// test("simple foreach"){
+// val buf = new java.util.concurrent.ArrayBlockingQueue[Int](10000)
+// ParallelArray((1 to 10000):_*).foreach(buf add _)
+// (1 to 10000).foreach(i => assert( buf contains i, "buf should have contained:" + i ))
+// }
+
+// test("simple exists"){
+// assert( ParallelArray[Int]().exists(_ => true) === false )
+// assert( ParallelArray(1,2,3).forall(_ > 3) === false )
+// assert( ParallelArray(1,2,3,4,5,6,7,8,9,10).exists(_ > 7) === true )
+// }
+
+// test("simple filter"){
+// assert(ParallelArray(1,2,3,4,5).filter( _ < 4 ) === ParallelArray(1,2,3))
+// }
+
+// test("simple map test"){
+// assert(ParallelArray(1,2,3,4,5).map( (_:Int) * 10 ) === ParallelArray(10,20,30,40,50))
+// }
+// }