Safe Haskell | None |
---|---|
Language | Haskell2010 |
Preassembled tasty test trees using Serial
instances and
one-to-one zipping of elements in Series
(see
zipLogic
) when Serial
functions are needed.
If you need more exhaustive testing coverage or if you experience combinatorial
explosion you can either override the default Serial
instances with custom ones or you can create your own tasty test trees using
the functions at Test.SmallCheck.Lens.
- testIso :: (Eq s, Eq a, Show s, Show a, Serial IO a, Serial Identity a, CoSerial IO a, Serial IO s, Serial Identity s, CoSerial IO s) => Iso' s a -> TestTree
- testLens :: (Eq s, Eq a, Show s, Show a, Serial IO a, Serial Identity a, CoSerial IO a, Serial IO s) => Lens' s a -> TestTree
- testPrism :: (Eq s, Eq a, Show s, Show a, Serial IO a, Serial Identity a, CoSerial IO a, Serial IO s) => Prism' s a -> TestTree
- testSetter :: (Eq s, Show s, Show a, Serial IO a, Serial Identity a, CoSerial IO a, Serial IO s) => ASetter' s a -> TestTree
- testTraversal :: forall s a. (Eq s, Show s, Show a, Serial IO a, Serial Identity a, CoSerial IO a, Serial IO s) => Traversal' s a -> TestTree
Test Trees
testIso :: (Eq s, Eq a, Show s, Show a, Serial IO a, Serial Identity a, CoSerial IO a, Serial IO s, Serial Identity s, CoSerial IO s) => Iso' s a -> TestTree Source
testLens :: (Eq s, Eq a, Show s, Show a, Serial IO a, Serial Identity a, CoSerial IO a, Serial IO s) => Lens' s a -> TestTree Source
A Lens'
is only legal if it is a valid Traversal'
(see
testTraversal
), and if the following laws hold:
view l (set l b a) ≡ b
set l (view l a) a ≡ a
set l c (set l b a) ≡ set l c a
testPrism :: (Eq s, Eq a, Show s, Show a, Serial IO a, Serial Identity a, CoSerial IO a, Serial IO s) => Prism' s a -> TestTree Source
A Prism'
is only legal if it is a valid Traversal'
(see
testTraversal
), and if the following laws hold:
preview l (review l b) ≡ Just b"
maybe s (review l) (preview l s) ≡ s
testSetter :: (Eq s, Show s, Show a, Serial IO a, Serial Identity a, CoSerial IO a, Serial IO s) => ASetter' s a -> TestTree Source
A Setter
is only legal if the following laws hold:
set l y (set l x a) ≡ set l y a
over l id ≡ id
over l f . over l g ≡ over l (f . g)
testTraversal :: forall s a. (Eq s, Show s, Show a, Serial IO a, Serial Identity a, CoSerial IO a, Serial IO s) => Traversal' s a -> TestTree Source
A Traversal'
is only legal if it is a valid Setter'
(see
testSetter
), and if the following laws hold:
t pure ≡ pure
fmap (t f) . t g ≡ getCompose . t (Compose . fmap f . g)