Skip to content
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

More tests #58

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

More tests #58

wants to merge 3 commits into from

Conversation

Jaxan
Copy link
Contributor

@Jaxan Jaxan commented Apr 6, 2018

I just wanted to show how we could use more QuickCheck property testing.

These commits are still a bit of a mess as I wanted to use floating points first (that clearly will not work). And afterwards moved to rational numbers. I propose not to merge it, but just to have a look at it.

Note that Complex Rational does not have a Num instance because one cannot define abs. This is a bit annoying and really a problem with base. Also we cannot have Normed instances for rational numbers, so we can only test some things exactly.

@ocramz
Copy link
Owner

ocramz commented Apr 6, 2018

Thanks a lot @Jaxan ! I'll look into this asap. For the time being, why did you have to change the bounds on base and the Stackage LTS versions? Thanks!

@Jaxan
Copy link
Contributor Author

Jaxan commented Apr 6, 2018

Good question. The reason is that the function conjugate from Data.Complex had the constraint RealFloat instead of Num and they fixed that in 4.8. I wanted to use the same tests with Complex Rational, so I needed conjugate to work. However, in the end it didn't work at all, because there is no Num instance as abs is unimplementable for Complex Rational.

As I said, the code is a bit of a mess (and more for exposition instead of merging). I also changed stuff in Epsilon which is maybe not necessary.

@ocramz
Copy link
Owner

ocramz commented Apr 6, 2018

Great points! Yes, working over Z or Q would enable exact algorithms, but then we'd have to rewrite all the parts that use square roots (such as the L2 norm), trig functions etc.

@Jaxan
Copy link
Contributor Author

Jaxan commented Apr 6, 2018

I think it's the most we can easily get out of QuickCheck. For the floating point instances and classes like Normed, we can still write unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants