packages feed

hw-hedgehog (empty) → 0.1.0.0

raw patch · 7 files changed

+114/−0 lines, 7 filesdep +basedep +hedgehogdep +hw-hedgehogsetup-changed

Dependencies added: base, hedgehog, hw-hedgehog, vector

Files

+ LICENSE view
@@ -0,0 +1,30 @@+Copyright Author name here (c) 2017++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Author name here nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,1 @@+# hw-hedgehog
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ hw-hedgehog.cabal view
@@ -0,0 +1,36 @@+name:                 hw-hedgehog+version:              0.1.0.0+synopsis:             Extra hedgehog functionality+description:          Extra hedgehog functionality+homepage:             https://github.com/githubuser/hw-hedgehog#readme+license:              BSD3+license-file:         LICENSE+author:               Author name here+maintainer:           example@example.com+copyright:            2017 Author name here+category:             Web+build-type:           Simple+extra-source-files:   README.md+cabal-version:        >=1.10++library+  hs-source-dirs:       src+  exposed-modules:      HaskellWorks.Hedgehog+                      , HaskellWorks.Hedgehog.Gen+  build-depends:        base >= 4.7 && < 5+                      , hedgehog+                      , vector+  default-language:     Haskell2010++test-suite hw-hedgehog-test+  type:                 exitcode-stdio-1.0+  hs-source-dirs:       test+  main-is:              Spec.hs+  build-depends:        base+                      , hw-hedgehog+  ghc-options:          -threaded -rtsopts -with-rtsopts=-N+  default-language:     Haskell2010++source-repository head+  type:       git+  location:   https://github.com/githubuser/hw-hedgehog
+ src/HaskellWorks/Hedgehog.hs view
@@ -0,0 +1,26 @@+module HaskellWorks.Hedgehog where++import Hedgehog+import Hedgehog.Internal.Property (MonadTest(..), failDiff, failWith)+import Hedgehog.Internal.Source (HasCallStack(..), withFrozenCallStack)+import Hedgehog.Internal.Show++reversed :: Group -> Group+reversed (Group name properties) = Group name (reverse properties)++(/==) :: (MonadTest m, Eq a, Show a, HasCallStack) => a -> a -> m ()+(/==) x y = do+  ok <- withFrozenCallStack $ eval (x /= y)+  if ok+    then success+    else withFrozenCallStack $ failDiff x y++(?==) :: (MonadTest m, Eq a, Show a, HasCallStack) => a -> (a -> Bool) -> m ()+(?==) x p = do+  r <- withFrozenCallStack $ eval x+  if p r+    then success+    else withFrozenCallStack $ failWith Nothing $ unlines+          [ "━━━ Invalid result ━━━"+          , showPretty x+          ]
+ src/HaskellWorks/Hedgehog/Gen.hs view
@@ -0,0 +1,17 @@+module HaskellWorks.Hedgehog.Gen+  ( vector+  ) where++import Hedgehog+import Foreign.Storable++import qualified Data.Vector          as DV+import qualified Data.Vector.Storable as DVS+import qualified Hedgehog.Gen         as G+import qualified Hedgehog.Range       as R++vector :: MonadGen m => Range Int -> m a -> m (DV.Vector a)+vector n g = DV.fromList <$> G.list n g++storableVector :: (Storable a, MonadGen m) => Range Int -> m a -> m (DVS.Vector a)+storableVector n g = DVS.fromList <$> G.list n g
+ test/Spec.hs view
@@ -0,0 +1,2 @@+main :: IO ()+main = putStrLn "Test suite not yet implemented"