Skip to content

Instantly share code, notes, and snippets.

@aeyakovenko
Last active April 23, 2016 22:45
Show Gist options
  • Save aeyakovenko/9e58e99c8e1d43cd31fe0d6bd94fc0ac to your computer and use it in GitHub Desktop.
Save aeyakovenko/9e58e99c8e1d43cd31fe0d6bd94fc0ac to your computer and use it in GitHub Desktop.
val slices: Gen[(Int,Int,List[Int])] = for {
a <- Gen.listOf(Gen.choose(-100,100))
j <- Gen.choose(0, a.length)
k <- Gen.choose(j, a.length)
} yeild(j,k,a)
property("slice") = forAll(slices) { g =>
val (j,k,a) = g
val (p,s,e) = Scala99.slice(j, k, a)
(p ++ s ++ e == a) && (s.length == (k - j))
}
[info] Compiling 1 Scala source to /home/anatolyy/scala-99/target/scala-2.11/test-classes...
[error] /home/anatolyy/scala-99/src/test/scala/scala-99.scala:98: value foreach is not a member of org.scalacheck.Gen[List[Int]]
[error] a <- Gen.listOf(Gen.choose(-100,100))
[error] ^
[error] one error found
[error] (test:compileIncremental) Compilation failed
[error] Total time: 2 s, completed Apr 19, 2016 8:11:50 AM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment