-
Notifications
You must be signed in to change notification settings - Fork 253
Fixed bug in FingerTree.append(). Added PropertyTestRunner #144
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
Conversation
…ties and Arbitrary.arbSeq().
|
I think this a good idea overall. some considerations that may be worth taking into account:
|
|
|
|
…y.arbNonEmptyList(), NonEmptyList.tail(), NonEmptyList.head(), NonEmptyList.equals(), NonEmptyList.toString(), NonEmptyListProperties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me explain why I changed these lines. There were two bugs here:
- The upper bound was exclusive, but it should be inclusive.
- It didn't work for ranges wider than
Integer.MAX_VALUE(e.g. range[-10; Integer.MAX_VALUE]).
…t(), zipIndex(), zipWith(), unzip(), join(). Added variable arguments to NonEmptyList.nel().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this always a list of size 1, rather than some arbitrary length?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No.
- Gen.listOf - list of arbitrary length (
[0, ∞)). - Gen.listOf1 - non empty list of arbitrary length (
[1, ∞)). - Gen.sequenceN - list of specified length.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, but I had to dig through the code to convince myself this is true. The existing javadoc should be more specific.
Fixed bug in FingerTree.append(). Added PropertyTestRunner
|
I think it is a good idea to redo the ScalaCheck property tests using FunctionalJava. Originally the property testing framework was separate called Reductio and was merged into FunctionalJava. I think it makes sense to split it into a separate component. I have looked at the FJ property test classes previously and I think they matched the quickcheck paper by John Hughes (http://www.eecs.northwestern.edu/~robby/courses/395-495-2009-fall/quick.pdf). For this reason, I suggest we call the artifact I still have to do some playing with the PropertyTestRunner to understand all the details. |
|
|
|
I am going to try to split this out now. See #147. |
Guys, I have a suggestion. FunctionalJava has a decent property based testing framework (fj.test), but it is not used in FunctionalJava. Instead, ScalaCheck is used. I think, we should rewrite all properties to fj.test and remove ScalaCheck dependency.
Here are some advantages of this approach:
Don't get me wrong. I like Scala, but FunctionalJava is a library for Java and it should use Java as much as possible.
I've implemented
PropertyTestRunnerwhich integrates JUnit with fj.test. All classes that are marked withRunWith(PropertyTestRunner)will be executed during the Gradle build.SeqPropertiesis an example of a class with properties (you can run it directly from IDEA too).I'm open for discussion.