Skip to content

Commit 3da1be9

Browse files
committed
Ported GraphCheck to use the Scalatest runner
1 parent 66cbdab commit 3da1be9

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed
Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,41 @@
11
package org.geoscript.support.graph
22

3-
import org.scalacheck._, Arbitrary._, Prop._
3+
import org.scalatest._, prop._
44

5-
object GraphCheck extends Properties("Maximal cliques") {
5+
class GraphCheck extends PropSpec with Checkers {
66
val parity = (ps: Set[Int]) =>
77
(a: Int, b: Int) => (ps - 0).exists(p => (a + b) % p == 0)
88

9-
property("are cliques") =
10-
forAll { (vs: Set[Int], ps: Set[Int]) =>
9+
property("are cliques") {
10+
check { (vs: Set[Int], ps: Set[Int]) =>
1111
val cliques = maximalCliques(vs, parity(ps))
1212
cliques.forall(isClique(_, parity(ps)))
1313
}
14+
}
1415

15-
property("are maximal") =
16-
forAll { (vs: Set[Int], ps: Set[Int]) =>
16+
property("are maximal") {
17+
check { (vs: Set[Int], ps: Set[Int]) =>
1718
val cliques = maximalCliques(vs, parity(ps))
1819
cliques.forall { c =>
1920
(vs -- c).forall { v => !isClique(c + v, parity(ps)) }
2021
}
2122
}
23+
}
2224

23-
property("contain every node") =
24-
forAll { (vs: Set[Int], ps: Set[Int]) =>
25+
property("contain every node") {
26+
check { (vs: Set[Int], ps: Set[Int]) =>
2527
val cliques = maximalCliques(vs, parity(ps))
2628
cliques.flatten == vs
2729
}
30+
}
2831

29-
property("are never subsets of each other") =
30-
forAll { (vs: Set[Int], ps: Set[Int]) =>
32+
property("are never subsets of each other") {
33+
check { (vs: Set[Int], ps: Set[Int]) =>
3134
val cliques = maximalCliques(vs, parity(ps))
3235
cliques.forall { a =>
3336
(cliques - a).forall { b =>
3437
!(a subsetOf b) && !(b subsetOf a)
3538
} }
3639
}
40+
}
3741
}

0 commit comments

Comments
 (0)