Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module is intended to be imported qualified
, for example:
import qualified Test.Tasty.Lens.Iso as Iso
- test :: (Eq s, Eq a, Show s, Show a, Serial Identity s, Serial IO s, CoSerial IO s, Serial Identity a, Serial IO a, CoSerial IO a) => Iso' s a -> TestTree
- testSeries :: (Eq s, Eq a, Show s, Show a, Serial Identity s, Serial IO s, CoSerial IO s, Serial Identity a, Serial IO a, CoSerial IO a) => Iso' s a -> Series IO s -> Series IO a -> TestTree
- testExhaustive :: (Eq s, Eq a, Show s, Show a, Serial Identity s, Serial IO s, CoSerial IO s, Serial Identity a, Serial IO a, CoSerial IO a) => Iso' s a -> TestTree
- module Test.SmallCheck.Lens.Iso
Tests
test :: (Eq s, Eq a, Show s, Show a, Serial Identity s, Serial IO s, CoSerial IO s, Serial Identity a, Serial IO a, CoSerial IO a) => Iso' s a -> TestTree Source
An Iso'
is only legal if the following laws hold:
s ^. l . from l ≡ s
s ^. from l . l ≡ s
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 uses Test.Tasty.Lens.Lens.
test
to validate the Iso'
is
a valid Lens'
in both normal and reverse form.
testSeries :: (Eq s, Eq a, Show s, Show a, Serial Identity s, Serial IO s, CoSerial IO s, Serial Identity a, Serial IO a, CoSerial IO a) => Iso' s a -> Series IO s -> Series IO a -> TestTree Source
An Iso'
is only legal if the following laws hold:
s ^. l . from l ≡ s
s ^. from l . l ≡ s
As in test
both s
and a
need to be Serial
and CoSerial
instances,
but here you explicitly pass custom Series
of s
and a
for the forward
case, while the reverse case still uses Serial
and CoSerial
instances.
If you want to fine tune both the forward and reverse cases, you should
create your own TestTree
.
This uses Test.Tasty.Lens.Lens.
testSeries
, with the custom
Series
for s
and a
, to validate the Iso'
is a valid Lens'
in both
normal and reverse form.
testExhaustive :: (Eq s, Eq a, Show s, Show a, Serial Identity s, Serial IO s, CoSerial IO s, Serial Identity a, Serial IO a, CoSerial IO a) => Iso' s a -> TestTree Source
An Iso'
is only legal if the following laws hold:
s ^. l . from l ≡ s
s ^. from l . l ≡ s
This is the same as test
except it uses
Test.Tasty.Lens.Lens.
testExhaustive
to validate the Lens'
laws.
Be aware of combinatorial explosions.
Re-exports
module Test.SmallCheck.Lens.Iso