packages feed

hedgehog 0.6 → 0.6.1

raw patch · 7 files changed

+124/−9 lines, 7 filesdep ~ansi-terminaldep ~containersdep ~pretty-showPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: ansi-terminal, containers, pretty-show, semigroups, stm, template-haskell, th-lift, time

API changes (from Hackage documentation)

- Hedgehog.Internal.Discovery: instance Data.Semigroup.Semigroup a => Data.Semigroup.Semigroup (Hedgehog.Internal.Discovery.Pos a)
- Hedgehog.Internal.Gen: instance (GHC.Base.Monad m, Data.Semigroup.Semigroup a) => Data.Semigroup.Semigroup (Hedgehog.Internal.Gen.GenT m a)
- Hedgehog.Internal.Property: instance Data.Semigroup.Semigroup Hedgehog.Internal.Property.GroupName
- Hedgehog.Internal.Property: instance Data.Semigroup.Semigroup Hedgehog.Internal.Property.PropertyName
- Hedgehog.Internal.Report: instance Data.Semigroup.Semigroup Hedgehog.Internal.Report.Style
- Hedgehog.Internal.Report: instance Data.Semigroup.Semigroup Hedgehog.Internal.Report.Summary
+ Hedgehog.Internal.Discovery: instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Hedgehog.Internal.Discovery.Pos a)
+ Hedgehog.Internal.Gen: instance (GHC.Base.Monad m, GHC.Base.Semigroup a) => GHC.Base.Semigroup (Hedgehog.Internal.Gen.GenT m a)
+ Hedgehog.Internal.Property: instance GHC.Base.Semigroup Hedgehog.Internal.Property.GroupName
+ Hedgehog.Internal.Property: instance GHC.Base.Semigroup Hedgehog.Internal.Property.PropertyName
+ Hedgehog.Internal.Report: instance GHC.Base.Semigroup Hedgehog.Internal.Report.Style
+ Hedgehog.Internal.Report: instance GHC.Base.Semigroup Hedgehog.Internal.Report.Summary
- Hedgehog: Command :: (state Symbolic -> Maybe (n (input Symbolic))) -> (input Concrete -> m output) -> [Callback input output state] -> Command n m
+ Hedgehog: Command :: state Symbolic -> Maybe (n (input Symbolic)) -> input Concrete -> m output -> [Callback input output state] -> Command n m
- Hedgehog.Internal.Gen: GenT :: (Size -> Seed -> Tree (MaybeT m) a) -> GenT m a
+ Hedgehog.Internal.Gen: GenT :: Size -> Seed -> Tree (MaybeT m) a -> GenT m a
- Hedgehog.Internal.Show: data Value :: *
+ Hedgehog.Internal.Show: data Value
- Hedgehog.Internal.Source: data CallStack :: *
+ Hedgehog.Internal.Source: data CallStack
- Hedgehog.Internal.Source: withFrozenCallStack :: HasCallStack => (HasCallStack -> a) -> a
+ Hedgehog.Internal.Source: withFrozenCallStack :: HasCallStack => HasCallStack -> a -> a
- Hedgehog.Internal.State: Action :: input Symbolic -> Symbolic output -> (input Concrete -> m output) -> (state Symbolic -> input Symbolic -> Bool) -> (forall v. Ord1 v => state v -> input v -> Var output v -> state v) -> (state Concrete -> state Concrete -> input Concrete -> output -> Test ()) -> Action m
+ Hedgehog.Internal.State: Action :: input Symbolic -> Symbolic output -> input Concrete -> m output -> state Symbolic -> input Symbolic -> Bool -> forall v. Ord1 v => state v -> input v -> Var output v -> state v -> state Concrete -> state Concrete -> input Concrete -> output -> Test () -> Action m
- Hedgehog.Internal.State: Command :: (state Symbolic -> Maybe (n (input Symbolic))) -> (input Concrete -> m output) -> [Callback input output state] -> Command n m
+ Hedgehog.Internal.State: Command :: state Symbolic -> Maybe (n (input Symbolic)) -> input Concrete -> m output -> [Callback input output state] -> Command n m

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+## Version 0.6.1 (2018-09-22)++- Set stdout/stderr encoding to UTF-8 on Windows ([#218][218], [@moodmosaic][moodmosaic])+ ## Version 0.6 (2018-05-14)  - Pass [Dieharder][Dieharder] statistical/randomness tests ([#185][185], [@moodmosaic][moodmosaic])
hedgehog.cabal view
@@ -1,4 +1,4 @@-version: 0.6+version: 0.6.1  name:   hedgehog@@ -37,6 +37,8 @@   , GHC == 8.2.1   , GHC == 8.2.2   , GHC == 8.4.1+  , GHC == 8.4.2+  , GHC == 8.4.3 extra-source-files:   README.md   CHANGELOG.md@@ -52,7 +54,7 @@     , async                           >= 2.0        && < 2.3     , bytestring                      >= 0.10       && < 0.11     , concurrent-output               >= 1.7        && < 1.11-    , containers                      >= 0.4        && < 0.6+    , containers                      >= 0.4        && < 0.7     , directory                       >= 1.2        && < 1.4     , exceptions                      >= 0.7        && < 0.11     , lifted-async                    >= 0.7        && < 0.11@@ -68,7 +70,7 @@     , template-haskell                >= 2.10       && < 2.14     , text                            >= 1.1        && < 1.3     , th-lift                         >= 0.7        && < 0.8-    , time                            >= 1.4        && < 1.9+    , time                            >= 1.4        && < 1.10     , transformers                    >= 0.4        && < 0.6     , transformers-base               >= 0.4        && < 0.5     , wl-pprint-annotated             >= 0.0        && < 0.2@@ -124,12 +126,13 @@     test    other-modules:+    Test.Hedgehog.Seed     Test.Hedgehog.Text    build-depends:       hedgehog     , base                            >= 3          && < 5-    , containers                      >= 0.4        && < 0.6+    , containers                      >= 0.4        && < 0.7     , pretty-show                     >= 1.6        && < 1.8     , semigroups                      >= 0.16       && < 0.19     , text                            >= 1.1        && < 1.3
src/Hedgehog/Internal/Report.hs view
@@ -1,4 +1,5 @@ {-# OPTIONS_HADDOCK not-home #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-}@@ -63,6 +64,9 @@ import           System.Console.ANSI (ConsoleLayer(..), ConsoleIntensity(..)) import           System.Console.ANSI (SGR(..), setSGRCode) import           System.Directory (makeRelativeToCurrentDirectory)+#if mingw32_HOST_OS+import           System.IO (hSetEncoding, stdout, stderr, utf8)+#endif  import           Text.PrettyPrint.Annotated.WL (Doc, (<+>)) import qualified Text.PrettyPrint.Annotated.WL as WL@@ -885,6 +889,11 @@         DisableColor ->           WL.display +#if mingw32_HOST_OS+  liftIO $ do+    hSetEncoding stdout utf8+    hSetEncoding stderr utf8+#endif   pure .     display .     WL.renderSmart 100 $
src/Hedgehog/Internal/Runner.hs view
@@ -1,5 +1,6 @@ {-# OPTIONS_HADDOCK not-home #-} {-# LANGUAGE BangPatterns #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE DoAndIfThenElse #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE LambdaCase #-}@@ -45,6 +46,9 @@  import           Language.Haskell.TH.Lift (deriveLift) +#if mingw32_HOST_OS+import           System.IO (hSetEncoding, stdout, stderr, utf8)+#endif  -- | Configuration for a property test run. --@@ -265,6 +269,10 @@     -- our tests will saturate all the capabilities they're given.     updateNumCapabilities (n + 2) +#if mingw32_HOST_OS+    hSetEncoding stdout utf8+    hSetEncoding stderr utf8+#endif     putStrLn $ "━━━ " ++ unGroupName group ++ " ━━━"      verbosity <- resolveVerbosity (runnerVerbosity config)
src/Hedgehog/Internal/Seed.hs view
@@ -25,6 +25,9 @@ -- 2. Nikos Baxevanis --    https://github.com/moodmosaic/SplitMix/blob/master/SplitMix.hs --++#include "MachDeps.h"+ module Hedgehog.Internal.Seed (     Seed(..)   , random@@ -48,7 +51,11 @@  import           Data.Bifunctor (first) import           Data.Bits ((.|.), xor, shiftR, popCount)-import           Data.Int (Int32, Int64)+#if (SIZEOF_HSINT == 8)+import           Data.Int (Int64)+#else+import           Data.Int (Int32)+#endif import           Data.Time.Clock.POSIX (getPOSIXTime) import           Data.IORef (IORef) import qualified Data.IORef as IORef@@ -100,7 +107,7 @@ -- from :: Word64 -> Seed from x =-  Seed x goldenGamma+  Seed (mix64 x) (mixGamma (x + goldenGamma))  -- | A predefined gamma value's needed for initializing the "root" instances of --   'Seed'. That is, instances not produced by splitting an already existing@@ -192,15 +199,13 @@     y = mix64variant13 x .|. 1     n = popCount $ y `xor` (y `shiftR` 1)   in-    if n >= 24 then+    if n < 24 then       y `xor` 0xaaaaaaaaaaaaaaaa     else       y  ------------------------------------------------------------------------ -- RandomGen instances--#include "MachDeps.h"  #if (SIZEOF_HSINT == 8) instance RandomGen Seed where
+ test/Test/Hedgehog/Seed.hs view
@@ -0,0 +1,84 @@+{-# LANGUAGE TemplateHaskell #-}+module Test.Hedgehog.Seed (+    tests+  ) where++import           Data.Foldable (for_)++import           Hedgehog+import qualified Hedgehog.Internal.Seed as Seed++data Assert =+  Assert {+      expected :: !Seed+    , actual   :: !Seed+    } deriving (Show)++-- | Verify that SplitMix avoids pathological γ-values, as discussed by+--   Melissa E. O'Neill in the post with title Bugs in SplitMix(es), at+--   http://www.pcg-random.org/posts/bugs-in-splitmix.html+--+--   See also:+--   https://github.com/hedgehogqa/haskell-hedgehog/issues/191+--+prop_avoid_pathological_gamma_values :: Property+prop_avoid_pathological_gamma_values =+  withTests 1 . property $ do+    for_ asserts $ \a ->+      expected a === actual a++asserts :: [Assert]+asserts = [+    Assert+      (Seed 15210016002011668638 12297829382473034411)+      (Seed.from 0x61c8864680b583eb)+  , Assert+      (Seed 11409286845259996466 12297829382473034411)+      (Seed.from 0xf8364607e9c949bd)+  , Assert+      (Seed 1931727433621677744 12297829382473034411)+      (Seed.from 0x88e48f4fcc823718)+  , Assert+      (Seed 307741759840609752 12297829382473034411)+      (Seed.from 0x7f83ab8da2e71dd1)+  , Assert+      (Seed 8606169619657412120 12297829382473034413)+      (Seed.from 0x7957d809e827ff4c)+  , Assert+      (Seed 13651108307767328632 12297829382473034413)+      (Seed.from 0xf8d059aee4c53639)+  , Assert+      (Seed 125750466559701114 12297829382473034413)+      (Seed.from 0x9cd9f015db4e58b7)+  , Assert+      (Seed 6781260234005250507 12297829382473034413)+      (Seed.from 0xf4077b0dbebc73c0)+  , Assert+      (Seed 15306535823716590088 12297829382473034405)+      (Seed.from 0x305cb877109d0686)+  , Assert+      (Seed 7344074043290227165 12297829382473034405)+      (Seed.from 0x359e58eeafebd527)+  , Assert+      (Seed 9920554987610416076 12297829382473034405)+      (Seed.from 0xbeb721c511b0da6d)+  , Assert+      (Seed 3341781972484278810 12297829382473034405)+      (Seed.from 0x86466fd0fcc363a6)+  , Assert+      (Seed 12360157267739240775 12297829382473034421)+      (Seed.from 0xefee3e7b93db3075)+  , Assert+      (Seed 600595566262245170 12297829382473034421)+      (Seed.from 0x79629ee76aa83059)+  , Assert+      (Seed 1471112649570176389 12297829382473034421)+      (Seed.from 0x05d507d05e785673)+  , Assert+      (Seed 8100917074368564322 12297829382473034421)+      (Seed.from 0x76442b62dddf926c)+  ]++tests :: IO Bool+tests =+  checkParallel $$(discover)
test/test.hs view
@@ -2,6 +2,7 @@ import           System.IO (BufferMode(..), hSetBuffering, stdout, stderr) import           System.Exit (exitFailure) +import qualified Test.Hedgehog.Seed import qualified Test.Hedgehog.Text  @@ -12,6 +13,7 @@    results <- sequence [       Test.Hedgehog.Text.tests+    , Test.Hedgehog.Seed.tests     ]    unless (and results) $