Conditional Properties throwing compile error.

52 views
Skip to first unread message

Daniel Yang

unread,
Oct 2, 2011, 3:00:28 PM10/2/11
to scala...@googlegroups.com
Hi all,

I'm new to scala and wrapping my head around the power of scalacheck but seem to be having some trouble with conditional properties.

My test code looks like this:

object ComparesSpecifications extends Properties("Compares") {
  import Prop.forAll

  property("int less than") = forAll { (n: Int, m: Int) =>
    (n < m) ==> (compares.IntCompare(n,m) == LESS)
  }

}

when I run the test (with sbt) I get:

.......        value ==> is not a member of Boolean
[error]     (n < m) ==> (compares.IntCompare(n,m) == LESS) == (n < m)
                           ^

This is with scala 2.9.1, sbt 0.11, and scalacheck 1.9 on snow leopard.

Any help would be appreciated! Thanks!
~Dan

Rickard Nilsson

unread,
Oct 2, 2011, 6:12:26 PM10/2/11
to scala...@googlegroups.com
Hi Dan,

You probably just have to import the implicit conversion from Boolean
to Prop.

Do:

import org.scalacheck.Prop.propBoolean

or simply:

import org.scalacheck.Prop._

Thinking about it, "propBoolean" is quite a bad name. "booleanToProp"
sounds much better...


Best regards,
Rickard Nilsson

> ~Dan
>
> --
> You received this message because you are subscribed to the Google
> Groups "scalacheck" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/scalacheck/-/eN7uaI3ncUoJ [1].
> To post to this group, send email to scala...@googlegroups.com.
> To unsubscribe from this group, send email to
> scalacheck+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/scalacheck?hl=en.
>
>
> Links:
> ------
> [1] https://groups.google.com/d/msg/scalacheck/-/eN7uaI3ncUoJ

Daniel Yang

unread,
Oct 3, 2011, 4:19:18 AM10/3/11
to scala...@googlegroups.com
Thanks Rickard! That did the trick.
Reply all
Reply to author
Forward
0 new messages