-
Notifications
You must be signed in to change notification settings - Fork 60
initial implementation of a more comprehensive test suite #99
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
initial implementation of a more comprehensive test suite #99
Conversation
| liftEq p a1 a2 = sizeofArray a1 == sizeofArray a2 && loop (sizeofArray a1 - 1) | ||
| where loop i | i < 0 = True | ||
| | otherwise = p (indexArray a1 i) (indexArray a2 i) && loop (i-1) | ||
|
|
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.
I just merged my eagerness patch, so you should use indexArray## here. Also, if we're adding Eq1 we should surely also add Ord1.
|
@treeowl I probably won’t be able to get back to this PR tomorrow. If you want, go ahead and take over it. I am pretty confident that we are in agreement about the improvements that still need to be made to it. |
|
I'm not sure when I'll be able to get to it either! Things are going to be
pretty crazy for the next couple weeks, TBH.
…On Tue, Mar 20, 2018 at 5:30 PM, Andrew Martin ***@***.***> wrote:
@treeowl <https://github.com/treeowl> I probably won’t be able to get
back to this PR tomorrow. If you want, go ahead and take over it. I am
pretty confident that we are in agreement about the improvements that still
need to be made to it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#99 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABzi_ZgDPbpw3FXTbme3T9Z6kLjovPsfks5tgXTxgaJpZM4SyqtS>
.
|
…ickcheck-test-suite
… did a pretty cool trick with a fixed-point combinator, but it didn't work. I couldn't figure out how to make it work, so I just copied the implementation used for Array and adapted it to SmallArray.
…eArray. Also, improve the performance of ByteArray's fromListN function
|
It turns out that the |
treeowl
left a comment
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.
What are these fromList copies for?
|
@treeowl For some reason, github won't show me which code your comment refers to, so I'll try to explain more generally what's going on. On GHC 7.4.2, there is no |
|
@RyanGlScott This appears to be passing in travis now. There's a bogus failure for GHC 7.8, but everything else is good. Please review when you get a chance. In the process of adding the test suite, it was discovered that |
RyanGlScott
left a comment
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.
Thanks. It looks like this does quite a bit more than change the test suite—do you mind adding entries to the changelog describing what all have changed here?
primitive.cabal
Outdated
| Build-Depends: base >= 4.5 && < 4.12 | ||
| , ghc-prim >= 0.2 && < 0.6 | ||
| , transformers >= 0.2 && < 0.6 | ||
| , transformers >= 0.4 && < 0.6 |
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.
Why are you bumping the upper version bounds for transformers? (Note that that is what is causing the GHC 7.8 build failure in Travis.)
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.
If we can keep the bounds down, maybe we can just deprecate the last couple versions altogether. The correctness and safety bugs are really piling up.
test/main.hs
Outdated
| (?) = flip | ||
| {-# INLINE (?) #-} | ||
|
|
||
| smallArrayFromListN :: Int -> [a] -> SmallArray a |
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.
If this is literally copy-pasted from the main library, it might make sense to just export it from Data.Primitive.SmallArray proper.
| go !ix (x : xs) = do | ||
| writeByteArray marr ix x | ||
| go (ix + 1) xs | ||
| go 0 ys |
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.
While you're replacing the IsList instance, I think you should make it safe by checking against the given size on each iteration. I'm adding that check to the polymorphic arrays.
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.
I’ll do that. It’s a pretty inexpensive check, and this function should never be used in performance-critical situations, and segfaults are terrible.
|
Oh, I see... You want newer transformers because the lifted classes changed... Hrmm. I think it might be better just not to run those tests with sufficiently elderly GHC versions. Or something. Gross. Can we avoid |
|
@RyanGlScott Who is going to decide what happens with the last two releases? Having bug-ridden instances in non-deprecated releases seems rather bad. |
|
I don't have Hackage permissions for |
|
Ah, I guess @dolio will have to chime in at some point. |
|
I'll need to think a little more about how to allow |
|
So, what I think that I’m going to do is make quickcheck-classes able to build with even older versions of transformers. When built with these old versions of transformers (and a sufficiently old version of base) , it will not provide property tests for any of the higher kinded type classes. In primitive, I’ll just CPP our the functor, applicative, etc. tests when the dependencies are old. Does this sound like an acceptable approach? Practically speaking, I believe that the effect it will have will be that GHC 7.8.4 does not get tests for higher kinded type classes run (since that appears to be the only one where transformers < 0.4 is used). |
|
Have you updated the tests to check `foldl1` and `foldr1`, and at least
make a decent attempt to check `Traversable` (e.g., using `Writer`, and
also comparing `foldMapDefault` to `foldMap` and `fmapDefault` to `fmap`)?
…On Thu, Mar 22, 2018, 1:21 PM Ryan Scott ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In changelog.md
<#99 (comment)>:
> @@ -1,3 +1,16 @@
+## Changes in version 0.6.4.0
+
+ * Add `Eq1`, `Ord1`, and `Show1` instances for `Array` and `SmallArray`.
Don't forget to mention Read1 here!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#99 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABzi_adU9SiGpRwJDr_c-Up8ji9kc7F5ks5tg92CgaJpZM4SyqtS>
.
|
…plementation for Array and SmallArray.
|
Just pushed a commit (and a new version of |
|
Build is passing. |
| , Typeable | ||
| #if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,4,0) | ||
| , Eq1 | ||
| , Ord1 |
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.
Perhaps we should derive Read1 here as well?
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.
Your thoroughness knows no bounds.
|
Excellent work, @andrewthad. At this point, I really only have one additional comment, which is about dependencies. Due to the hacky nature of Perhaps this is an acceptable cost—I'm not sure. But it is worth thinking about. What are your thoughts? |
|
@RyanGlScott It looks like the deps on |
|
@andrewthad, that might be a worthwhile pursuit. As far as how to change Travis, I think it would be a matter of passing Somewhere around here and pass |
…ids to accelerate travis builds
.travis.yml
Outdated
|
|
||
| # build & run tests, build benchmarks | ||
| - cabal new-build -w ${HC} ${TEST} ${BENCH} -j2 all | ||
| - cabal new-build -w ${HC} ${CABALFLAGS} ${TEST} ${BENCH} -j2 all |
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'll need to pass ${CABALFLAGS} to more than just here. You'll also need it on lines 121, 124, 128, and 137, which call new-build, new-test, and new-haddock. (Otherwise, when those commands are run, it will first calculate a new set of dependencies, since you passed a different set of flags!)
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.
Ah, thanks. I had forgotten that new-test even existed, so I didn't think to search for that. Also, it's a little strange to me that this to the earlier new-build commands in the file (the ones that don't build suite) would have any affect at all since primitive doesn't actually depend on quickcheck-classes.
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.
To be clear, it's not necessarily guaranteed that not passing ${CABALFLAGS} would make a difference. But in my experience, things tend to work best when you use a consistent set of build flags everywhere—you don't want to give the recompilation checker any excuse for believing that some dependency needs to be rebuilt.
.travis.yml
Outdated
| - HADDOCK=${HADDOCK-true} | ||
| - INSTALLED=${INSTALLED-true} | ||
| - GHCHEAD=${GHCHEAD-false} | ||
| - CABALFLAGS="--flags='quickcheck-classes -aeson -semigroupoids'" |
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.
I think I goofed—it turns out cabal-install doesn't like it when you surround this with double-quotes. I think it should work if you remove them.
|
I think I actually need to use |
|
No, I actually tested this one, so it better work :) |
|
No dice. |
|
Ugh. When I said "I actually tested this one", I meant I ran I'll experiment more with this locally. |
|
On second thought, we might be making this way more complicated than need be. I neglected to notice that you actually amended Sorry for the agonizing delay, @andrewthad—this stuff is always trickier than one would hope. |
|
Oh, right. I forgot that In any case, this is building, and we should get this landed. Thanks for all the hard work, @andrewthad! |
|
Thanks! |
|
No, thank you. Testing is some of the least visible and most important maintenance work there is. |
Still a work in progress