-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix property tests #421
fix property tests #421
Conversation
@johnynek any idea why monoid laws for Array[Int] be failing?
|
This was added when the tests were broken: in fact it helped us notice they are broken. I guess there is a corner case there. One idea is to use labels on Props to see what part of the law failed: But the problem is the return types of all these things: are Boolean, not Prop (which should probably be changed, I suppose). In the mean time, can you load the repl and see what is going wrong? My guess, since it is only one arg is that isNonZero is broken (because Array equality is reference equality). I guess isNonZero(a: Array[T]) = a.nonEmpty might fix it. The isNonZero is a pretty busted idea. We should have taken Equiv (or our own typeclass) for that, and these cases where there are many representations of zero (Array(), Array(0), Array(0, 0)) are really problematic. |
So glad to have these back running. |
(Just chuckled because it was Arrays again -- for better or worse. :-P) |
Most property tests such as monoidLaw, monadLaw etc were not running properly due to combination of
org.scalatest.prop.PropertyChecks
withorg.scalacheck.Prop.forAll
. Scalatest mark test as a failure only when an exception is thrown using various matchers etc, most Algebird laws indicate failure by returningfalse
insideorg.scalacheck.Prop.forAll
. Due to this mismatch Scalatest was passing all the laws even when they failed as no exception was thrown. I have changed the tests to useorg.scalatest.prop.Checkers
instead oforg.scalatest.prop.PropertyChecks
which delegates to Scalatest for test verification keeping the old behavior offalse
for failuretrue
for success anderror
for exception