I am doing the Principles of Reactive Programming course from Coursera. In one of the assignments I need to use a scalacheck class. I have the following test class open in Intellij:
package quickcheck
import org.scalatest.FunSuite
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.prop.Checkers
import org.scalacheck.Arbitrary._
import org.scalacheck.Prop
import org.scalacheck.Prop._
import org.scalatest.exceptions.TestFailedException
object QuickCheckBinomialHeap extends QuickCheckHeap with BinomialHeap
@RunWith(classOf[JUnitRunner])
class QuickCheckSuite extends FunSuite with Checkers {
def checkBogus(p: Prop) {
var ok = false
try {
check(p)
} catch {
case e: TestFailedException =>
ok = true
}
assert(ok, "A bogus heap should NOT satisfy all properties. Try to find the bug!")
}
test("Binomial heap satisfies properties.") {
check(new QuickCheckHeap with BinomialHeap)
}
test("Bogus (1) binomial heap does not satisfy properties.") {
checkBogus(new QuickCheckHeap with Bogus1BinomialHeap)
}
test("Bogus (2) binomial heap does not satisfy properties.") {
checkBogus(new QuickCheckHeap with Bogus2BinomialHeap)
}
test("Bogus (3) binomial heap does not satisfy properties.") {
checkBogus(new QuickCheckHeap with Bogus3BinomialHeap)
}
test("Bogus (4) binomial heap does not satisfy properties.") {
checkBogus(new QuickCheckHeap with Bogus4BinomialHeap)
}
test("Bogus (5) binomial heap does not satisfy properties.") {
checkBogus(new QuickCheckHeap with Bogus5BinomialHeap)
}
}
When I am trying to run it I get this output:
+ Heap.min1: OK, passed 100 tests.
+ Heap.minOfTwo: OK, passed 100 tests.
+ Heap.insertAndDelete: OK, passed 100 tests.
Heap.min1
, Heap.minOfTwo
, Heap.insertAndDelete
are the methods that I want to check so that's good. However, the tests that they pass have no connection whatsoever with the test file that I am trying to run.
How can I run this test file correctly from Intellij? Can I run it instead from somewhere else(like sbt
console)?