tomland icon indicating copy to clipboard operation
tomland copied to clipboard

Implement property-based tests `Codec` laws

Open chshersh opened this issue 6 years ago • 3 comments

Specifically:

  • [ ] Functor
  • [ ] Applicative
  • [ ] Alternative

chshersh avatar Nov 03 '19 16:11 chshersh

I'd like to work on this if it's available, I've been very interested in property testing lately. :)

Nimor111 avatar Feb 29 '20 20:02 Nimor111

Hi @Nimor111, that sounds great! I appreciate your enthusiasm 😊 However, note, that this particular issue is a bit challenging. Property-based tests for this issue include generating a random value of the following data type:

data Codec r w c a = Codec
    { codecRead  :: r a
    , codecWrite :: c -> w a
    }

and then a function of type (a -> m b) to test monadic laws for example. This might not be straightforward... There was a recent blog post about how to test such properties with QuickCheck:

  • https://blog.poisson.chat/posts/2020-02-24-quickcheck-higherorder.html

But from the package maintainer point of view, I'd love to have something similar based on hedgehog since we use this testing framework for our property-based tests.

If you would like to start with something simpler, but still want to work on property-based tests, I can recommend looking at https://github.com/kowainik/tomland/issues/202. It's much simpler and it's pretty clear how to do it 🙂

chshersh avatar Mar 02 '20 09:03 chshersh

@chshersh All right, thanks for the clarifications. :) Since i'm starting out with property testing, something simpler would be better. I'll take the other one then.

Nimor111 avatar Mar 02 '20 09:03 Nimor111