genvalidity-hspec-optics 0.1.1.0 → 0.1.1.1
raw patch · 3 files changed
+29/−24 lines, 3 filesdep +genvalidity-propertydep +validitydep ~genvalidityPVP ok
version bump matches the API change (PVP)
Dependencies added: genvalidity-property, validity
Dependency ranges changed: genvalidity
API changes (from Hackage documentation)
Files
- genvalidity-hspec-optics.cabal +8/−3
- src/Test/Validity/Optics.hs +12/−12
- test/Test/Validity/OpticsSpec.hs +9/−9
genvalidity-hspec-optics.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: cba52a6d66505856cb2e4e3a9e34de6552c7e57318ca36cde0c4c7a4667f1add+-- hash: 93abfa3e29b4b7942e6f02fb9e2ccbbdb0bf748eb2c9225ab9c73b33a4f7f3d7 name: genvalidity-hspec-optics-version: 0.1.1.0+version: 0.1.1.1 synopsis: Standard spec's for optics description: Standard spec's for optics category: Testing@@ -52,8 +52,11 @@ build-depends: base , doctest+ , genvalidity >=0.7 , genvalidity-hspec-optics+ , genvalidity-property >=0.3 , hspec+ , validity >=0.9 default-language: Haskell2010 test-suite genvalidity-hspec-optics-test@@ -67,9 +70,11 @@ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall build-depends: base- , genvalidity+ , genvalidity >=0.7 , genvalidity-hspec , genvalidity-hspec-optics+ , genvalidity-property >=0.3 , hspec , microlens+ , validity >=0.9 default-language: Haskell2010
src/Test/Validity/Optics.hs view
@@ -36,7 +36,7 @@ -- -- Example usage: ----- > lensSpecOnValid ((_2) :: Lens (Double, Double) (Double, Double) Double Double)+-- > lensSpecOnValid ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) lensSpecOnValid :: forall s b. (Show b, Eq b, GenValid b, Show s, Eq s, GenValid s) => Lens s s b b@@ -83,7 +83,7 @@ -- -- Example usage: ----- > lensSpecOnArbitrary ((_2) :: Lens (Double, Double) (Double, Double) Double Double)+-- > lensSpecOnArbitrary ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) lensSpecOnArbitrary :: forall s b. ( Show b@@ -112,7 +112,7 @@ -- Example usage: -- -- > lensSpecOnGen--- > ((_2) :: Lens (Double, Double) (Double, Double) Double Double)+-- > ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) -- > (abs <$> genValid) -- > "positive valid doubles" -- > (filter (0.0 >=) . shrinkValid)@@ -159,7 +159,7 @@ -- -- Example usage: ----- prop> lensLaw1 ((_2) :: Lens (Double, Double) (Double, Double) Double Double) genValid shrinkValid genValid shrinkValid+-- prop> lensLaw1 ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) genValid shrinkValid genValid shrinkValid lensLaw1 :: (Show b, Eq b, Show s) => Lens s s b b@@ -178,7 +178,7 @@ -- -- Example usage: ----- prop> lensLaw2 ((_2) :: Lens (Double, Double) (Double, Double) Double Double) genValid shrinkValid+-- prop> lensLaw2 ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) genValid shrinkValid lensLaw2 :: (Show s, Eq s) => Lens s s b b -> Gen s -> (s -> [s]) -> Property lensLaw2 l genS shrinkS = forAllShrink genS shrinkS $ \s -> set l (view l s) s `shouldBe` s@@ -189,7 +189,7 @@ -- -- Example usage: ----- prop> lensLaw3 ((_2) :: Lens (Double, Double) (Double, Double) Double Double) genValid shrinkValid genValid shrinkValid+-- prop> lensLaw3 ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) genValid shrinkValid genValid shrinkValid lensLaw3 :: (Show b, Eq b, Show s, Eq s) => Lens s s a b@@ -208,7 +208,7 @@ -- -- Example Usage: ----- prop> lensGettingProducesValidOnValid ((_2) :: Lens (Double, Double) (Double, Double) Double Double)+-- prop> lensGettingProducesValidOnValid ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) lensGettingProducesValidOnValid :: (Show s, GenValid s, Show b, GenValid b) => Lens s s b b -> Property lensGettingProducesValidOnValid l =@@ -228,7 +228,7 @@ -- -- Example Usage: ----- prop> lensGettingProducesValidOnArbitrary ((_2) :: Lens (Double, Double) (Double, Double) Double Double)+-- prop> lensGettingProducesValidOnArbitrary ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) lensGettingProducesValidOnArbitrary :: (Show s, Arbitrary s, Show b, Validity b) => Lens s s b b@@ -242,7 +242,7 @@ -- -- Example Usage: ----- prop> lensGettingProducesValidOnGen ((_2) :: Lens (Double, Double) (Double, Double) Double Double) genValid shrinkValid+-- prop> lensGettingProducesValidOnGen ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) genValid shrinkValid lensGettingProducesValidOnGen :: (Validity b, Show b, Show s) => Lens s s b b@@ -256,7 +256,7 @@ -- -- Example usage: ----- prop> lensSettingProducesValidOnValid ((_2) :: Lens (Double, Double) (Double, Double) Double Double)+-- prop> lensSettingProducesValidOnValid ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) lensSettingProducesValidOnValid :: (Show s, GenValid s, Show b, GenValid b, Show t, Validity t) => Lens s t a b@@ -285,7 +285,7 @@ -- -- Example usage: ----- prop> lensSettingProducesValidOnArbitrary ((_2) :: Lens (Double, Double) (Double, Double) Double Double)+-- prop> lensSettingProducesValidOnArbitrary ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) lensSettingProducesValidOnArbitrary :: (Show s, Arbitrary s, Show b, Arbitrary b, Show t, Validity t) => Lens s t a b@@ -299,7 +299,7 @@ -- -- Example usage: ----- prop> lensSettingProducesValidOnGen ((_2) :: Lens (Double, Double) (Double, Double) Double Double) genValid shrinkValid genValid shrinkValid+-- prop> lensSettingProducesValidOnGen ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) genValid shrinkValid genValid shrinkValid lensSettingProducesValidOnGen :: (Show s, Show b, Show t, Validity t) => Lens s t a b
test/Test/Validity/OpticsSpec.hs view
@@ -17,14 +17,14 @@ spec = do describe "lensSpecOnValid" $ lensSpecOnValid- ((_2) :: Lens (Double, Double) (Double, Double) Double Double)+ ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) describe "lensSpec" $ lensSpec ((_2) :: Lens (Int, Int) (Int, Int) Int Int) describe "lensSpecOnArbitrary" $ lensSpecOnArbitrary- ((_2) :: Lens (Double, Double) (Double, Double) Double Double)+ ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) describe "lensSpecOnGen" $ lensSpecOnGen- ((_2) :: Lens (Double, Double) (Double, Double) Double Double)+ ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) (abs <$> genValid) "positive valid doubles" (filter (0.0 >=) . shrinkValid)@@ -34,35 +34,35 @@ describe "lensGettingProducesValidOnValid" $ it "holds for (_2) for doubles" $ lensGettingProducesValidOnValid- ((_2) :: Lens (Double, Double) (Double, Double) Double Double)+ ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) describe "lensGettingProducesValid" $ it "holds for (_2) for ints" $ lensGettingProducesValid ((_2) :: Lens (Int, Int) (Int, Int) Int Int) describe "lensGettingProducesValidOnArbitrary" $ it "holds for (_2) for doubles" $ lensGettingProducesValidOnArbitrary- ((_2) :: Lens (Double, Double) (Double, Double) Double Double)+ ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) describe "lensGettingProducesValidOnGen" $ it "holds for (_2) for special generators" $ lensGettingProducesValidOnGen- ((_2) :: Lens (Double, Double) (Double, Double) Double Double)+ ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) ((,) <$> (negate . abs <$> genValid) <*> (negate . abs <$> genValid)) (const []) describe "lensSettingProducesValidOnValid" $ it "holds for (_2) for doubles" $ lensSettingProducesValidOnValid- ((_2) :: Lens (Double, Double) (Double, Double) Double Double)+ ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) describe "lensSettingProducesValid" $ it "holds for (_2) for ints" $ lensSettingProducesValid ((_2) :: Lens (Int, Int) (Int, Int) Int Int) describe "lensSettingProducesValidOnArbitrary" $ it "holds for (_2) for doubles" $ lensSettingProducesValidOnArbitrary- ((_2) :: Lens (Double, Double) (Double, Double) Double Double)+ ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) describe "lensSettingProducesValidOnGen" $ it "holds for (_2) for special generators" $ lensSettingProducesValidOnGen- ((_2) :: Lens (Double, Double) (Double, Double) Double Double)+ ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) (abs <$> genValid) (filter (0.0 >=) . shrinkValid) ((,) <$> (negate . abs <$> genValid) <*> (negate . abs <$> genValid))