haskell - How to use ByteStrings with QuickTest in DocTest? -
how define arbitrary
instance (as stated here) when using doctest , quickcheck?
doctest , cabal set described here separate directory tests.
the doctest line looks this:
-- prop> (\s -> (decode . encode $ s == s)) :: bytestring -> bool decode :: bytestring -> bytestring encode :: bytestring -> bytestring
where , how define arbitrary
instance, doctest can find it? note want define in test project.
try
-- $setup -- >>> import control.applicative -- >>> import qualified data.bytestring bytestring -- >>> import test.quickcheck -- >>> instance arbitrary bytestring arbitrary = bytestring.pack <$> arbitrary -- >>> instance coarbitrary bytestring coarbitrary = coarbitrary . bytestring.unpack -- | -- prop> \ s -> (decode . encode) s == s decode:: bytestring -> bytestring encode :: bytestring -> bytestring
named chunks can used such definitions. however, each complete definition must on 1 line, , doctest report each use of >>>
success or failure - in case, 6 attempts reported, though 1 of them test.
Comments
Post a Comment