smallcheck-lens 0.1 → 0.3
raw patch · 19 files changed
+166/−392 lines, 19 filesdep +taggeddep −smallcheck-lensdep −tastydep −tasty-smallcheckdep ~lensdep ~smallcheckdep ~transformers
Dependencies added: tagged
Dependencies removed: smallcheck-lens, tasty, tasty-smallcheck
Dependency ranges changed: lens, smallcheck, transformers
Files
- CHANGELOG.markdown +0/−13
- CHANGELOG.md +31/−0
- README.markdown +0/−16
- README.md +25/−0
- Test/SmallCheck/Lens.hs +0/−34
- Test/SmallCheck/Lens/Iso.hs +11/−7
- Test/SmallCheck/Lens/Lens.hs +8/−4
- Test/SmallCheck/Lens/Prism.hs +9/−6
- Test/SmallCheck/Lens/Setter.hs +34/−10
- Test/SmallCheck/Lens/Traversal.hs +31/−12
- Test/Tasty/SmallCheck/Lens.hs +0/−26
- Test/Tasty/SmallCheck/Lens/Iso.hs +0/−32
- Test/Tasty/SmallCheck/Lens/Lens.hs +0/−33
- Test/Tasty/SmallCheck/Lens/Prism.hs +0/−31
- Test/Tasty/SmallCheck/Lens/Setter.hs +0/−30
- Test/Tasty/SmallCheck/Lens/Traversal.hs +0/−32
- smallcheck-lens.cabal +11/−40
- stack.yaml +6/−0
- tests/tasty.hs +0/−66
− CHANGELOG.markdown
@@ -1,13 +0,0 @@-# Change Log-All notable changes to this project will be documented in this file. This file-follows the formatting recommendations from [Keep a-CHANGELOG](http://keepachangelog.com/). This project adheres to [Semantic-Versioning](http://semver.org/).--## [0.1] - 2015-05-27-### Added-- `SmallCheck` properties for each lens laws.-- `tasty` test trees for each `Lens` type.-- Tests for some `Lens`.--[0.1]: https://github.com/jdnavarro/smallcheck-series/compare/1df060..v0.1
+ CHANGELOG.md view
@@ -0,0 +1,31 @@+# Change Log+All notable changes to this project will be documented in this file. This file+follows the formatting recommendations from [Keep a+CHANGELOG](http://keepachangelog.com/). This project adheres to [Semantic+Versioning](http://semver.org/).++[0.3] - 2015-09-11+### Changed+- More sensible function names assuming qualified imports.+- Pass functor to use in `Traversal` as a `Proxy` instead of hardcoding+ the functors.+- Rank-2 `Lens-Like` everywhere.++### Added+- *Exhaustive* property testing using `Series` product. Previous+ properties renamed appending `Sum`.++### Removed+- Main re-export module.+- Move `Tasty` modules to a separate package+ [`tasty-lens`](https://hackage.haskell.org/package/tasty-lens).+- `pureMaybe`. Now a `Proxy functor` is used.++## [0.1] - 2015-05-27+### Added+- `SmallCheck` properties for each lens laws.+- `tasty` test trees for each `Lens` type.+- Tests for some `Lens`.++[0.3]: https://github.com/jdnavarro/smallcheck-series/compare/v0.1...v0.3+[0.1]: https://github.com/jdnavarro/smallcheck-series/compare/1df060...v0.1
− README.markdown
@@ -1,16 +0,0 @@-# Lens SmallCheck--[](https://hackage.haskell.org/package/smallcheck-lens) [](https://travis-ci.org/jdnavarro/smallcheck-lens)--[`smallcheck`](https://hackage.haskell.org/package/smallcheck) properties-ported from-[`lens-properties`](https://hackage.haskell.org/package/lens-properties)-and [`tasty`](https://hackage.haskell.org/package/tasty tasty) test trees-to validate `Lens`es, `Setter`s, `Traversal`s, `Iso`s and `Prism`s.--Most likely, you will only need the `Test.Tasty.SmallCheck.Lens` module,-which includes test trees ready to be run.--Check the-[tests](https://github.com/jdnavarro/smallcheck-lens/blob/master/tests/tasty.hs)-in this package for examples.
+ README.md view
@@ -0,0 +1,25 @@+# Lens SmallCheck++[](https://hackage.haskell.org/package/smallcheck-lens) [](https://travis-ci.org/jdnavarro/smallcheck-lens)++[`smallcheck`](https://hackage.haskell.org/package/smallcheck) properties+inspired by+[`lens-properties`](https://hackage.haskell.org/package/lens-properties).+They can be used to validate the laws for:++- `Lens`+- `Setter`+- `Traversal`+- `Iso`+- `Prism`++Use this package to create your own fine tuned tests. For preassembled+test runners with minimal setup and sensible defaults, you can use+[`tasty-lens`](https://hackage.haskell.org/package/tasty-lens).++## Contact++Contributions and bug reports are welcome!++Please feel free to contact jdnavarro on the #haskell IRC channel on+irc.freenode.net.
− Test/SmallCheck/Lens.hs
@@ -1,34 +0,0 @@-{-|-'Test.SmallCheck.Property' creators for every individual /Lens law/ using-explicit 'Test.SmallCheck.Series'.--Use this module when you need different 'Test.SmallCheck.Series' to the ones-implicitly in "Test.Tasty.SmallCheck.Lens" or when you don't want to use-@tasty@ as the test runner.--}-module Test.SmallCheck.Lens- (- -- * Setter- setterId- , setterSetSet- , setterComposition- -- * Traversal- , traversePure- , traversePureMaybe- , traverseCompose- -- * Lens- , lensSetView- , lensViewSet- -- * Prism- , prismYin- , prismYang- -- * Iso- , isoHither- , isoYon- ) where--import Test.SmallCheck.Lens.Iso-import Test.SmallCheck.Lens.Lens-import Test.SmallCheck.Lens.Prism-import Test.SmallCheck.Lens.Setter-import Test.SmallCheck.Lens.Traversal
Test/SmallCheck/Lens/Iso.hs view
@@ -1,4 +1,8 @@ {-# LANGUAGE RankNTypes #-}+-- | This module is intended to be imported @qualified@, for example:+--+-- > import qualified Test.SmallCheck.Lens.Iso as Iso+-- module Test.SmallCheck.Lens.Iso where import Control.Lens@@ -6,13 +10,13 @@ import qualified Test.SmallCheck as SC (over) import Test.SmallCheck.Series (Series, Serial) -isoHither+hither :: (Eq s, Show s, Eq a, Show a, Serial m a)- => AnIso' s a -> Series m s -> Property m-isoHither l ss = SC.over ss $ \s ->- s ^. cloneIso l . from l == s+ => Iso' s a -> Series m s -> Property m+hither l ss = SC.over ss $ \s ->+ s ^. l . from l == s -isoYon+yon :: (Eq s, Show s, Eq a, Show a, Serial m a)- => AnIso' s a -> Series m a -> Property m-isoYon l as = SC.over as $ \a -> a ^. from l . cloneIso l == a+ => Iso' s a -> Series m a -> Property m+yon l as = SC.over as $ \a -> a ^. from l . l == a
Test/SmallCheck/Lens/Lens.hs view
@@ -1,4 +1,8 @@ {-# LANGUAGE RankNTypes #-}+-- | This module is intended to be imported @qualified@, for example:+--+-- > import qualified Test.SmallCheck.Lens.Lens as Lens+-- module Test.SmallCheck.Lens.Lens where import Control.Lens@@ -6,11 +10,11 @@ import qualified Test.SmallCheck as SC (over) import Test.SmallCheck.Series (Series) -lensSetView :: (Monad m, Eq s, Show s) => Lens' s a -> Series m s -> Property m-lensSetView l ss = SC.over ss $ \s -> set l (view l s) s == s+setView :: (Monad m, Eq s, Show s) => Lens' s a -> Series m s -> Property m+setView l ss = SC.over ss $ \s -> set l (view l s) s == s -lensViewSet+viewSet :: (Monad m, Eq s, Eq a, Show s, Show a) => Lens' s a -> Series m s -> Series m a -> Property m-lensViewSet l ss as = SC.over ss $ \s -> SC.over as $ \a ->+viewSet l ss as = SC.over ss $ \s -> SC.over as $ \a -> view l (set l a s) == a
Test/SmallCheck/Lens/Prism.hs view
@@ -1,4 +1,8 @@ {-# LANGUAGE RankNTypes #-}+-- | This module is intended to be imported @qualified@, for example:+--+-- > import qualified Test.SmallCheck.Lens.Prism as Prism+-- module Test.SmallCheck.Lens.Prism where import Control.Lens@@ -6,12 +10,11 @@ import qualified Test.SmallCheck as SC (over) import Test.SmallCheck.Series (Series) -prismYin- :: (Monad m, Eq s, Show s, Eq a, Show a)- => Prism' s a -> Series m a -> Property m-prismYin l as = SC.over as $ \a -> preview l (review l a) == Just a+yin :: (Monad m, Eq s, Show s, Eq a, Show a)+ => Prism' s a -> Series m a -> Property m+yin l as = SC.over as $ \a -> preview l (review l a) == Just a -prismYang+yang :: (Monad m, Eq s, Show s, Eq a, Show a) => Prism' s a -> Series m s -> Property m-prismYang l ss = SC.over ss $ \s -> maybe s (review l) (preview l s) == s+yang l ss = SC.over ss $ \s -> maybe s (review l) (preview l s) == s
Test/SmallCheck/Lens/Setter.hs view
@@ -1,32 +1,56 @@ {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE RankNTypes #-}+-- | This module is intended to be imported @qualified@, for example:+--+-- > import qualified Test.SmallCheck.Lens.Setter as Setter+-- module Test.SmallCheck.Lens.Setter where- import Control.Lens import Test.SmallCheck (Property) import qualified Test.SmallCheck as SC (over) import Test.SmallCheck.Series (Series, Serial) import Test.SmallCheck.Series.Utils (zipLogic3) -setterId+identity :: (Eq s, Monad m, Show s)- => ASetter' s a -> Series m s -> Property m-setterId l se = SC.over se $ \s -> over l id s == s+ => Setter' s a -> Series m s -> Property m+identity l se = SC.over se $ \s -> over l id s == s -setterSetSet+setSet :: (Monad m, Eq s, Show s, Show a)- => ASetter' s a -> Series m s -> Series m a -> Series m a -> Property m-setterSetSet l ss as bs =+ => Setter' s a -> Series m s -> Series m a -> Series m a -> Property m+setSet l ss as bs = SC.over ss $ \s -> SC.over as $ \a -> SC.over bs $ \b -> set l b (set l a s) == set l b s -setterComposition+setSetSum+ :: (Monad m, Eq s, Show s, Show a)+ => Setter' s a -> Series m s -> Series m a -> Series m a -> Property m+setSetSum l ss as bs =+ SC.over (zipLogic3 ss as bs) $ \(s,a,b) ->+ set l b (set l a s) == set l b s++composition :: (Monad m, Eq s, Show s, Show a, Serial Identity a)- => ASetter' s a+ => Setter' s a -> Series m s -> Series m (a -> a) -> Series m (a -> a) -> Property m-setterComposition l ss fs gs = SC.over (zipLogic3 ss fs gs) $ \(s,f,g) ->+composition l ss fs gs =+ SC.over ss $ \s ->+ SC.over fs $ \f ->+ SC.over gs $ \g ->+ over l f (over l g s) == over l (f . g) s++compositionSum+ :: (Monad m, Eq s, Show s, Show a, Serial Identity a)+ => Setter' s a+ -> Series m s+ -> Series m (a -> a)+ -> Series m (a -> a)+ -> Property m+compositionSum l ss fs gs = SC.over (zipLogic3 ss fs gs) $ \(s,f,g) -> over l f (over l g s) == over l (f . g) s
Test/SmallCheck/Lens/Traversal.hs view
@@ -2,29 +2,48 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-}+-- | This module is intended to be imported @qualified@, for example:+--+-- > import qualified Test.SmallCheck.Lens.Traversal as Traversal+-- module Test.SmallCheck.Lens.Traversal where -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative (Applicative, pure)+#if MIN_VERSION_base(4,8,0)+import Prelude hiding (pure)+import qualified Prelude (pure)+#else+import Control.Applicative (Applicative)+import qualified Control.Applicative as Prelude (pure) #endif-import Control.Lens+import Data.Proxy (Proxy) import Data.Functor.Compose (Compose(..), getCompose)+import Control.Lens import Test.SmallCheck (Property) import qualified Test.SmallCheck as SC (over) import Test.SmallCheck.Series (Serial, Series) import Test.SmallCheck.Series.Utils (zipLogic3) -traversePure+pure :: forall m f s a. (Monad m, Show s, Applicative f, Eq (f s))- => LensLike' f s a -> Series m s -> Property m-traversePure l ss = SC.over ss $ \s -> l pure s == (pure s :: f s)+ => Proxy f -> Traversal' s a -> Series m s -> Property m+pure _ l ss = SC.over ss $ \s -> l Prelude.pure s == (Prelude.pure s :: f s) -traversePureMaybe- :: (Monad m, Show s, Eq s)- => LensLike' Maybe s a -> Series m s -> Property m-traversePureMaybe = traversePure+composition+ :: ( Monad m, Show s, Show a, Show (f a), Show (g a)+ , Applicative f, Applicative g, Eq (g (f s)), Serial Identity a+ )+ => Traversal' s a+ -> Series m s+ -> Series m (a -> f a)+ -> Series m (a -> g a)+ -> Property m+composition t ss fs gs =+ SC.over ss $ \s ->+ SC.over fs $ \f ->+ SC.over gs $ \g ->+ (fmap (t f) . t g) s == (getCompose . t (Compose . fmap f . g)) s -traverseCompose+compositionSum :: ( Monad m, Show s, Show a, Show (f a), Show (g a) , Applicative f, Applicative g, Eq (g (f s)), Serial Identity a )@@ -33,5 +52,5 @@ -> Series m (a -> f a) -> Series m (a -> g a) -> Property m-traverseCompose t ss fs gs = SC.over (zipLogic3 ss fs gs) $ \(s,f,g) ->+compositionSum t ss fs gs = SC.over (zipLogic3 ss fs gs) $ \(s,f,g) -> (fmap (t f) . t g) s == (getCompose . t (Compose . fmap f . g)) s
− Test/Tasty/SmallCheck/Lens.hs
@@ -1,26 +0,0 @@-{-|-Preassembled tasty test trees using 'Test.SmallCheck.Serial' instances and-one-to-one zipping of elements in 'Test.SmallCheck.Series' (see-'Test.SmallCheck.Series.Utils.zipLogic') when 'Test.SmallCheck.Serial'-functions are needed.--If you need more exhaustive testing coverage or if you experience combinatorial-explosion you can either override the default 'Test.SmallCheck.Serial'-instances with custom ones or you can create your own tasty test trees using-the functions at "Test.SmallCheck.Lens".--}-module Test.Tasty.SmallCheck.Lens- (- -- * Test Trees- testIso- , testLens- , testPrism- , testSetter- , testTraversal- ) where--import Test.Tasty.SmallCheck.Lens.Iso-import Test.Tasty.SmallCheck.Lens.Lens-import Test.Tasty.SmallCheck.Lens.Prism-import Test.Tasty.SmallCheck.Lens.Setter-import Test.Tasty.SmallCheck.Lens.Traversal
− Test/Tasty/SmallCheck/Lens/Iso.hs
@@ -1,32 +0,0 @@-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE RankNTypes #-}-module Test.Tasty.SmallCheck.Lens.Iso where--import Control.Lens-import Test.SmallCheck.Series (Serial(series), CoSerial)-import Test.Tasty (TestTree, testGroup)-import Test.Tasty.SmallCheck (testProperty)--import Test.SmallCheck.Lens.Iso-import Test.Tasty.SmallCheck.Lens.Lens---- | An 'Iso'' is only legal if the following laws hold:------ 1. @s ^. l . from l ≡ s@------ 2. @s ^. from l . l ≡ s@------ An 'Iso'' is also a valid 'Lens'' in both normal and reverse form. Check--- 'testLens'.-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-testIso l = testGroup "Iso Laws"- [ testProperty "s ^. l . from l ≡ s" $ isoHither l series- , testProperty "s ^. from l . l ≡ s" $ isoYon l series- , testLens l- , testLens (from l)- ]
− Test/Tasty/SmallCheck/Lens/Lens.hs
@@ -1,33 +0,0 @@-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE RankNTypes #-}-module Test.Tasty.SmallCheck.Lens.Lens where--import Control.Lens-import Test.SmallCheck.Series (Serial(series), CoSerial)-import Test.Tasty (TestTree, testGroup)-import Test.Tasty.SmallCheck (testProperty)--import Test.SmallCheck.Lens.Lens-import Test.Tasty.SmallCheck.Lens.Traversal---- | A 'Lens'' is only legal if it is a valid 'Traversal'' (see--- 'testTraversal'), and if the following laws hold:------ 1. @view l (set l b a) ≡ b@------ 2. @set l (view l a) a ≡ a@------ 3. @set l c (set l b a) ≡ set l c a@-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-testLens l = testGroup "Lens Laws"- [ testProperty "view l (set l b a) ≡ b" $- lensSetView l series- , testProperty "set l (view l a) a ≡ a" $- lensViewSet l series series- , testTraversal l- ]
− Test/Tasty/SmallCheck/Lens/Prism.hs
@@ -1,31 +0,0 @@-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE RankNTypes #-}-module Test.Tasty.SmallCheck.Lens.Prism where--import Control.Lens-import Test.SmallCheck.Series (Serial(series), CoSerial)-import Test.Tasty (TestTree, testGroup)-import Test.Tasty.SmallCheck (testProperty)--import Test.SmallCheck.Lens.Prism-import Test.Tasty.SmallCheck.Lens.Traversal---- | A 'Prism'' is only legal if it is a valid 'Traversal'' (see--- 'testTraversal'), and if the following laws hold:------ 1. @preview l (review l b) ≡ Just b"@------ 2. @maybe s (review l) (preview l s) ≡ s@-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-testPrism l = testGroup "Prism Laws"- [ testTraversal l- , testProperty "preview l (review l b) ≡ Just b" $- prismYin l series- , testProperty "maybe s (review l) (preview l s) ≡ s" $- prismYang l series- ]
− Test/Tasty/SmallCheck/Lens/Setter.hs
@@ -1,30 +0,0 @@-{-# LANGUAGE FlexibleContexts #-}-module Test.Tasty.SmallCheck.Lens.Setter where--import Control.Lens-import Test.SmallCheck.Series (Serial(series), CoSerial)-import Test.Tasty (TestTree, testGroup)-import Test.Tasty.SmallCheck (testProperty)--import Test.SmallCheck.Lens.Setter---- | A 'Setter' is only legal if the following laws hold:------ 1. @set l y (set l x a) ≡ set l y a@------ 2. @over l id ≡ id@------ 3. @over l f . over l g ≡ over l (f . g)@-testSetter- :: ( Eq s, Show s, Show a- , Serial IO a, Serial Identity a, CoSerial IO a- , Serial IO s- )- => ASetter' s a -> TestTree-testSetter l = testGroup "Setter Laws"- [ testProperty "over l id ≡ id" $ setterId l series- , testProperty "set l y (set l x a) ≡ set l y a" $- setterSetSet l series series series- , testProperty "over l f . over l g ≡ over l (f . g)" $- setterComposition l series series series- ]
− Test/Tasty/SmallCheck/Lens/Traversal.hs
@@ -1,32 +0,0 @@-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE RankNTypes #-}-{-# LANGUAGE ScopedTypeVariables #-}-module Test.Tasty.SmallCheck.Lens.Traversal where--import Control.Lens-import Test.SmallCheck.Series (Serial(series), CoSerial, Series)-import Test.Tasty (TestTree, testGroup)-import Test.Tasty.SmallCheck (testProperty)--import Test.SmallCheck.Lens.Traversal-import Test.Tasty.SmallCheck.Lens.Setter---- | A 'Traversal'' is only legal if it is a valid 'Setter'' (see--- 'testSetter'), and if the following laws hold:------ 1. @t pure ≡ pure@------ 2. @fmap (t f) . t g ≡ getCompose . t (Compose . fmap 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-testTraversal t = testGroup "Traversal Laws"- [ testProperty "t pure ≡ pure" $ traversePureMaybe t series- , testProperty "fmap (t f) . t g ≡ getCompose . t (Compose . fmap f . g)" $- traverseCompose t series (series :: Series IO (a -> [a]))- (series :: Series IO (a -> Maybe a))- , testSetter t- ]
smallcheck-lens.cabal view
@@ -1,18 +1,8 @@ name: smallcheck-lens-version: 0.1-synopsis: SmallCheck lens laws+version: 0.3+synopsis: SmallCheck properties for lens description:- @<https://hackage.haskell.org/package/smallcheck smallcheck>@ properties- ported from- @<https://hackage.haskell.org/package/lens-properties lens-properties>@- and @<https://hackage.haskell.org/package/tasty tasty>@ test trees to validate @Lens@es, @Setter@s, @Traversal@s, @Iso@s and @Prism@s.- .- Most likely, you will only need the "Test.Tasty.SmallCheck.Lens"- module, which includes test trees ready to be run.- .- Check the- <https://github.com/jdnavarro/smallcheck-lens/blob/master/tests/tasty.hs tests>- in this package for examples.+ @SmallCheck@ properties for @Lens@es, @Setter@s, @Traversal@s, @Iso@s and @Prism@s. homepage: https://github.com/jdnavarro/smallcheck-lens bug-reports: https://github.com/jdnavarro/smallcheck-lens/issues license: BSD3@@ -21,7 +11,7 @@ maintainer: j@dannynavarro.net category: Testing, Lenses build-type: Simple-extra-source-files: README.markdown CHANGELOG.markdown+extra-source-files: README.md CHANGELOG.md stack.yaml cabal-version: >=1.10 source-repository head@@ -31,35 +21,16 @@ library default-language: Haskell2010 ghc-options: -Wall- exposed-modules: Test.SmallCheck.Lens- Test.SmallCheck.Lens.Iso+ exposed-modules: Test.SmallCheck.Lens.Iso Test.SmallCheck.Lens.Lens Test.SmallCheck.Lens.Prism Test.SmallCheck.Lens.Setter Test.SmallCheck.Lens.Traversal- Test.Tasty.SmallCheck.Lens- Test.Tasty.SmallCheck.Lens.Iso- Test.Tasty.SmallCheck.Lens.Lens- Test.Tasty.SmallCheck.Lens.Prism- Test.Tasty.SmallCheck.Lens.Setter- Test.Tasty.SmallCheck.Lens.Traversal build-depends: base >=4.6 && <4.9,- transformers,- lens,- smallcheck >= 1.1,- smallcheck-series >=0.3,- tasty,- tasty-smallcheck--test-suite tasty- default-language: Haskell2010- type: exitcode-stdio-1.0- hs-source-dirs: tests- main-is: tasty.hs- ghc-options: -Wall -threaded- build-depends: base >= 4.6 && <4.9,+ transformers >=0.3.0.0, lens >=4.1.2.1,- tasty,- tasty-smallcheck,- smallcheck,- smallcheck-lens+ smallcheck >=1.1.1,+ smallcheck-series >=0.3++ if impl(ghc < 7.8)+ build-depends: tagged >=0.7.2
+ stack.yaml view
@@ -0,0 +1,6 @@+flags: {}+packages:+- '.'+extra-deps:+- smallcheck-series-0.5.1+resolver: lts-3.4
− tests/tasty.hs
@@ -1,66 +0,0 @@-module Main where--import Control.Lens-import Numeric.Lens (hex, negated, adding)-import Test.Tasty (TestTree, defaultMain, testGroup)--import Test.Tasty.SmallCheck.Lens--main :: IO ()-main = defaultMain $ testGroup "Lens tests"- [ tupleTests- , maybeTests- , numTests- ]--tupleTests :: TestTree-tupleTests = testGroup "Tuples"- [ testGroup "_1"- [ testGroup "Lens' (Char,Char) Char"- [ testLens (_1 :: Lens' (Char,Char) Char) ]- , testGroup "Lens' (Int,Char) Int"- [ testLens (_1 :: Lens' (Int,Char) Int) ]- ]- , testGroup "_2"- [ testGroup "Lens' (Char,Char,Char) Char"- [ testLens (_2 :: Lens' (Char,Char,Char) Char) ]- ]- ]--maybeTests :: TestTree-maybeTests = testGroup "Maybe"- [ testGroup "_Nothing"- [ testGroup "Prism' (Maybe Char) ()"- [ testPrism (_Nothing :: Prism' (Maybe Char) ()) ]- , testGroup "Prism' (Maybe Int) ()"- [ testPrism (_Nothing :: Prism' (Maybe Int) ()) ]- ]- , testGroup "_Just"- [ testGroup "Prism' (Maybe Char) Char"- [ testPrism (_Just :: Prism' (Maybe Char) Char) ]- , testGroup "Prism' (Maybe Int) Int"- [ testPrism (_Just :: Prism' (Maybe Int) Int) ]- ]- ]--numTests :: TestTree-numTests = testGroup "Numeric"- [ testGroup "negated"- [ testGroup "Iso' Int Int"- [ testIso (negated :: Iso' Int Int) ]- , testGroup "Iso' Float Float"- [ testIso (negated :: Iso' Float Float) ]- ]- , testGroup "hex"- [ testGroup "Prism'' String Int"- [ testPrism (hex :: Prism' String Int) ]- , testGroup "Prism'' String Integer"- [ testPrism (hex :: Prism' String Integer) ]- ]- , testGroup "adding"- [ testGroup "Iso' Int Int"- [ testIso (adding 2 :: Iso' Int Int) ]- , testGroup "Iso' Integer Integer"- [ testIso (adding 3 :: Iso' Integer Integer) ]- ]- ]