Questions tagged [scalacheck]

ScalaCheck is a powerful tool for automatic unit testing of Scala and Java programs.

ScalaCheck is a powerful tool for automatic unit testing of Scala and Java programs. It features automatic test case generation and minimization of failing test cases. ScalaCheck started out as a Scala port of the Haskell library QuickCheck, and has since evolved and been extended with features not found in Haskell QuickCheck .

265 questions
0
votes
2 answers

Scalacheck new Buildable Instances

I have the following code for ScalaCheck. The idea is to automatically generate sets of integers using Java HashSet as the container. The following code used to work a few years ago, but no longer compiles. import java.util.HashSet import…
0
votes
1 answer

Circular Generators hanging indefinately

I have a set of names in a file. I need to implement a Generator that iterates through them continually. However, the code is hanging indefinitely at if (iter.hasNext) after the first pass. Gen code var asStream =…
Aravind Yarram
  • 74,434
  • 44
  • 210
  • 298
0
votes
1 answer

scala higher kinds and scalatic Equality

Been playing around with scalas type system and again i find myself fighting it. I have created a Vector library for some simple graphics applications and im fairly happy with it. Now i want to be able to test the Vector properties with scalacheck…
Patrik
  • 255
  • 3
  • 11
0
votes
1 answer

not found object Prop, scalacheck

i'm following the exact same instructions of: http://lamp.epfl.ch/files/content/sites/lamp/files/teaching/progfun/ScalacheckTutorial.html to add the scalacheck jar to the scala-ide but the IDE is giving me this: "object Prop not found" when…
matos416
  • 75
  • 4
0
votes
1 answer

Specs2 won't print scalacheck counterexamples?

I'm using specs2 to run my tests. I'm able to get it running scalacheck, but in the below (when I run with sbt test) it doesn't print the counterexample. This is almost useless without the counterexample: import…
Marcin
  • 44,601
  • 17
  • 110
  • 191
0
votes
0 answers

Using specs2 + scalacheck to validate type classes (simple Arbitrary[...] example)

I'm having trouble getting specs2 and scalacheck to cooperate. I have a simple class, Credit, that takes a single integer within the range of 1 to 59 (anything outside of this range should throw an exception). I want to define two tests: 1 test that…
Zac
  • 1,278
  • 1
  • 15
  • 27
0
votes
2 answers

scalacheck whenever value not recognized

I have a basic question about scalacheck's whenever clause. For some reason, my compiler doesn't recognize whenever, nor the (conditional subset) ==> part. (I am following along Odersky's second scala course on Coursera, and I've written a…
Allen Wang
  • 1,892
  • 18
  • 36
0
votes
1 answer

how to reuse generated data on scalacheck

In our system we have really big objects that are generated for scalacheck. All properties are of the same data structure, and therefore it seems unnecessary to generate cases for each property. They should be reused. I'm aware of something like…
caente
  • 141
  • 7
0
votes
1 answer

Why does a Scalacheck Prop value not get evaluated?

The official scalacheck documentation gives the following example: property("stringLength") = Prop.forAll { s: String => val len = s.length (s+s).length == len+len } I read that this can also be written as: val stringLength =…
Pavel
  • 3,303
  • 24
  • 31
0
votes
1 answer

enable implicit import for runtime type in scala check. "could not find implicit value for parameter"

I'm testing my own home-brewed Monoid classes in scala using the ScalaCheck library and ScalaTest when attempting to implement DRY tests, I get the implicit error in the title: Error:(16, 12) could not find implicit value for parameter arbA:…
coderatchet
  • 7,214
  • 15
  • 60
  • 109
0
votes
1 answer

ScalaCheck nested Gen

In ScalaCheck it seems that a mapped/flatMapped Gen will fail as soon as any inner gen has a value filtered out. E.g. (using ScalaTest) class ScalaCheckGen extends FreeSpec with GeneratorDrivenPropertyChecks { "Fails" in { …
Pengin
  • 4,468
  • 5
  • 32
  • 60
0
votes
1 answer

Output of unit test printed after execution of the test finished

I have the following unit test: test("All - gather message") { def fs: List[Future[Int]] = List(Future{ blocking {Thread.sleep(4000)} println("Finished sleeping in future 1!") 1 }, Future { blocking…
octavian
  • 15,986
  • 38
  • 119
  • 229
0
votes
1 answer

Can Gen[String] Produce Other Values?

Given: import org.scalatest._ import org.scalatest.prop.Checkers import org.scalacheck.Gen import org.scalacheck.Gen._ object Test { def fooOrBar: Gen[String] = oneOf("foo", "bar") } class Test extends FunSuite with Checkers { import Test._ …
Kevin Meredith
  • 38,251
  • 58
  • 190
  • 340
0
votes
1 answer

Expressing a property in ScalaCheck that does not have evaluations discarded

Given this: property("Empty range") { forAll { (min: Int, max: Int) => whenever (min == max) { Range(min, max).size should be (0) } } } I get [info] - Empty range *** FAILED *** [info] Gave up after 5 successful…
egbokul
  • 3,794
  • 4
  • 33
  • 50
0
votes
1 answer

High-order Scalacheck property

I'm new into Scala, Scalacheck and specs2 so bear with me if maybe question is kind of obvious. I tried to look an example of this but couldnt find anything related. Basically I'm looking for a way to create a test class using specs2 to define a…
mtelloz
  • 5
  • 2