Skip to content

Commit

Permalink
Check issue remains fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
idontgetoutmuch committed Apr 29, 2020
1 parent 0d51fa4 commit f913dcd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion random.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ test-suite spec
smallcheck >=1.1 && <1.2,
tasty >=1.0 && <1.3,
tasty-smallcheck >=0.8 && <0.9,
tasty-expected-failure >=0.11 && <0.12
tasty-expected-failure >=0.11 && <0.12,
tasty-hunit >=0.10 && <0.11

benchmark legacy-bench
type: exitcode-stdio-1.0
Expand Down
14 changes: 14 additions & 0 deletions test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Data.Word
import Data.Int
import System.Random
import Test.Tasty
import Test.Tasty.HUnit
import Test.Tasty.SmallCheck as SC
import Test.SmallCheck.Series as SC
import Data.Typeable
Expand Down Expand Up @@ -71,8 +72,21 @@ main =
-- , bitmaskSpec @Word64
-- , bitmaskSpec @Word
, runSpec
, unitTests
]

unitTests :: TestTree
unitTests = testGroup "Unit tests"
[ -- Check that https://github.com/haskell/random/issues/53 does not regress

testCase "Subnormal generation respects upper bound" $
[] @?= (filter (>4.0e-45) $ take 10 $ randomRs (0,(4.0e-45::Float)) $ mkStdGen 0)

, testCase "Subnormal generation includes upper bound" $
1.0e-45 `elem` (take 100 $ randomRs (0,(1.0e-45::Float)) $ mkStdGen 0) @?
"Does not contain 1.0e-45"
]

showsType :: forall t . Typeable t => ShowS
showsType = showsTypeRep (typeRep (Proxy :: Proxy t))

Expand Down

0 comments on commit f913dcd

Please sign in to comment.