Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module is intended to be imported qualified
, for example:
import qualified Test.Tasty.Lens.Lens as Lens
- test :: (Eq s, Eq a, Show s, Show a, Serial IO s, Serial IO a, Serial Identity a, CoSerial IO a) => Lens' s a -> TestTree
- testSeries :: (Eq s, Eq a, Show s, Show a, Serial IO a, Serial Identity a, CoSerial IO a) => Lens' s a -> Series IO s -> TestTree
- testExhaustive :: (Eq s, Eq a, Show s, Show a, Serial IO s, Serial IO a, Serial Identity a, CoSerial IO a) => Lens' s a -> TestTree
- module Test.SmallCheck.Lens.Lens
Tests
test :: (Eq s, Eq a, Show s, Show a, Serial IO s, Serial IO a, Serial Identity a, CoSerial IO a) => Lens' s a -> TestTree Source
A Lens'
is only legal if it's a valid Traversal'
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
It uses the Serial
and CoSerial
instances for s
and a
. If you are
not creating your own orphan instances be aware of combinatorial explosion
since the default implementations usually aim for exhaustivity.
This also uses Test.Tasty.Lens.Traversal.
test
, with the
Maybe
functor, to validate the Lens'
is a valid Traversal'
.
testSeries :: (Eq s, Eq a, Show s, Show a, Serial IO a, Serial Identity a, CoSerial IO a) => Lens' s a -> Series IO s -> TestTree Source
A Lens'
is only legal if it's a valid Traversal'
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
Here you explicitly pass a custom Series
for s
, while for a
the
Serial
instance is used. If you want to fine tune both Series
, you
should create your own TestTree
.
This also uses Test.Tasty.Lens.Traversal.
testSeries
, with
the Maybe
functor and the custom s
Series
, to validate the Lens'
is
a valid Traversal'
.
testExhaustive :: (Eq s, Eq a, Show s, Show a, Serial IO s, Serial IO a, Serial Identity a, CoSerial IO a) => Lens' s a -> TestTree Source
A Lens'
is only legal if it's a valid Traversal'
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
This is like the same as test
except it uses
Test.Tasty.Lens.Traversal.
testExhaustive
to validate
Traversal'
laws. Be aware of combinatorial explosions.
Re-exports
module Test.SmallCheck.Lens.Lens